Added AROS port of all shell applications:
[cake.git] / rom / mathffp / sptst.c
blob169fc48adc89637505a30ad25c01c6c5cee4d199
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathffp_intern.h"
8 /*
9 FUNCTION
10 Compare a ffp-number against zero.
12 RESULT
13 <code>
14 +1 : fnum > 0.0
15 0 : fnum = 0.0
16 -1 : fnum < 0.0
18 Flags:
19 zero : result is zero
20 negative : result is negative
21 overflow : 0
22 </code>
24 NOTES
26 EXAMPLE
28 BUGS
30 SEE ALSO
33 INTERNALS
34 ALGORITHM:
35 Sign is negative: return -1
36 fnum == 0 : return 0
37 Otherwise : return 1
39 HISTORY
42 AROS_LH1(LONG, SPTst,
43 AROS_LHA(float, fnum, D1),
44 struct LibHeader *, MathBase, 8, Mathffp
47 AROS_LIBFUNC_INIT
48 /* fnum1 is negative */
49 if ((char) fnum < 0)
51 SetSR(Negative_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
52 return -1;
55 /* fnum1 is zero */
56 if (0 == fnum)
58 SetSR(Zero_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
59 return 0;
62 /* fnum1 is positive */
63 SetSR(0, Zero_Bit | Overflow_Bit | Negative_Bit );
65 return 1;
67 AROS_LIBFUNC_EXIT