grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / mathieeedoubtrans / ieeedpfieee.c
blob7b136c21d86250e5e50b729176650b9aba3ac465
1 /*
2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathieeedoubtrans_intern.h"
8 /*****************************************************************************
10 NAME */
12 AROS_LH1(double, IEEEDPFieee,
14 /* SYNOPSIS */
15 AROS_LHA(LONG, y, D0),
17 /* LOCATION */
18 struct MathIeeeDoubTransBase *, MathIeeeDoubTransBase, 18, MathIeeeDoubTrans)
20 /* FUNCTION
21 Convert IEEE single to IEEE double precision
23 INPUTS
25 RESULT
26 IEEE double precision floting point number
28 Flags:
29 zero : result is zero
30 negative : result is negative
31 overflow : 0
33 BUGS
35 INTERNALS
37 *****************************************************************************/
39 AROS_LIBFUNC_INIT
41 LONG tmpL = y & IEEESPExponent_Mask; /* get the Exponent */
42 QUAD Res, tmpQ;
44 SetSR( 0, Zero_Bit | Overflow_Bit | Negative_Bit);
46 if (0 == y)
48 SetSR( Zero_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
49 Set_Value64C(Res, 0x0, 0x0);
50 return Res;
53 tmpL >>= 23;
54 tmpL = tmpL - 0x7e + 0x3fe;
56 /* set the Exponent */
57 SHL32(Res, tmpL, 52);
59 /* set the Mantisse */
60 tmpL = y & IEEESPMantisse_Mask;
61 SHL32(tmpQ, tmpL, 29);
62 OR64Q(Res, tmpQ);
64 if (y < 0)
66 OR64QC(Res, IEEEDPSign_Mask_Hi, IEEEDPSign_Mask_Lo);
67 SetSR( Negative_Bit, Zero_Bit | Overflow_Bit | Negative_Bit);
70 return Res;
72 AROS_LIBFUNC_EXIT