Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
floorl.c
Go to the documentation of this file.
00001 #pragma ident "@(#)92/math/floorl.c     92.1    06/02/99 16:43:34"
00002 
00003 /*
00004 
00005   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00006 
00007   This program is free software; you can redistribute it and/or modify it
00008   under the terms of version 2 of the GNU General Public License as
00009   published by the Free Software Foundation.
00010 
00011   This program is distributed in the hope that it would be useful, but
00012   WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00014 
00015   Further, this software is distributed without any warranty that it is
00016   free of the rightful claim of any third person regarding infringement 
00017   or the like.  Any license provided herein, whether implied or 
00018   otherwise, applies only to this software file.  Patent licenses, if 
00019   any, provided herein do not apply to combinations of this program with 
00020   other software, or any other product whatsoever.  
00021 
00022   You should have received a copy of the GNU General Public License along
00023   with this program; if not, write the Free Software Foundation, Inc., 59
00024   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00025 
00026   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00027   Mountain View, CA 94043, or:
00028 
00029   http://www.sgi.com
00030 
00031   For further information regarding this notice, see:
00032 
00033   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00034 
00035 */
00036 
00037 
00038 /* floorl is floor for long double arguments. */
00039 
00040 #if __STDC__
00041 
00042 #include "synonyms.h"
00043 #include <math.h>
00044 #include <fp.h>
00045 #include <errno.h>
00046 
00047 extern long double DINT();
00048 
00049 long double
00050 floorl(x)
00051 long double x;
00052 {
00053         long double l;
00054         long double f;
00055 
00056 #if defined(_CRAYIEEE)
00057         if (isnan(x)) {
00058                 errno = EDOM;
00059                 return(__NANL);
00060         }
00061 #endif
00062         /* Determine the fraction part and subtract it from original value. */
00063         l = DINT(&x);
00064         f = x - l;
00065         x = x - f;
00066         return ( (f < 0) ? x - 1.0 : x );
00067 }
00068 
00069 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines