* 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.
This commit is contained in:
		| @@ -144,12 +144,6 @@ double	log (double); | |||||||
| double	log10 (double); | double	log10 (double); | ||||||
| double	pow (double, double); | double	pow (double, double); | ||||||
| double	sqrt (double); | double	sqrt (double); | ||||||
| extern __inline__  double sqrt (double x) |  | ||||||
| { |  | ||||||
|   double res; |  | ||||||
|   __asm__ ("fsqrt;" : "=t" (res) : "0" (x)); |  | ||||||
|   return res; |  | ||||||
| } |  | ||||||
| double	ceil (double); | double	ceil (double); | ||||||
| double	floor (double); | double	floor (double); | ||||||
| double	fabs (double); | double	fabs (double); | ||||||
| @@ -504,19 +498,8 @@ extern __inline__ float powf (float x, float y) | |||||||
| extern long double powl (long double, long double); | extern long double powl (long double, long double); | ||||||
|  |  | ||||||
| /* 7.12.7.5 The sqrt functions. Double in C89. */ | /* 7.12.7.5 The sqrt functions. Double in C89. */ | ||||||
| extern __inline__ float sqrtf (float x) | extern float sqrtf (float); | ||||||
| { | extern long double sqrtl (long double); | ||||||
|   float res; |  | ||||||
|   __asm__ ("fsqrt" : "=t" (res) : "0" (x)); |  | ||||||
|   return res; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| extern __inline__ long double sqrtl (long double x) |  | ||||||
| { |  | ||||||
|   long double res; |  | ||||||
|   __asm__ ("fsqrt" : "=t" (res) : "0" (x)); |  | ||||||
|   return res; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| /* 7.12.8 Error and gamma functions: TODO */ | /* 7.12.8 Error and gamma functions: TODO */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,9 +1,20 @@ | |||||||
| #include <math.h> | #include <math.h> | ||||||
|  | #include <errno.h> | ||||||
|  |  | ||||||
|  | extern float  __QNANF; | ||||||
|  |  | ||||||
| float | float | ||||||
| sqrtf (float x) | sqrtf (float x) | ||||||
| { | { | ||||||
|   float res; |   if (x < 0.0F ) | ||||||
|   asm ("fsqrt" : "=t" (res) : "0" (x)); |     { | ||||||
|   return res; |       errno = EDOM; | ||||||
|  |       return __QNANF; | ||||||
|  |     } | ||||||
|  |   else | ||||||
|  |     { | ||||||
|  |       float res; | ||||||
|  |       asm ("fsqrt" : "=t" (res) : "0" (x)); | ||||||
|  |       return res; | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,8 +1,20 @@ | |||||||
| #include <math.h> | #include <math.h> | ||||||
|  | #include <errno.h> | ||||||
|  |  | ||||||
|  | extern long double  __QNANL; | ||||||
|  |  | ||||||
| long double | long double | ||||||
| sqrtl (long double x) | sqrtl (long double x) | ||||||
| { | { | ||||||
|   long double res; |   if (x < 0.0L ) | ||||||
|   asm ("fsqrt" : "=t" (res) : "0" (x)); |     { | ||||||
|   return res; |       errno = EDOM; | ||||||
|  |       return __QNANL; | ||||||
|  |     } | ||||||
|  |   else | ||||||
|  |     { | ||||||
|  |       long double res; | ||||||
|  |       asm ("fsqrt" : "=t" (res) : "0" (x)); | ||||||
|  |       return res; | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user