grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / mathffp / sptst.c
blob342ac03c9947700f429fe6d2d375811d0e63291b
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathffp_intern.h"
8 /*****************************************************************************
10 NAME */
12 AROS_LH1(LONG, SPTst,
14 /* SYNOPSIS */
15 AROS_LHA(float, fnum, D1),
17 /* LOCATION */
18 struct LibHeader *, MathBase, 8, Mathffp)
20 /* FUNCTION
21 Compare a ffp-number against zero.
23 INPUTS
25 RESULT
26 +1 : fnum > 0.0
27 0 : fnum = 0.0
28 -1 : fnum < 0.0
30 Flags:
31 zero : result is zero
32 negative : result is negative
33 overflow : 0
35 BUGS
37 INTERNALS
38 ALGORITHM:
39 Sign is negative: return -1
40 fnum == 0 : return 0
41 Otherwise : return 1
43 *****************************************************************************/
45 AROS_LIBFUNC_INIT
47 D(kprintf("SPTst(%08x)\n", fnum));
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