diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2002-11-09 10:44:02 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2002-11-09 10:44:02 +0000 |
commit | 9da547ff2644ebcb2ef964ef278072deff6ea84d (patch) | |
tree | fb1b66a24870db4491f587fd3bc286af63d0c688 /winsup/mingw/mingwex | |
parent | 49f7ea16756dd7f341edeecd2dee45083ab38945 (diff) | |
download | cygnal-9da547ff2644ebcb2ef964ef278072deff6ea84d.tar.gz cygnal-9da547ff2644ebcb2ef964ef278072deff6ea84d.tar.bz2 cygnal-9da547ff2644ebcb2ef964ef278072deff6ea84d.zip |
* include/math.h (sqrt): Remove inline definition.
(sqrtf): Replace inline definition with prototype.
(sqrtl): Likewise.
* mingwex/math/sqrtf.c (sqrtf): Set domain error if
argument less than zero.
* mingwex/math/sqrtf.c (sqrtl): Likewise.
Correct typo in 2002-10-30 ChangeLog entry.
Diffstat (limited to 'winsup/mingw/mingwex')
-rw-r--r-- | winsup/mingw/mingwex/math/sqrtf.c | 17 | ||||
-rw-r--r-- | winsup/mingw/mingwex/math/sqrtl.c | 18 |
2 files changed, 29 insertions, 6 deletions
diff --git a/winsup/mingw/mingwex/math/sqrtf.c b/winsup/mingw/mingwex/math/sqrtf.c index 55ca39dbe..b1029cad8 100644 --- a/winsup/mingw/mingwex/math/sqrtf.c +++ b/winsup/mingw/mingwex/math/sqrtf.c @@ -1,9 +1,20 @@ #include <math.h> +#include <errno.h> + +extern float __QNANF; float sqrtf (float x) { - float res; - asm ("fsqrt" : "=t" (res) : "0" (x)); - return res; + if (x < 0.0F ) + { + errno = EDOM; + return __QNANF; + } + else + { + float res; + asm ("fsqrt" : "=t" (res) : "0" (x)); + return res; + } } diff --git a/winsup/mingw/mingwex/math/sqrtl.c b/winsup/mingw/mingwex/math/sqrtl.c index 0bd301390..dba68d878 100644 --- a/winsup/mingw/mingwex/math/sqrtl.c +++ b/winsup/mingw/mingwex/math/sqrtl.c @@ -1,8 +1,20 @@ #include <math.h> +#include <errno.h> + +extern long double __QNANL; + long double sqrtl (long double x) { - long double res; - asm ("fsqrt" : "=t" (res) : "0" (x)); - return res; + if (x < 0.0L ) + { + errno = EDOM; + return __QNANL; + } + else + { + long double res; + asm ("fsqrt" : "=t" (res) : "0" (x)); + return res; + } } |