2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
6 #include "mathieeedoubbas_intern.h"
8 /*****************************************************************************
12 AROS_LH1(double, IEEEDPFlt
,
15 AROS_LHA(LONG
, y
, D0
),
18 struct MathIeeeDoubBasBase
*, MathIeeeDoubBasBase
, 6, MathIeeeDoubBas
)
21 Convert an integer into an IEEE double precision floating point
28 x - IEEE double precision floating point number.
32 negative : result is negative
46 *****************************************************************************/
51 LONG TestMask
= 0xFFFFFFFF;
52 QUAD Res
, yQuad
, ExponentQuad
;
53 double * DRes
= (double *)&Res
;
55 Set_Value64C(Res
,0,0);
59 SetSR(Zero_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);
60 return *DRes
; /* return 0 */
65 Set_Value64C(Res
, IEEEDPSign_Mask_Hi
, IEEEDPSign_Mask_Lo
);
68 /* find out which is the number of the highest set bit */
75 SHL32(yQuad
, y
, (53 - Exponent
) );
77 AND64QC(yQuad
, IEEEDPMantisse_Mask_Hi
, IEEEDPMantisse_Mask_Lo
);
81 /* adapt Exponent to IEEEDP-Format */
82 SHL32(ExponentQuad
, Exponent
, 52);
84 OR64Q(Res
, ExponentQuad
);
85 if ( is_lessSC(Res
,0,0) ) /* Res < 0 */
87 SetSR(Negative_Bit
, Zero_Bit
| Negative_Bit
| Overflow_Bit
);