Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / mathieeedoubbas / ieeedpabs.c
blobfbdc6c22b7b1a1f1c29a5dc203fc86ad7b9223d0
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(double, IEEEDPAbs,
14 /* SYNOPSIS */
15 AROS_LHAQUAD(double, y, D0, D1),
17 /* LOCATION */
18 struct MathIeeeDoubBasBase *, MathIeeeDoubBasBase, 9, MathIeeeDoubBas)
20 /* FUNCTION
21 Calculate the absolute value of the given IEEE double precision
22 floating point number
24 INPUTS
26 RESULT
27 absolute value of y
29 Flags:
30 zero : result is zero
31 negative : 0
32 overflow : 0
34 BUGS
36 INTERNALS
37 ALGORITHM:
38 set the sign-bit to zero
40 *****************************************************************************/
42 AROS_LIBFUNC_INIT
44 QUAD * Qy = (QUAD *)&y;
46 /*if (0 == (*Qy)) */
47 if (is_eqC((*Qy),0,0))
49 /* value is 0 -> set the Zero Flag */
50 SetSR( Zero_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
52 else
54 /* set the sign-bit to zero */
55 /* (*Qy) &= (IEEEDPMantisse_Mask | IEEEDPExponent_Mask) */
56 AND64QC
58 (*Qy),
59 (IEEEDPMantisse_Mask_Hi | IEEEDPExponent_Mask_Hi),
60 (IEEEDPMantisse_Mask_Lo | IEEEDPExponent_Mask_Lo)
62 SetSR(0, Zero_Bit | Overflow_Bit | Negative_Bit );
65 return y;
67 AROS_LIBFUNC_EXIT