Raymond Toy pushed to branch issue-425-correctly-rounded-math-functions at cmucl / cmucl

Commits:

4 changed files:

Changes:

  • src/lisp/Config.x86_common
    ... ... @@ -42,29 +42,29 @@ endif
    42 42
     ifdef FEATURE_CORE_MATH
    
    43 43
     CORE_MATH_64=core-math/src/binary64
    
    44 44
     
    
    45
    -CORE64_OBJS=\
    
    46
    -	$(CORE_MATH_64)/sin/sin.o \
    
    47
    -	$(CORE_MATH_64)/cos/cos.o \
    
    48
    -	$(CORE_MATH_64)/tan/tan.o \
    
    49
    -	$(CORE_MATH_64)/atan2/atan2.o \
    
    50
    -	$(CORE_MATH_64)/asin/asin.o \
    
    51
    -	$(CORE_MATH_64)/acos/acos.o \
    
    52
    -	$(CORE_MATH_64)/atan/atan.o \
    
    53
    -	$(CORE_MATH_64)/sinh/sinh.o \
    
    54
    -	$(CORE_MATH_64)/cosh/cosh.o \
    
    55
    -	$(CORE_MATH_64)/tanh/tanh.o \
    
    56
    -	$(CORE_MATH_64)/asinh/asinh.o \
    
    57
    -	$(CORE_MATH_64)/acosh/acosh.o \
    
    58
    -	$(CORE_MATH_64)/atanh/atanh.o \
    
    59
    -	$(CORE_MATH_64)/exp/exp.o \
    
    60
    -	$(CORE_MATH_64)/log/log.o \
    
    61
    -	$(CORE_MATH_64)/log10/log10.o \
    
    62
    -	$(CORE_MATH_64)/log2/log2.o \
    
    63
    -	$(CORE_MATH_64)/pow/pow.o \
    
    64
    -	$(CORE_MATH_64)/hypot/hypot.o \
    
    65
    -	$(CORE_MATH_64)/log1p/log1p.o \
    
    66
    -	$(CORE_MATH_64)/expm1/expm1.o \
    
    67
    -	$(CORE_MATH_64)/sincos/sincos.o
    
    45
    +CORE64_SRCS=\
    
    46
    +	$(CORE_MATH_64)/sin/sin.c \
    
    47
    +	$(CORE_MATH_64)/cos/cos.c \
    
    48
    +	$(CORE_MATH_64)/tan/tan.c \
    
    49
    +	$(CORE_MATH_64)/atan2/atan2.c \
    
    50
    +	$(CORE_MATH_64)/asin/asin.c \
    
    51
    +	$(CORE_MATH_64)/acos/acos.c \
    
    52
    +	$(CORE_MATH_64)/atan/atan.c \
    
    53
    +	$(CORE_MATH_64)/sinh/sinh.c \
    
    54
    +	$(CORE_MATH_64)/cosh/cosh.c \
    
    55
    +	$(CORE_MATH_64)/tanh/tanh.c \
    
    56
    +	$(CORE_MATH_64)/asinh/asinh.c \
    
    57
    +	$(CORE_MATH_64)/acosh/acosh.c \
    
    58
    +	$(CORE_MATH_64)/atanh/atanh.c \
    
    59
    +	$(CORE_MATH_64)/exp/exp.c \
    
    60
    +	$(CORE_MATH_64)/log/log.c \
    
    61
    +	$(CORE_MATH_64)/log10/log10.c \
    
    62
    +	$(CORE_MATH_64)/log2/log2.c \
    
    63
    +	$(CORE_MATH_64)/pow/pow.c \
    
    64
    +	$(CORE_MATH_64)/hypot/hypot.c \
    
    65
    +	$(CORE_MATH_64)/log1p/log1p.c \
    
    66
    +	$(CORE_MATH_64)/expm1/expm1.c \
    
    67
    +	$(CORE_MATH_64)/sincos/sincos.c
    
    68 68
     endif
    
    69 69
     
    
    70 70
     ifeq ($(filter 2% 3%, $(shell $(CC) -dumpversion)),)
    

  • src/lisp/GNUmakefile
    ... ... @@ -36,7 +36,7 @@ SRCS = lisp.c coreparse.c alloc.c monitor.c print.c interr.c \
    36 36
     	dynbind.c breakpoint.c regnames.c backtrace.c save.c purify.c \
    
    37 37
     	runprog.c time.c case-mapping.c exec-init.c \
    
    38 38
     	irrat.c \
    
    39
    -	${CORE64_OBJS:.o=.c} \
    
    39
    +	${CORE64_SRCS} \
    
    40 40
     	${FDLIBM} ${ARCH_SRC} ${ASSEM_SRC} ${OS_SRC} ${GC_SRC}
    
    41 41
     
    
    42 42
     
    
    ... ... @@ -61,8 +61,8 @@ lisp: ${OBJS} ${CORE64_OBJS} version.o
    61 61
     
    
    62 62
     # Create a library out of all the object files so we can build an
    
    63 63
     # executable.  However, we need to remove exec-init.o from the library
    
    64
    -lisp.a:	version.o ${OBJS} ${CORE64_OBJS} ${EXEC_FINAL_OBJ}
    
    65
    -	$(AR) crs lisp.a ${OBJS} ${CORE64_OBJS} version.o
    
    64
    +lisp.a:	version.o ${OBJS} ${EXEC_FINAL_OBJ}
    
    65
    +	$(AR) crs lisp.a ${OBJS} version.o
    
    66 66
     ifneq (${EXEC_FINAL_OBJ},)
    
    67 67
     	$(AR) d lisp.a exec-init.o
    
    68 68
     endif
    

  • src/lisp/irrat.c
    ... ... @@ -7,6 +7,8 @@
    7 7
     
    
    8 8
     #include "lisp.h"
    
    9 9
     #include "internals.h"
    
    10
    +#include "fdlibm.h"
    
    11
    +
    
    10 12
     #ifdef FEATURE_CORE_MATH
    
    11 13
     #include <math.h>
    
    12 14
     extern double cr_sin(double);
    
    ... ... @@ -29,8 +31,6 @@ extern double cr_pow(double, double);
    29 31
     extern double cr_hypot(double, double);
    
    30 32
     extern double cr_log1p(double);
    
    31 33
     extern double cr_expm1(double);
    
    32
    -#else
    
    33
    -#include "fdlibm.h"
    
    34 34
     #endif
    
    35 35
     
    
    36 36
     
    
    ... ... @@ -241,9 +241,5 @@ lisp_expm1(double x)
    241 241
     double
    
    242 242
     lisp_scalbn(double x, int n)
    
    243 243
     {
    
    244
    -#ifdef FEATURE_CORE_MATH
    
    245
    -    return scalbn(x, n);
    
    246
    -#else    
    
    247 244
         return fdlibm_scalbn(x, n);
    
    248
    -#endif
    
    249 245
     }

  • tests/fdlibm.lisp
    ... ... @@ -171,6 +171,7 @@
    171 171
       (ext:with-float-traps-masked (:invalid)
    
    172 172
         (assert-true (ext::float-nan-p (kernel:%expm1 *snan*))))
    
    173 173
       ;; expm1(x) = -1 for x < -56*log(2), signaling inexact
    
    174
    +  #-core-math
    
    174 175
       (let ((x (* -57 (log 2d0))))
    
    175 176
         (ext:with-float-traps-enabled (:inexact)
    
    176 177
     	(assert-error 'floating-point-inexact
    
    ... ... @@ -217,6 +218,7 @@
    217 218
       (ext:with-float-traps-masked (:overflow)
    
    218 219
         (assert-equal ext:double-float-positive-infinity
    
    219 220
     		  (kernel:%exp 710d0)))
    
    221
    +  #-core-math
    
    220 222
       (let ((modes (ext:get-floating-point-modes)))
    
    221 223
         (unwind-protect
    
    222 224
     	 (progn