Fixed binary search: no more infinite loops when vendor is unknown.
[tangerine.git] / workbench / libs / mathieeedoubbas / ieeedpabs.c
blob62fa91ca1e13183e27274fbc79fd2b10edbc81e7
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathieeedoubbas_intern.h"
8 /*
9 FUNCTION
10 Calculate the absolute value of the given IEEE double precision
11 floating point number
13 RESULT
14 absolute value of y
16 Flags:
17 zero : result is zero
18 negative : 0
19 overflow : 0
21 NOTES
23 EXAMPLE
25 BUGS
27 SEE ALSO
29 INTERNALS
30 ALGORITHM:
31 set the sign-bit to zero
33 HISTORY
36 AROS_LHQUAD1(double, IEEEDPAbs,
37 AROS_LHAQUAD(double, y, D0, D1),
38 struct MathIeeeDoubBasBase *, MathIeeeDoubBasBase, 9, MathIeeeDoubBas
41 AROS_LIBFUNC_INIT
43 QUAD * Qy = (QUAD *)&y;
45 /*if (0 == (*Qy)) */
46 if (is_eqC((*Qy),0,0))
48 /* value is 0 -> set the Zero Flag */
49 SetSR( Zero_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
51 else
53 /* set the sign-bit to zero */
54 /* (*Qy) &= (IEEEDPMantisse_Mask | IEEEDPExponent_Mask) */
55 AND64QC
57 (*Qy),
58 (IEEEDPMantisse_Mask_Hi | IEEEDPExponent_Mask_Hi),
59 (IEEEDPMantisse_Mask_Lo | IEEEDPExponent_Mask_Lo)
61 SetSR(0, Zero_Bit | Overflow_Bit | Negative_Bit );
64 return y;
66 AROS_LIBFUNC_EXIT