Title.mui: minor code cleanup
[AROS.git] / workbench / libs / mathieeedoubbas / ieeedptst.c
blobf4abde28a83e4a1336210f81f226ed96ffabe7a2
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathieeedoubbas_intern.h"
8 /*****************************************************************************
10 NAME */
12 AROS_LHQUAD1(LONG, IEEEDPTst,
14 /* SYNOPSIS */
15 AROS_LHAQUAD(double, y, D0, D1),
17 /* LOCATION */
18 struct MathIeeeDoubBasBase *, MathIeeeDoubBasBase, 8, MathIeeeDoubBas)
20 /* FUNCTION
21 Compare a IEEE double precision floting point number against zero.
23 INPUTS
25 RESULT
26 +1 : y > 0.0
27 0 : y = 0.0
28 -1 : y < 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 y == 0 : return 0
41 Otherwise : return 1
43 *****************************************************************************/
45 AROS_LIBFUNC_INIT
47 QUAD * Qy = (QUAD *)&y;
49 /* y is negative */
50 if (is_lessSC(*Qy, 0x0, 0x0) /* y < 0 */)
52 SetSR(Negative_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
53 return -1;
56 /* fnum1 is zero */
57 if (is_eqC(*Qy, 0x0, 0x0) /* y == 0 */)
59 SetSR(Zero_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
60 return 0;
63 /* fnum1 is positive */
64 SetSR(0, Zero_Bit | Overflow_Bit | Negative_Bit );
66 return 1;
68 AROS_LIBFUNC_EXIT