Updated to V6.5 (SVN rev. 92)
[cake.git] / rom / mathieeesingbas / ieeespneg.c
blob4c85dde841c1b94efb988da3f69f8fae0a3deca2
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathieeesingbas_intern.h"
8 /*
9 FUNCTION
10 Switch the sign of the given ieeesp number
12 RESULT
15 Flags:
16 zero : result is zero
17 negative : result is negative
18 overflow : 0
20 NOTES
22 EXAMPLE
24 BUGS
26 SEE ALSO
29 INTERNALS
30 ALGORITHM:
31 Return -0 if y == 0.
32 Otherwise flip the sign-bit.
34 HISTORY
37 AROS_LH1(float, IEEESPNeg,
38 AROS_LHA(float, y, D0),
39 struct LibHeader *, MathIeeeSingBasBase, 10, Mathieeesingbas
42 AROS_LIBFUNC_INIT
44 if (0 == y || 0x80000000 == y)
46 SetSR( Zero_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
47 return (IEEESPSign_Mask ^ y);
50 /* flip sign-bit */
51 y ^= IEEESPSign_Mask;
53 if(y < 0)
55 /* result is negative */
56 SetSR(Negative_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
58 else
60 /* result is positive */
61 SetSR(0, Zero_Bit | Overflow_Bit | Negative_Bit );
64 return y;
66 AROS_LIBFUNC_EXIT