summaryrefslogtreecommitdiff
path: root/sysdeps/m68k/fpu/__math.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-04-02 14:47:34 +0000
committerUlrich Drepper <drepper@redhat.com>1997-04-02 14:47:34 +0000
commit22d57dd3690a0fe623de1a56036306a93fa9a945 (patch)
tree72d15a44833db599574dc62e78ea02e8d30567e3 /sysdeps/m68k/fpu/__math.h
parent5929563ff20245bbaa1b3ca2f4bfcee623ac6fb5 (diff)
Update.
1997-04-02 16:28 Ulrich Drepper <drepper@cygnus.com> * grp/fgetgrent.c: Don't use fixed buffer length. Allow dynamic adjustment if the underlying function say it is too small. * pwd/fgetpwent.c: Likewise. * shadow/fgetspent.c: Likewise. * shadow/sgetspent.c: Likewise. * grp/fgetgrent_r.c (__fgetgrent_r): If `parse_result' returns -1 this means there was not enough room for the gr_mem array. * nss/nss_files/files-XXX.c: Leave loop and return error if `parse_result' returns -1. * nss/nss_files/files-parse.c (parse_line): Return -1 if parsing of trailing list fails because of low memory. (parse_list): Rewrite. The logic was completly incorrect since the checks for overflowing the array were not executed when needed. * shadow/sgetspent_r.c: Only a return value > 0 from parse_line signals success. * nss/getXXbyYY.c: Make sure NULL is returned if we ran out of memory. * nss/getXXent.c: Likewise. * stdlib/strtod.c (SET_MANTISSA): Make sure that at least one bit is set in mantissa. * stdlib/strtof.c: Likewise. * stdlib/strtold.c: Likewise. * wcsmbs/wcstof.c: Likewise. * wcsmbs/wcstold.c: Likewise. * sysdeps/libm-ieee754/s_nan.c: Use strtod is parameter is not empty string. * sysdeps/libm-ieee754/s_nanf.c: Likewise. * sysdeps/libm-ieee754/s_nanld.c: Likewise. 1997-04-02 13:56 Ulrich Drepper <drepper@cygnus.com> * manual/errno.texi: Add description of strerror_r. 1997-04-01 19:07 H.J. Lu (hjl@gnu.ai.mit.edu) * manual/errno.texi: Add ENOMEDIUM and EMEDIUMTYPE. 1997-04-02 13:55 Ulrich Drepper <drepper@cygnus.com> * sysdeps/gnu/errlist.awk: The Texinfo file is named errno.texi. 1997-03-30 10:59 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/fpu/s_cexp.c: New file. * sysdeps/m68k/fpu/s_cexpf.c: New file. * sysdeps/m68k/fpu/s_cexpl.c: New file. * sysdeps/m68k/fpu/s_nearbyint.c: New file. * sysdeps/m68k/fpu/s_nearbyintf.c: New file. * sysdeps/m68k/fpu/s_nearbyintl.c: New file. * sysdeps/m68k/fpu/s_trunc.c: New file. * sysdeps/m68k/fpu/s_truncf.c: New file. * sysdeps/m68k/fpu/s_truncl.c: New file. * sysdeps/m68k/fpu/s_modf.c: Rewritten. * sysdeps/m68k/fpu/s_modff.c: Adapted. * sysdeps/m68k/fpu/s_modfl.c: Likewise. * sysdeps/m68k/fpu/e_atan2.c: Use __signbit inline. * sysdeps/m68k/fpu/e_pow.c: Likewise. Write 0.0/0.0 for NaN. Fix typo in test for `y = 0.5'. * sysdeps/m68k/fpu/__math.h: Define __trunc, __signbit, __nearbyint. Remove __modf. * sysdeps/m68k/Makefile (CFLAGS-s_copysignl.c) [$(subdir)=math]: Define for gcc bug workaround. * math/libm-test.c (log2_test): Add epsilon for long double to "log2 (e)" and "log2 (16)". (modf_test): Fix test name. (sqrt_test): Add missing FUNC. 1997-03-29 16:24 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sunrpc/Makefile (CFLAGS-xrquota.c): Fix typo in variable name. 1997-03-28 20:56 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * stdlib/stdlib.h: Declare __clearenv. 1997-03-28 18:03 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/libm-ieee754/s_asinhl.c: Fix Ulrich Dreppers mangling of the last change. 1997-03-28 17:55 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * configure.in: Call AC_CANONICAL_BUILD before referencing $build. Fix test for BUILD_CC. 1997-04-02 01:29 Philip Blundell <pjb27@cam.ac.uk> * sysdeps/libm-ieee754/s_log2f.c (__log2f): Fix typo. 1997-03-31 18:53 Philip Blundell <pjb27@cam.ac.uk> * sysdeps/unix/sysv/linux/net/route.h: Add new IPv6 definitions. 1997-04-01 14:08 Ulrich Drepper <drepper@cygnus.com> * sysdeps/i386/memset.c: Fix typo. * sysdeps/stub/fchmod.c: Fix typo. * sysdeps/stub/fchdir.c: Fix typo. Reported by Fila Kolodny <fila@ibi.com>.
Diffstat (limited to 'sysdeps/m68k/fpu/__math.h')
-rw-r--r--sysdeps/m68k/fpu/__math.h237
1 files changed, 128 insertions, 109 deletions
diff --git a/sysdeps/m68k/fpu/__math.h b/sysdeps/m68k/fpu/__math.h
index d6187015ea..9b52b32d0c 100644
--- a/sysdeps/m68k/fpu/__math.h
+++ b/sysdeps/m68k/fpu/__math.h
@@ -89,6 +89,7 @@ __inline_mathop(__significand, getman)
__inline_mathop(__log2, log2)
__inline_mathop(__exp2, twotox)
+__inline_mathop(__trunc, intrz)
#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
@@ -111,6 +112,7 @@ __inline_mathop(significand, getman)
#ifdef __USE_ISOC9X
__inline_mathop(log2, log2)
__inline_mathop(exp2, twotox)
+__inline_mathop(trunc, intrz)
#endif
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
@@ -155,108 +157,123 @@ __internal_inline_functions (long double,l)
/* The rest of the functions are available to the user. */
-#define __inline_functions(float_type, s) \
-__m81_inline float_type \
-__m81_u(__CONCAT(__frexp,s))(float_type __value, int *__expptr) \
-{ \
- float_type __mantissa, __exponent; \
- int __iexponent; \
- if (__value == 0.0) \
- { \
- *__expptr = 0; \
- return __value; \
- } \
- __asm("fgetexp%.x %1, %0" : "=f" (__exponent) : "f" (__value)); \
- __iexponent = (int) __exponent + 1; \
- *__expptr = __iexponent; \
- __asm("fscale%.l %2, %0" : "=f" (__mantissa) \
- : "0" (__value), "dmi" (-__iexponent)); \
- return __mantissa; \
-} \
- \
-__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \
-{ \
- float_type __result; \
- unsigned long int __ctrl_reg; \
- __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg)); \
- /* Set rounding towards negative infinity. */ \
- __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
- : "dmi" ((__ctrl_reg & ~0x10) | 0x20)); \
- /* Convert X to an integer, using -Inf rounding. */ \
- __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x)); \
- /* Restore the previous rounding mode. */ \
- __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
- : "dmi" (__ctrl_reg)); \
- return __result; \
-} \
- \
-__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) \
-{ \
- float_type __result; \
- unsigned long int __ctrl_reg; \
- __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg)); \
- /* Set rounding towards positive infinity. */ \
- __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
- : "dmi" (__ctrl_reg | 0x30)); \
- /* Convert X to an integer, using +Inf rounding. */ \
- __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x)); \
- /* Restore the previous rounding mode. */ \
- __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
- : "dmi" (__ctrl_reg)); \
- return __result; \
-} \
- \
-__m81_inline float_type \
-__m81_u(__CONCAT(__modf,s))(float_type __value, float_type *__iptr) \
-{ \
- float_type __modf_int; \
- __asm ("fintrz%.x %1, %0" : "=f" (__modf_int) : "f" (__value)); \
- *__iptr = __modf_int; \
- return __value - __modf_int; \
-} \
- \
-__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \
-{ \
- /* There is no branch-condition for infinity, \
- so we must extract and examine the condition codes manually. */ \
- unsigned long int __fpsr; \
- __asm("ftst%.x %1\n" \
- "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \
- return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0; \
-} \
- \
-__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \
-{ \
- char __result; \
- __asm("ftst%.x %1\n" \
- "fsun %0" : "=dm" (__result) : "f" (__value)); \
- return __result; \
-} \
- \
-__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \
-{ \
- /* There is no branch-condition for infinity, so we must extract and \
- examine the condition codes manually. */ \
- unsigned long int __fpsr; \
- __asm ("ftst%.x %1\n" \
- "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \
- return (__fpsr & (3 << 24)) == 0; \
-} \
- \
-__m81_defun (int, __CONCAT(__ilogb,s), (float_type __x)) \
-{ \
- float_type __result; \
- if (__x == 0.0) \
- return 0x80000001; \
- __asm("fgetexp%.x %1, %0" : "=f" (__result) : "f" (__x)); \
- return (int) __result; \
-} \
- \
-__m81_defun (float_type, __CONCAT(__scalbn,s), (float_type __x, int __n)) \
-{ \
- float_type __result; \
- __asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x)); \
- return __result; \
+#define __inline_functions(float_type, s) \
+__m81_inline float_type \
+__m81_u(__CONCAT(__frexp,s))(float_type __value, int *__expptr) \
+{ \
+ float_type __mantissa, __exponent; \
+ int __iexponent; \
+ if (__value == 0.0) \
+ { \
+ *__expptr = 0; \
+ return __value; \
+ } \
+ __asm("fgetexp%.x %1, %0" : "=f" (__exponent) : "f" (__value)); \
+ __iexponent = (int) __exponent + 1; \
+ *__expptr = __iexponent; \
+ __asm("fscale%.l %2, %0" : "=f" (__mantissa) \
+ : "0" (__value), "dmi" (-__iexponent)); \
+ return __mantissa; \
+} \
+ \
+__m81_defun (float_type, __CONCAT(__floor,s), (float_type __x)) \
+{ \
+ float_type __result; \
+ unsigned long int __ctrl_reg; \
+ __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg)); \
+ /* Set rounding towards negative infinity. */ \
+ __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
+ : "dmi" ((__ctrl_reg & ~0x10) | 0x20)); \
+ /* Convert X to an integer, using -Inf rounding. */ \
+ __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x)); \
+ /* Restore the previous rounding mode. */ \
+ __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
+ : "dmi" (__ctrl_reg)); \
+ return __result; \
+} \
+ \
+__m81_defun (float_type, __CONCAT(__ceil,s), (float_type __x)) \
+{ \
+ float_type __result; \
+ unsigned long int __ctrl_reg; \
+ __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg)); \
+ /* Set rounding towards positive infinity. */ \
+ __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
+ : "dmi" (__ctrl_reg | 0x30)); \
+ /* Convert X to an integer, using +Inf rounding. */ \
+ __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x)); \
+ /* Restore the previous rounding mode. */ \
+ __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
+ : "dmi" (__ctrl_reg)); \
+ return __result; \
+} \
+ \
+__m81_defun (int, __CONCAT(__isinf,s), (float_type __value)) \
+{ \
+ /* There is no branch-condition for infinity, \
+ so we must extract and examine the condition codes manually. */ \
+ unsigned long int __fpsr; \
+ __asm("ftst%.x %1\n" \
+ "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \
+ return (__fpsr & (2 << 24)) ? (__fpsr & (8 << 24) ? -1 : 1) : 0; \
+} \
+ \
+__m81_defun (int, __CONCAT(__isnan,s), (float_type __value)) \
+{ \
+ char __result; \
+ __asm("ftst%.x %1\n" \
+ "fsun %0" : "=dm" (__result) : "f" (__value)); \
+ return __result; \
+} \
+ \
+__m81_defun (int, __CONCAT(__finite,s), (float_type __value)) \
+{ \
+ /* There is no branch-condition for infinity, so we must extract and \
+ examine the condition codes manually. */ \
+ unsigned long int __fpsr; \
+ __asm ("ftst%.x %1\n" \
+ "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \
+ return (__fpsr & (3 << 24)) == 0; \
+} \
+ \
+__m81_defun (int, __CONCAT(__signbit,s), (float_type __value)) \
+{ \
+ /* There is no branch-condition for the sign bit, so we must extract \
+ and examine the condition codes manually. */ \
+ unsigned long int __fpsr; \
+ __asm ("ftst%.x %1\n" \
+ "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value)); \
+ return (__fpsr >> 27) & 1; \
+} \
+ \
+__m81_defun (int, __CONCAT(__ilogb,s), (float_type __x)) \
+{ \
+ float_type __result; \
+ if (__x == 0.0) \
+ return 0x80000001; \
+ __asm("fgetexp%.x %1, %0" : "=f" (__result) : "f" (__x)); \
+ return (int) __result; \
+} \
+ \
+__m81_defun (float_type, __CONCAT(__scalbn,s), (float_type __x, int __n)) \
+{ \
+ float_type __result; \
+ __asm ("fscale%.l %1, %0" : "=f" (__result) : "dmi" (__n), "0" (__x)); \
+ return __result; \
+} \
+ \
+__m81_defun (float_type, __CONCAT(__nearbyint,s), (float_type __x)) \
+{ \
+ float_type __result; \
+ unsigned long int __ctrl_reg; \
+ __asm __volatile__ ("fmove%.l %!, %0" : "=dm" (__ctrl_reg)); \
+ /* Temporarily disable the inexact exception. */ \
+ __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
+ : "dmi" (__ctrl_reg & ~0x200)); \
+ __asm __volatile__ ("fint%.x %1, %0" : "=f" (__result) : "f" (__x)); \
+ __asm __volatile__ ("fmove%.l %0, %!" : /* No outputs. */ \
+ : "dmi" (__ctrl_reg)); \
+ return __result; \
}
/* This defines the three variants of the inline functions. */
@@ -286,8 +303,6 @@ __inline_forward(double,frexp, (double __value, int *__expptr),
(__value, __expptr))
__inline_forward_c(double,floor, (double __x), (__x))
__inline_forward_c(double,ceil, (double __x), (__x))
-__inline_forward(double,modf, (double __value, double *__iptr),
- (__value, __iptr))
#ifdef __USE_MISC
__inline_forward_c(int,isinf, (double __value), (__value))
__inline_forward_c(int,finite, (double __value), (__value))
@@ -299,6 +314,9 @@ __inline_forward_c(int,isnan, (double __value), (__value))
#endif
__inline_forward_c(int,ilogb, (double __value), (__value))
#endif
+#ifdef __USE_ISOC9X
+__inline_forward_c(double,nearbyint, (double __value), (__value))
+#endif
#if defined __USE_MISC || defined __USE_ISOC9X
@@ -306,8 +324,6 @@ __inline_forward(float,frexpf, (float __value, int *__expptr),
(__value, __expptr))
__inline_forward_c(float,floorf, (float __x), (__x))
__inline_forward_c(float,ceilf, (float __x), (__x))
-__inline_forward(float,modff, (float __value, float *__iptr),
- (__value, __iptr))
#ifdef __USE_MISC
__inline_forward_c(int,isinff, (float __value), (__value))
__inline_forward_c(int,finitef, (float __value), (__value))
@@ -315,14 +331,14 @@ __inline_forward_c(float,scalbnf, (float __x, int __n), (__x, __n))
__inline_forward_c(int,isnanf, (float __value), (__value))
__inline_forward_c(int,ilogbf, (float __value), (__value))
#endif
+#ifdef __USE_ISOC9X
+__inline_forward_c(float,nearbyintf, (float __value), (__value))
+#endif
__inline_forward(long double,frexpl, (long double __value, int *__expptr),
(__value, __expptr))
__inline_forward_c(long double,floorl, (long double __x), (__x))
__inline_forward_c(long double,ceill, (long double __x), (__x))
-__inline_forward(long double,modfl,
- (long double __value, long double *__iptr),
- (__value, __iptr))
#ifdef __USE_MISC
__inline_forward_c(int,isinfl, (long double __value), (__value))
__inline_forward_c(int,finitel, (long double __value), (__value))
@@ -331,6 +347,9 @@ __inline_forward_c(long double,scalbnl, (long double __x, int __n),
__inline_forward_c(int,isnanl, (long double __value), (__value))
__inline_forward_c(int,ilogbl, (long double __value), (__value))
#endif
+#ifdef __USE_ISOC9X
+__inline_forward_c(long double,nearbyintl, (long double __value), (__value))
+#endif
#endif /* Use misc or ISO C9X */