projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename iconv_.h to iconv.in.h.
[gnulib.git]
/
lib
/
sqrtl.c
diff --git
a/lib/sqrtl.c
b/lib/sqrtl.c
index
e8e2b32
..
bf1b2d5
100644
(file)
--- a/
lib/sqrtl.c
+++ b/
lib/sqrtl.c
@@
-1,7
+1,7
@@
/* Emulation for sqrtl.
Contributed by Paolo Bonzini
/* Emulation for sqrtl.
Contributed by Paolo Bonzini
- Copyright 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2002, 2003
, 2007
Free Software Foundation, Inc.
This file is part of gnulib.
This file is part of gnulib.
@@
-17,12
+17,15
@@
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation,
- Inc., 5
9 Temple Place - Suite 330, Boston, MA 02111-1307
, USA. */
+ Inc., 5
1 Franklin Street, Fifth Floor, Boston, MA 02110-1301
, USA. */
-#include <float.h>
+#include <config.h>
+
+/* Specification. */
#include <math.h>
#include <math.h>
-#include "mathl.h"
+#include <float.h>
+#include "isnanl.h"
/* A simple Newton-Raphson method. */
long double
/* A simple Newton-Raphson method. */
long double
@@
-31,12
+34,16
@@
sqrtl(long double x)
long double delta, y;
int exponent;
long double delta, y;
int exponent;
+ /* Check for NaN */
+ if (isnanl (x))
+ return x;
+
/* Check for negative numbers */
if (x < 0.0L)
return (long double) sqrt(-1);
/* Check for negative numbers */
if (x < 0.0L)
return (long double) sqrt(-1);
- /* Check for zero
, NANs
and infinites */
- if (x + x == x
|| x != x
)
+ /* Check for zero and infinites */
+ if (x + x == x)
return x;
frexpl (x, &exponent);
return x;
frexpl (x, &exponent);