Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / mathieeedoubbas / ieeedpceil.c
blob55e00c2d1d5406bb5e360de512bcdcbff84efbfb
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathieeedoubbas_intern.h"
8 /*
9 FUNCTION
10 Calculates the ceil-value of a IEEE double precision number
12 RESULT
13 Flags:
14 zero : result is zero
15 negative : result is negative
16 overflow : 0
18 NOTES
20 EXAMPLE
22 BUGS
24 SEE ALSO
25 IEEEDPFloor()
27 INTERNALS
28 ALGORITHM:
29 Ceil(y) = - Floor(-y)
31 HISTORY
34 AROS_LHQUAD1(double, IEEEDPCeil,
35 AROS_LHAQUAD(double, y, D0, D1),
36 struct MathIeeeDoubBasBase *, MathIeeeDoubBasBase, 16, MathIeeeDoubBas
39 AROS_LIBFUNC_INIT
41 QUAD * Qy = (QUAD *)&y;
43 if (is_eqC((*Qy),0,0))
45 SetSR(Zero_Bit, Negative_Bit|Overflow_Bit|Zero_Bit);
46 return y;
49 XOR64QC((*Qy), IEEEDPSign_Mask_Hi, IEEEDPSign_Mask_Lo);
50 /* Ceil(y) = -Floor(-y); */
51 y = IEEEDPFloor(y);
52 if (is_eqC((*Qy), 0x0, 0x0))
54 Set_Value64C((*Qy), 0, 0);
55 return y;
57 else
59 XOR64QC((*Qy), IEEEDPSign_Mask_Hi, IEEEDPSign_Mask_Lo );
60 return y;
63 AROS_LIBFUNC_EXIT