]> pd.if.org Git - pdclib/blob - functions/math/floor.c
Merged PDPCLIB and Therx code.
[pdclib] / functions / math / floor.c
1 // ----------------------------------------------------------------------------
2 // $Id$
3 // ----------------------------------------------------------------------------
4 // Public Domain C Library - http://pdclib.sourceforge.net
5 // This code is Public Domain. Use, modify, and redistribute at will.
6 // ----------------------------------------------------------------------------
7
8 // ----------------------------------------------------------------------------
9 // C++
10
11 float floor( float x ) { /* TODO */ };
12 long double floor( long double x ) { /* TODO */ };
13
14 // ----------------------------------------------------------------------------
15 // Standard C
16
17 double floor( double x ) { /* TODO */ };
18
19 /* Therx code
20 {
21     return ( x > 0 ) ? (int) x : (int) ( x - 0.9999999999999999 );
22 }
23 */
24
25 /* PDPC code - unreviewed
26 {
27     int y;
28     
29     if (x < 0.0)
30     {
31         y = (int)fabs(x);
32         if ((double)y != x)
33         {
34             y--;
35         }
36     }
37     else
38     {
39         y = (int)x;
40     }
41     return ((double)x);
42 }
43 */
44
45 float floorf( float x ) { /* TODO */ };
46 long double floorl( long double x ) { /* TODO */ };