grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / mathieeesingbas / ieeespcmp.c
blobe0594cc9a2c798ab1dc8b6f2c563aa0adcb7cd8a
1 /*
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "mathieeesingbas_intern.h"
8 /*****************************************************************************
10 NAME */
12 AROS_LH2(LONG, IEEESPCmp,
14 /* SYNOPSIS */
15 AROS_LHA(LONG, y, D0),
16 AROS_LHA(LONG, z, D1),
18 /* LOCATION */
19 struct LibHeader *, MathIeeeSingBasBase, 7, Mathieeesingbas)
21 /* FUNCTION
22 Compares two ieeesp numbers
24 INPUTS
26 RESULT
27 +1 : y > z
28 0 : y = z
29 -1 : y < z
31 Flags:
32 zero : y = z
33 negative : y < z
34 overflow : 0
36 BUGS
38 INTERNALS
40 *****************************************************************************/
42 AROS_LIBFUNC_INIT
44 if (y == z)
46 SetSR(Zero_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
47 return 0;
50 if (y < 0 && z < 0)
52 if (-y > -z)
54 SetSR(0, Zero_Bit | Negative_Bit | Overflow_Bit);
55 return 1;
57 else
59 SetSR(Negative_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
60 return -1;
64 if ((LONG)y < (LONG)z)
66 SetSR(Negative_Bit, Zero_Bit | Negative_Bit | Overflow_Bit);
67 return -1;
69 else
71 SetSR(0, Zero_Bit | Negative_Bit | Overflow_Bit);
72 return 1;
75 AROS_LIBFUNC_EXIT