2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
6 #include "mathieeesingbas_intern.h"
8 /*****************************************************************************
12 AROS_LH1(float, IEEESPFlt
,
15 AROS_LHA(LONG
, y
, D0
),
18 struct LibHeader
*, MathIeeeSingBasBase
, 6, Mathieeesingbas
)
27 negative : result is negative
28 overflow : IEEE single precision number is not exactly the integer
34 *****************************************************************************/
39 LONG TestMask
= 0xFFFFFFFF;
44 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
50 Res
= IEEESPSign_Mask
;
53 /* find out which is the number of the highest set bit */
60 if (Exponent
>= 26) y
>>= (Exponent
- 25) & IEEESPMantisse_Mask
;
61 else y
<<= (25 - Exponent
) & IEEESPMantisse_Mask
;
63 if ((char) (y
& 1) != 0)
66 if (0x02000000 == y
) Exponent
++;
70 y
&= IEEESPMantisse_Mask
;
74 /* adapt Exponent to IEEESP-Format */
78 if (Res
< 0) SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
80 /* The resulting IEEESP is lacking precision */
81 if (Exponent
> 0x4c800000)
83 SetSR(Overflow_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);