gedf2.c revision 169690
1115479Sphk/* Software floating-point emulation.
2115479Sphk   Return 0 iff a == b, 1 iff a > b, -2 iff a ? b, -1 iff a < b
3278717Sngie   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
4278717Sngie   This file is part of the GNU C Library.
5166556Smarcel   Contributed by Richard Henderson (rth@cygnus.com) and
6115479Sphk		  Jakub Jelinek (jj@ultra.linux.cz).
7163048Sru
8126172Spjd   The GNU C Library is free software; you can redistribute it and/or
9148457Spjd   modify it under the terms of the GNU Lesser General Public
10116518Sphk   License as published by the Free Software Foundation; either
11128891Spjd   version 2.1 of the License, or (at your option) any later version.
12163851Spjd
13131476Spjd   In addition to the permissions in the GNU Lesser General Public
14176421Sthompsa   License, the Free Software Foundation gives you unlimited
15115479Sphk   permission to link the compiled version of this file into
16132905Spjd   combinations with other programs, and to distribute those
17202437Strasz   combinations without any restriction coming from the use of this
18167050Smjacob   file.  (The Lesser General Public License restrictions do apply in
19129477Spjd   other respects; for example, they cover modification of the file,
20176724Smarcel   and distribution when not linked into a combine executable.)
21115479Sphk
22219974Smav   The GNU C Library is distributed in the hope that it will be useful,
23133812Spjd   but WITHOUT ANY WARRANTY; without even the implied warranty of
24206497Sluigi   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25140075Spjd   Lesser General Public License for more details.
26129477Spjd
27115783Sgordon   You should have received a copy of the GNU Lesser General Public
28266220Sloos   License along with the GNU C Library; if not, write to the Free
29133640Sfjoe   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
30133270Sle   MA 02110-1301, USA.  */
31173006Spjd
32148384Spjd#include "soft-fp.h"
33148384Spjd#include "double.h"
34115479Sphk
35278717Sngieint __gedf2(DFtype a, DFtype b)
36278717Sngie{
37278717Sngie  FP_DECL_EX;
38278717Sngie  FP_DECL_D(A); FP_DECL_D(B);
39115479Sphk  int r;
40
41  FP_UNPACK_RAW_D(A, a);
42  FP_UNPACK_RAW_D(B, b);
43  FP_CMP_D(r, A, B, -2);
44  if (r == -2 && (FP_ISSIGNAN_D(A) || FP_ISSIGNAN_D(B)))
45    FP_SET_EXCEPTION(FP_EX_INVALID);
46  FP_HANDLE_EXCEPTIONS;
47
48  return r;
49}
50
51strong_alias(__gedf2, __gtdf2);
52