Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / mathtrans / sptieee.c
blobe4a9d17df3ae01da12af176da690606f54e62133
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathtrans_intern.h"
8 /*
9 FUNCTION
10 Convert FFP number to single precision ieee number
12 RESULT
13 IEEE Single Precision Floating Point
15 flags:
16 zero : result is zero
17 negative : result is negative
18 overflow : exponent of the ieee-number was out of range for ffp
20 NOTES
22 EXAMPLE
24 BUGS
26 SEE ALSO
28 INTERNALS
30 HISTORY
33 AROS_LH1(float, SPTieee,
34 AROS_LHA(float, fnum, D0),
35 struct Library *, MathTransBase, 17, MathTrans
38 AROS_LIBFUNC_INIT
40 LONG Res;
41 LONG Exponent;
42 if (0 == fnum)
44 SetSR(Zero_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
45 return 0;
48 Exponent = (fnum & FFPExponent_Mask) - 0x40 + 126;
50 Res = ( Exponent << (30-7) );
51 Res |= (((ULONG)fnum & 0x7fffff00) >> 8);
53 if ((char) fnum < 0)
55 SetSR(Negative_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
56 Res |= IEEESPSign_Mask;
59 return Res;
61 AROS_LIBFUNC_EXIT