revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / mathieeedoubbas / ieeedpceil.c
blobad1c88ad8436674977ee98ee2891fad653bc9ade
1 /*
2 Copyright © 1995-2017, 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 ceiling value of an IEEE double precision number.
23 INPUTS
24 y - IEEE double precision floating point number.
26 RESULT
27 x - ceiling of y.
29 Flags:
30 zero : result is zero
31 negative : result is negative
32 overflow : 0
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
41 IEEEDPFloor(), IEEEDPFix()
43 INTERNALS
44 Algorithm:
45 Ceil(y) = - Floor(-y)
47 *****************************************************************************/
49 AROS_LIBFUNC_INIT
51 QUAD * Qy = (QUAD *)&y;
53 if (is_eqC((*Qy),0,0))
55 SetSR(Zero_Bit, Negative_Bit|Overflow_Bit|Zero_Bit);
56 return y;
59 XOR64QC((*Qy), IEEEDPSign_Mask_Hi, IEEEDPSign_Mask_Lo);
60 /* Ceil(y) = -Floor(-y); */
61 y = IEEEDPFloor(y);
62 if (is_eqC((*Qy), 0x0, 0x0))
64 Set_Value64C((*Qy), 0, 0);
65 return y;
67 else
69 XOR64QC((*Qy), IEEEDPSign_Mask_Hi, IEEEDPSign_Mask_Lo );
70 return y;
73 AROS_LIBFUNC_EXIT