Improved AutoDocs.
[AROS.git] / workbench / libs / mathieeedoubbas / ieeedptst.c
blob66a19c2ea13b14701119a7a94953ac9b5f250d66
1 /*
2 Copyright © 1995-2017, 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 Compares an IEEE double precision floting point number against zero.
23 INPUTS
24 y - IEEE double precision floating point number.
26 RESULT
27 c -
28 +1: y > 0.0
29 0: y = 0.0
30 -1: y < 0.0
32 Flags:
33 zero : result is zero
34 negative : result is negative
35 overflow : 0
37 NOTES
39 EXAMPLE
41 BUGS
43 SEE ALSO
44 IEEEDPCmp()
46 INTERNALS
47 Algorithm:
48 Sign is negative: return -1
49 y == 0 : return 0
50 Otherwise : return 1
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 QUAD * Qy = (QUAD *)&y;
58 /* y is negative */
59 if (is_lessSC(*Qy, 0x0, 0x0) /* y < 0 */)
61 SetSR(Negative_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
62 return -1;
65 /* fnum1 is zero */
66 if (is_eqC(*Qy, 0x0, 0x0) /* y == 0 */)
68 SetSR(Zero_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
69 return 0;
72 /* fnum1 is positive */
73 SetSR(0, Zero_Bit | Overflow_Bit | Negative_Bit );
75 return 1;
77 AROS_LIBFUNC_EXIT