diff options
Diffstat (limited to 'libc/math/math_private.h')
-rw-r--r-- | libc/math/math_private.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/libc/math/math_private.h b/libc/math/math_private.h index e5ca61f0b..4cb81ea41 100644 --- a/libc/math/math_private.h +++ b/libc/math/math_private.h @@ -202,6 +202,7 @@ extern double __ieee754_scalb (double,double); /* fdlibm kernel function */ extern double __kernel_standard (double,double,int); +extern float __kernel_standard_f (float,float,int); extern double __kernel_sin (double,double,int); extern double __kernel_cos (double,double); extern double __kernel_tan (double,double,int); @@ -357,4 +358,48 @@ extern void __docos (double __x, double __dx, double __v[]); #define math_force_eval(x) __asm __volatile ("" : : "m" (x)) #endif + +/* The standards only specify one variant of the fenv.h interfaces. + But at least for some architectures we can be more efficient if we + know what operations are going to be performed. Therefore we + define additional interfaces. By default they refer to the normal + interfaces. */ +#define libc_fegetround() fegetround () +#define libc_fegetroundf() fegetround () +#define libc_fegetroundl() fegetround () + +#define libc_fesetround(r) (void) fesetround (r) +#define libc_fesetroundf(r) (void) fesetround (r) +#define libc_fesetroundl(r) (void) fesetround (r) + +#define libc_feholdexcept(e) (void) feholdexcept (e) +#define libc_feholdexceptf(e) (void) feholdexcept (e) +#define libc_feholdexceptl(e) (void) feholdexcept (e) + +#define libc_feholdexcept_setround(e, r) \ + do { feholdexcept (e); fesetround (r); } while (0) +#define libc_feholdexcept_setroundf(e, r) \ + do { feholdexcept (e); fesetround (r); } while (0) +#define libc_feholdexcept_setroundl(e, r) \ + do { feholdexcept (e); fesetround (r); } while (0) + +#define libc_fetestexcept(e) fetestexcept (e) +#define libc_fetestexceptf(e) fetestexcept (e) +#define libc_fetestexceptl(e) fetestexcept (e) + +#define libc_fesetenv(e) (void) fesetenv (e) +#define libc_fesetenvf(e) (void) fesetenv (e) +#define libc_fesetenvl(e) (void) fesetenv (e) + +#define libc_feupdateenv(e) (void) feupdateenv (e) +#define libc_feupdateenvf(e) (void) feupdateenv (e) +#define libc_feupdateenvl(e) (void) feupdateenv (e) + +#define __nan(str) \ + (__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str)) +#define __nanf(str) \ + (__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str)) +#define __nanl(str) \ + (__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str)) + #endif /* _MATH_PRIVATE_H_ */ |