Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / mathieeedoubbas / ieeedpceil.c
blobcb5c3d529ce58dead702a6c851cf954f91535416
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, IEEEDPCeil,
14 /* SYNOPSIS */
15 AROS_LHAQUAD(double, y, D0, D1),
17 /* LOCATION */
18 struct MathIeeeDoubBasBase *, MathIeeeDoubBasBase, 16, MathIeeeDoubBas)
20 /* FUNCTION
21 Calculates the ceil-value of a IEEE double precision number
23 INPUTS
25 RESULT
26 Flags:
27 zero : result is zero
28 negative : result is negative
29 overflow : 0
31 BUGS
33 SEE ALSO
34 IEEEDPFloor()
36 INTERNALS
37 ALGORITHM:
38 Ceil(y) = - Floor(-y)
40 *****************************************************************************/
42 AROS_LIBFUNC_INIT
44 QUAD * Qy = (QUAD *)&y;
46 if (is_eqC((*Qy),0,0))
48 SetSR(Zero_Bit, Negative_Bit|Overflow_Bit|Zero_Bit);
49 return y;
52 XOR64QC((*Qy), IEEEDPSign_Mask_Hi, IEEEDPSign_Mask_Lo);
53 /* Ceil(y) = -Floor(-y); */
54 y = IEEEDPFloor(y);
55 if (is_eqC((*Qy), 0x0, 0x0))
57 Set_Value64C((*Qy), 0, 0);
58 return y;
60 else
62 XOR64QC((*Qy), IEEEDPSign_Mask_Hi, IEEEDPSign_Mask_Lo );
63 return y;
66 AROS_LIBFUNC_EXIT