2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
6 #include "mathieeesingbas_intern.h"
8 /*****************************************************************************
12 AROS_LH1(float, IEEESPFloor
,
15 AROS_LHA(float, y
, D0
),
18 struct LibHeader
*, MathIeeeSingBasBase
, 15, Mathieeesingbas
)
21 Calculate the largest integer ieeesp-number
22 less than or equal to fnum
27 IEEE single precision floating point
31 negative : result is negative
35 IEEESPFloor(10.5) = 10
37 IEEESPFloor(-0.5) = -1
38 IEEESPFloor(-10.5)= -11
46 *****************************************************************************/
50 LONG Mask
= 0x80000000;
52 if (0x7f880000 == y
) return y
;
54 if ((y
& IEEESPExponent_Mask
) < 0x3f800000)
56 if (y
< 0) /* negative sign? */
58 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
59 return 0xbf800000; /* -1 */
63 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
69 Mask
>>= ((y
& IEEESPExponent_Mask
) >> 23) - 0x77;
74 /* is there anything behind the decimal dot? */
75 if (0 != (y
& (~Mask
)) )
77 y
= IEEESPAdd(y
, 0xbf800000 ); /* fnum = fnum -1; */
79 Mask
>>= ((y
& IEEESPExponent_Mask
) >> 23) - 0x77;
83 if(y
< 0) SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);