Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
-
7f708431
by Raymond Toy at 2026-01-27T08:45:32-08:00
-
318d0560
by Raymond Toy at 2026-01-27T08:45:32-08:00
5 changed files:
Changes:
| ... | ... | @@ -76,37 +76,37 @@ |
| 76 | 76 | ;;; Please refer to the Unix man pages for details about these routines.
|
| 77 | 77 | |
| 78 | 78 | ;;; Trigonometric.
|
| 79 | -(def-math-rtn ("fdlibm_sin" %sin) 1)
|
|
| 80 | -(def-math-rtn ("fdlibm_cos" %cos) 1)
|
|
| 81 | -(def-math-rtn ("fdlibm_tan" %tan) 1)
|
|
| 82 | -(def-math-rtn ("fdlibm_atan" %atan) 1)
|
|
| 83 | -(def-math-rtn ("__ieee754_atan2" %atan2) 2)
|
|
| 84 | -(def-math-rtn ("__ieee754_asin" %asin) 1)
|
|
| 85 | -(def-math-rtn ("__ieee754_acos" %acos) 1)
|
|
| 86 | -(def-math-rtn ("__ieee754_sinh" %sinh) 1)
|
|
| 87 | -(def-math-rtn ("__ieee754_cosh" %cosh) 1)
|
|
| 88 | -(def-math-rtn ("fdlibm_tanh" %tanh) 1)
|
|
| 89 | -(def-math-rtn ("fdlibm_asinh" %asinh) 1)
|
|
| 90 | -(def-math-rtn ("__ieee754_acosh" %acosh) 1)
|
|
| 91 | -(def-math-rtn ("__ieee754_atanh" %atanh) 1)
|
|
| 79 | +(def-math-rtn ("lisp_sin" %sin) 1)
|
|
| 80 | +(def-math-rtn ("lisp_cos" %cos) 1)
|
|
| 81 | +(def-math-rtn ("lisp_tan" %tan) 1)
|
|
| 82 | +(def-math-rtn ("lisp_atan" %atan) 1)
|
|
| 83 | +(def-math-rtn ("lisp_atan2" %atan2) 2)
|
|
| 84 | +(def-math-rtn ("lisp_asin" %asin) 1)
|
|
| 85 | +(def-math-rtn ("lisp_acos" %acos) 1)
|
|
| 86 | +(def-math-rtn ("lisp_sinh" %sinh) 1)
|
|
| 87 | +(def-math-rtn ("lisp_cosh" %cosh) 1)
|
|
| 88 | +(def-math-rtn ("lisp_tanh" %tanh) 1)
|
|
| 89 | +(def-math-rtn ("lisp_asinh" %asinh) 1)
|
|
| 90 | +(def-math-rtn ("lisp_acosh" %acosh) 1)
|
|
| 91 | +(def-math-rtn ("lisp_atanh" %atanh) 1)
|
|
| 92 | 92 | |
| 93 | 93 | ;;; Exponential and Logarithmic.
|
| 94 | -(def-math-rtn ("__ieee754_exp" %exp) 1)
|
|
| 95 | -(def-math-rtn ("__ieee754_log" %log) 1)
|
|
| 96 | -(def-math-rtn ("__ieee754_log10" %log10) 1)
|
|
| 97 | -(def-math-rtn ("cmucl_log2" %log2) 1)
|
|
| 94 | +(def-math-rtn ("lisp_exp" %exp) 1)
|
|
| 95 | +(def-math-rtn ("lisp_log" %log) 1)
|
|
| 96 | +(def-math-rtn ("lisp_log10" %log10) 1)
|
|
| 97 | +(def-math-rtn ("lisp_log2" %log2) 1)
|
|
| 98 | 98 | |
| 99 | -(def-math-rtn ("__ieee754_pow" %pow) 2)
|
|
| 99 | +(def-math-rtn ("lisp_pow" %pow) 2)
|
|
| 100 | 100 | #-(or x86 sparc-v7 sparc-v8 sparc-v9)
|
| 101 | 101 | (def-math-rtn "sqrt" 1)
|
| 102 | -(def-math-rtn ("__ieee754_hypot" %hypot) 2)
|
|
| 102 | +(def-math-rtn ("lisp_hypot" %hypot) 2)
|
|
| 103 | 103 | |
| 104 | -(def-math-rtn ("fdlibm_log1p" %log1p) 1)
|
|
| 105 | -(def-math-rtn ("fdlibm_expm1" %expm1) 1)
|
|
| 104 | +(def-math-rtn ("lisp_log1p" %log1p) 1)
|
|
| 105 | +(def-math-rtn ("lisp_expm1" %expm1) 1)
|
|
| 106 | 106 | |
| 107 | 107 | (declaim (inline %scalbn))
|
| 108 | 108 | (export '%scalbn)
|
| 109 | -(alien:def-alien-routine ("fdlibm_scalbn" %scalbn) c-call:double
|
|
| 109 | +(alien:def-alien-routine ("lisp_scalbn" %scalbn) c-call:double
|
|
| 110 | 110 | (x double-float)
|
| 111 | 111 | (n c-call:int))
|
| 112 | 112 |
| ... | ... | @@ -35,6 +35,7 @@ SRCS = lisp.c coreparse.c alloc.c monitor.c print.c interr.c \ |
| 35 | 35 | vars.c parse.c interrupt.c search.c validate.c globals.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 | + irrat.c \
|
|
| 38 | 39 | ${FDLIBM} ${ARCH_SRC} ${ASSEM_SRC} ${OS_SRC} ${GC_SRC}
|
| 39 | 40 | |
| 40 | 41 | OBJS = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(patsubst %.s,%.o,$(SRCS))))
|
| ... | ... | @@ -54,8 +54,21 @@ extern double fdlibm_tan(double x); |
| 54 | 54 | extern double fdlibm_expm1(double x);
|
| 55 | 55 | extern double fdlibm_log1p(double x);
|
| 56 | 56 | extern double fdlibm_atan(double x);
|
| 57 | +extern double fdlibm_tanh(double x);
|
|
| 58 | +extern double fdlibm_asinh(double x);
|
|
| 57 | 59 | extern double __ieee754_exp(double x);
|
| 58 | 60 | extern double __ieee754_log(double x);
|
| 61 | +extern double __ieee754_atan2(double y, double x);
|
|
| 62 | +extern double __ieee754_asin(double x);
|
|
| 63 | +extern double __ieee754_acos(double x);
|
|
| 64 | +extern double __ieee754_sinh(double x);
|
|
| 65 | +extern double __ieee754_cosh(double x);
|
|
| 66 | +extern double __ieee754_atanh(double x);
|
|
| 67 | +extern double __ieee754_acosh(double x);
|
|
| 68 | +extern double __ieee754_log10(double x);
|
|
| 69 | +extern double __ieee754_pow(double x, double y);
|
|
| 70 | +extern double __ieee754_hypot(double x, double y);
|
|
| 71 | +extern double fdlibm_scalbn(double x, int n);
|
|
| 59 | 72 | |
| 60 | 73 | enum FDLIBM_EXCEPTION {
|
| 61 | 74 | FDLIBM_DIVIDE_BY_ZERO,
|
| 1 | +/*
|
|
| 2 | + |
|
| 3 | + This code was written as part of the CMU Common Lisp project at
|
|
| 4 | + Carnegie Mellon University, and has been placed in the public domain.
|
|
| 5 | + |
|
| 6 | +*/
|
|
| 7 | + |
|
| 8 | +#include "fdlibm.h"
|
|
| 9 | + |
|
| 10 | +/*
|
|
| 11 | + * Wrappers for the special functions
|
|
| 12 | + */
|
|
| 13 | + |
|
| 14 | +double
|
|
| 15 | +lisp_sin(double x)
|
|
| 16 | +{
|
|
| 17 | + return fdlibm_sin(x);
|
|
| 18 | +}
|
|
| 19 | + |
|
| 20 | +double
|
|
| 21 | +lisp_cos(double x)
|
|
| 22 | +{
|
|
| 23 | + return fdlibm_cos(x);
|
|
| 24 | +}
|
|
| 25 | + |
|
| 26 | +double
|
|
| 27 | +lisp_tan(double x)
|
|
| 28 | +{
|
|
| 29 | + return fdlibm_tan(x);
|
|
| 30 | +}
|
|
| 31 | + |
|
| 32 | +double
|
|
| 33 | +lisp_atan(double x)
|
|
| 34 | +{
|
|
| 35 | + return fdlibm_atan(x);
|
|
| 36 | +}
|
|
| 37 | + |
|
| 38 | +double
|
|
| 39 | +lisp_atan2(double y, double x)
|
|
| 40 | +{
|
|
| 41 | + return __ieee754_atan2(y, x);
|
|
| 42 | +}
|
|
| 43 | + |
|
| 44 | +double
|
|
| 45 | +lisp_asin(double x)
|
|
| 46 | +{
|
|
| 47 | + return __ieee754_asin(x);
|
|
| 48 | +}
|
|
| 49 | + |
|
| 50 | +double
|
|
| 51 | +lisp_acos(double x)
|
|
| 52 | +{
|
|
| 53 | + return __ieee754_acos(x);
|
|
| 54 | +}
|
|
| 55 | + |
|
| 56 | +double
|
|
| 57 | +lisp_sinh(double x)
|
|
| 58 | +{
|
|
| 59 | + return __ieee754_sinh(x);
|
|
| 60 | +}
|
|
| 61 | + |
|
| 62 | +double
|
|
| 63 | +lisp_cosh(double x)
|
|
| 64 | +{
|
|
| 65 | + return __ieee754_cosh(x);
|
|
| 66 | +}
|
|
| 67 | + |
|
| 68 | +double
|
|
| 69 | +lisp_tanh(double x)
|
|
| 70 | +{
|
|
| 71 | + return fdlibm_tanh(x);
|
|
| 72 | +}
|
|
| 73 | + |
|
| 74 | +double
|
|
| 75 | +lisp_asinh(double x)
|
|
| 76 | +{
|
|
| 77 | + return fdlibm_asinh(x);
|
|
| 78 | +}
|
|
| 79 | + |
|
| 80 | +double
|
|
| 81 | +lisp_acosh(double x)
|
|
| 82 | +{
|
|
| 83 | + return __ieee754_acosh(x);
|
|
| 84 | +}
|
|
| 85 | + |
|
| 86 | +double
|
|
| 87 | +lisp_atanh(double x)
|
|
| 88 | +{
|
|
| 89 | + return __ieee754_atanh(x);
|
|
| 90 | +}
|
|
| 91 | + |
|
| 92 | +double
|
|
| 93 | +lisp_exp(double x)
|
|
| 94 | +{
|
|
| 95 | + return __ieee754_exp(x);
|
|
| 96 | +}
|
|
| 97 | + |
|
| 98 | +double
|
|
| 99 | +lisp_log(double x)
|
|
| 100 | +{
|
|
| 101 | + return __ieee754_log(x);
|
|
| 102 | +}
|
|
| 103 | + |
|
| 104 | +double
|
|
| 105 | +lisp_log10(double x)
|
|
| 106 | +{
|
|
| 107 | + return __ieee754_log10(x);
|
|
| 108 | +}
|
|
| 109 | + |
|
| 110 | +double
|
|
| 111 | +lisp_pow(double x, double y)
|
|
| 112 | +{
|
|
| 113 | + return __ieee754_pow(x, y);
|
|
| 114 | +}
|
|
| 115 | + |
|
| 116 | +double
|
|
| 117 | +lisp_hypot(double x, double y)
|
|
| 118 | +{
|
|
| 119 | + return __ieee754_hypot(x, y);
|
|
| 120 | +}
|
|
| 121 | + |
|
| 122 | +double
|
|
| 123 | +lisp_log1p(double x)
|
|
| 124 | +{
|
|
| 125 | + return fdlibm_log1p(x);
|
|
| 126 | +}
|
|
| 127 | + |
|
| 128 | +double
|
|
| 129 | +lisp_expm1(double x)
|
|
| 130 | +{
|
|
| 131 | + return fdlibm_expm1(x);
|
|
| 132 | +}
|
|
| 133 | + |
|
| 134 | +double
|
|
| 135 | +lisp_scalbn(double x, int n)
|
|
| 136 | +{
|
|
| 137 | + return fdlibm_scalbn(x, n);
|
|
| 138 | +} |
| ... | ... | @@ -39,7 +39,7 @@ cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ |
| 39 | 39 | cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */
|
| 40 | 40 | cp_l = -7.02846165095275826516e-09; /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/
|
| 41 | 41 | |
| 42 | -double cmucl_log2(double x)
|
|
| 42 | +double lisp_log2(double x)
|
|
| 43 | 43 | {
|
| 44 | 44 | double ax;
|
| 45 | 45 | int k, hx, lx, ix;
|