grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / mathieeedoubbas / ieeedpneg.c
blob28b69441420046bbd9f72b8269a4b83f4fee4949
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, IEEEDPNeg,
14 /* SYNOPSIS */
15 AROS_LHAQUAD(double, y, D0, D1),
17 /* LOCATION */
18 struct MathIeeeDoubBasBase *, MathIeeeDoubBasBase, 10, MathIeeeDoubBas)
20 /* FUNCTION
21 Switch the sign of the given IEEE double precision
22 floating point number
24 INPUTS
26 RESULT
29 Flags:
30 zero : result is zero
31 negative : result is negative
32 overflow : 0
34 BUGS
36 INTERNALS
37 ALGORITHM:
38 Flip the sign-bit (even for zeroes).
40 *****************************************************************************/
42 AROS_LIBFUNC_INIT
44 QUAD * Qy = (QUAD *)&y;
46 /* change the sign-bit */
47 XOR64QC(*Qy, IEEEDPSign_Mask_Hi, IEEEDPSign_Mask_Lo);
51 is_eqC(*Qy, 0x0, 0x0 )
52 || is_eqC(*Qy, IEEEDPSign_Mask_Hi, IEEEDPSign_Mask_Lo)
55 SetSR( Zero_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
56 return y;
59 /* if (y < 0) */
60 if(is_lessSC(*Qy, 0x0, 0x0) )
62 /* result is negative */
63 SetSR(Negative_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
65 else
67 /* result is positive */
68 SetSR(0, Zero_Bit | Overflow_Bit | Negative_Bit );
71 return y;
73 AROS_LIBFUNC_EXIT