INT:+ INT:- INT:* INT:DIVIDE INT:QUOTIENT INT:REMAINDER INT:ABS
INT:1+ INT:-1+ INT:NEGATE
- FLO:+ FLO:- FLO:* FLO:/ FLO:NEGATE FLO:ABS FLO:EXP FLO:LOG FLO:SIN FLO:COS
- FLO:TAN FLO:ASIN FLO:ACOS FLO:ATAN FLO:ATAN2 FLO:SQRT FLO:EXPT FLO:FLOOR
+ FLO:+ FLO:- FLO:* FLO:/ FLO:NEGATE FLO:ABS
+ FLO:EXP FLO:EXPM1 FLO:LOG FLO:LOG1P FLO:SIN FLO:COS FLO:TAN
+ FLO:ASIN FLO:ACOS FLO:ATAN FLO:ATAN2 FLO:SQRT FLO:EXPT FLO:FLOOR
FLO:CEILING FLO:TRUNCATE FLO:ROUND FLO:FLOOR->EXACT FLO:CEILING->EXACT
FLO:TRUNCATE->EXACT FLO:ROUND->EXACT
(define-use-function 'FLONUM-CEILING "DOUBLE_CEILING")
(define-use-function 'FLONUM-COS "DOUBLE_COS")
(define-use-function 'FLONUM-EXP "DOUBLE_EXP")
+ (define-use-function 'FLONUM-EXPM1 "DOUBLE_EXPM1")
(define-use-function 'FLONUM-FLOOR "DOUBLE_FLOOR")
(define-use-function 'FLONUM-LOG "DOUBLE_LOG")
+ (define-use-function 'FLONUM-LOG1P "DOUBLE_LOG1P")
(define-use-function 'FLONUM-ROUND "DOUBLE_ROUND")
(define-use-function 'FLONUM-SIN "DOUBLE_SIN")
(define-use-function 'FLONUM-SQRT "DOUBLE_SQRT")
FLONUM-ATAN FLONUM-EXP FLONUM-LOG FLONUM-REMAINDER FLONUM-SQRT
FLONUM-TRUNCATE FLONUM-ROUND FLONUM-CEILING FLONUM-FLOOR
VECTOR-CONS STRING-ALLOCATE FLOATING-VECTOR-CONS
- FLOATING-VECTOR-REF FLOATING-VECTOR-SET!))
+ FLOATING-VECTOR-REF FLOATING-VECTOR-SET! FLONUM-EXPM1 FLONUM-LOG1P))
\ No newline at end of file
(define compiler:primitives-with-no-open-coding
'(DIVIDE-FIXNUM GCD-FIXNUM &/
VECTOR-CONS STRING-ALLOCATE FLOATING-VECTOR-CONS
- FLONUM-CEILING FLONUM-FLOOR FLONUM-ATAN2))
\ No newline at end of file
+ FLONUM-CEILING FLONUM-FLOOR FLONUM-ATAN2 FLONUM-EXPM1 FLONUM-LOG1P))
\ No newline at end of file
(FXCH (ST 0) (ST 1))
(FYL2X)))))
+(define-arithmetic-method 'FLONUM-LOG1P flonum-methods/1-arg
+ ;; Computes LOG(X+1).
+ ;; X must be in the range: (- (SQRT 1/2) 1) <= X <= (- 1 (SQRT 1/2))
+ (flonum-unary-operation/stack-top
+ (lambda ()
+ (LAP (FLDLN2)
+ (FXCH (ST 0) (ST 1))
+ (FYL2XP1)))))
+
+(define-arithmetic-method 'FLONUM-EXPM1 flonum-methods/1-arg
+ ;; Computes EXP(X)-1.
+ ;; X must be in the range: (- (LOG 2)) <= X <= (LOG 2)
+ (flonum-unary-operation/stack-top
+ (lambda ()
+ (LAP (FLDL2E)
+ (FMULP (ST 1) (ST 0))
+ (F2XM1)))))
+
(define-arithmetic-method 'FLONUM-EXP flonum-methods/1-arg
(flonum-unary-operation/stack-top
(lambda ()
FLONUM-SIN FLONUM-COS FLONUM-TAN FLONUM-ASIN FLONUM-ACOS FLONUM-ATAN2
FLONUM-ATAN FLONUM-EXP FLONUM-LOG FLONUM-REMAINDER FLONUM-SQRT
FLONUM-TRUNCATE FLONUM-ROUND FLONUM-CEILING FLONUM-FLOOR
- VECTOR-CONS STRING-ALLOCATE FLOATING-VECTOR-CONS))
\ No newline at end of file
+ VECTOR-CONS STRING-ALLOCATE FLOATING-VECTOR-CONS
+ FLONUM-EXPM1 FLONUM-LOG1P))
\ No newline at end of file
INTEGER-QUOTIENT INTEGER-REMAINDER &/ QUOTIENT REMAINDER
FLONUM-SIN FLONUM-COS FLONUM-TAN FLONUM-ASIN FLONUM-ACOS
FLONUM-ATAN FLONUM-EXP FLONUM-LOG FLONUM-TRUNCATE FLONUM-ROUND
- FLONUM-REMAINDER FLONUM-SQRT
+ FLONUM-REMAINDER FLONUM-SQRT FLONUM-EXPM1 FLONUM-LOG1P
VECTOR-CONS STRING-ALLOCATE FLOATING-VECTOR-CONS
FLOATING-VECTOR-REF FLOATING-VECTOR-SET!))
\ No newline at end of file
true)
(define compiler:primitives-with-no-open-coding
- '(DIVIDE-FIXNUM GCD-FIXNUM &/))
\ No newline at end of file
+ '(DIVIDE-FIXNUM GCD-FIXNUM &/ FLONUM-EXPM1 FLONUM-LOG1P))
\ No newline at end of file
#t)
(define compiler:primitives-with-no-open-coding
- '(DIVIDE-FIXNUM GCD-FIXNUM &/
+ '(DIVIDE-FIXNUM GCD-FIXNUM &/ FLONUM-EXPM1 FLONUM-LOG1P
VECTOR-CONS STRING-ALLOCATE FLOATING-VECTOR-CONS))
\f
;;;; Closure format
(define compiler:primitives-with-no-open-coding
'(DIVIDE-FIXNUM GCD-FIXNUM &/
VECTOR-CONS STRING-ALLOCATE FLOATING-VECTOR-CONS
- FLOATING-VECTOR-REF FLOATING-VECTOR-SET!))
\ No newline at end of file
+ FLOATING-VECTOR-REF FLOATING-VECTOR-SET! FLONUM-EXPM1 FLONUM-LOG1P))
\ No newline at end of file
'(DIVIDE-FIXNUM
&/
FLOATING-VECTOR-CONS FLONUM-ACOS FLONUM-ASIN FLONUM-ATAN
- FLONUM-ATAN2 FLONUM-CEILING FLONUM-COS FLONUM-EXP FLONUM-FLOOR
- FLONUM-LOG FLONUM-ROUND FLONUM-SIN FLONUM-TAN FLONUM-TRUNCATE
- GCD-FIXNUM STRING-ALLOCATE VECTOR-CONS))
\ No newline at end of file
+ FLONUM-ATAN2 FLONUM-CEILING FLONUM-COS FLONUM-EXP FLONUM-EXPM1
+ FLONUM-FLOOR FLONUM-LOG FLONUM-LOG1P FLONUM-ROUND FLONUM-SIN
+ FLONUM-TAN FLONUM-TRUNCATE GCD-FIXNUM STRING-ALLOCATE VECTOR-CONS))
\ No newline at end of file
'(0)
internal-close-coding-for-type-checks)))
'(FLONUM-NEGATE FLONUM-ABS FLONUM-SIN FLONUM-COS FLONUM-TAN FLONUM-ASIN
- FLONUM-ACOS FLONUM-ATAN FLONUM-EXP FLONUM-LOG FLONUM-SQRT FLONUM-ROUND
- FLONUM-TRUNCATE FLONUM-CEILING FLONUM-FLOOR))
+ FLONUM-ACOS FLONUM-ATAN FLONUM-EXP FLONUM-EXPM1 FLONUM-LOG FLONUM-LOG1P
+ FLONUM-SQRT FLONUM-ROUND FLONUM-TRUNCATE FLONUM-CEILING FLONUM-FLOOR))
(for-each
(lambda (flonum-operator)
FLONUM_RESULT (result); \
}
+DEFINE_PRIMITIVE ("FLONUM-EXPM1", Prim_flonum_expm1, 1, 1, 0)
+ RESTRICTED_TRANSCENDENTAL_FUNCTION
+ (expm1, ((x >= - M_LN2) && (x <= M_LN2)))
+DEFINE_PRIMITIVE ("FLONUM-LOG1P", Prim_flonum_log1p, 1, 1, 0)
+ RESTRICTED_TRANSCENDENTAL_FUNCTION
+ (log1p, ((x >= (M_SQRT1_2 - 1.0)) && (x <= (1.0 - M_SQRT1_2))))
+
DEFINE_PRIMITIVE ("FLONUM-EXP", Prim_flonum_exp, 1, 1, 0)
SIMPLE_TRANSCENDENTAL_FUNCTION (exp)
DEFINE_PRIMITIVE ("FLONUM-LOG", Prim_flonum_log, 1, 1, 0)
#define DOUBLE_CEILING ceil
#define DOUBLE_COS cos
#define DOUBLE_EXP exp
+#define DOUBLE_EXPM1 expm1
#define DOUBLE_FLOOR floor
#define DOUBLE_LOG log
+#define DOUBLE_LOG1P log1p
#define DOUBLE_SIN sin
#define DOUBLE_SQRT sqrt
#define DOUBLE_TAN tan
(flo:negate flonum-negate 1)
(flo:abs flonum-abs 1)
(flo:exp flonum-exp 1)
+ (flo:expm1 flonum-expm1 1)
(flo:log flonum-log 1)
+ (flo:log1p flonum-log1p 1)
(flo:sin flonum-sin 1)
(flo:cos flonum-cos 1)
(flo:tan flonum-tan 1)
flo:ceiling->exact
flo:cos
flo:exp
+ flo:expm1
flo:expt
flo:finite?
flo:flonum?
flo:floor
flo:floor->exact
flo:log
+ flo:log1p
flo:max
flo:min
flo:negate
(FLO:CEILING->EXACT FLONUM-CEILING->EXACT)
(FLO:COS FLONUM-COS)
(FLO:EXP FLONUM-EXP)
+ (FLO:EXPM1 FLONUM-EXPM1)
(FLO:EXPT FLONUM-EXPT)
(FLO:FLONUM? FLONUM?)
(FLO:FLOOR FLONUM-FLOOR)
(FLO:FLOOR->EXACT FLONUM-FLOOR->EXACT)
(FLO:LOG FLONUM-LOG)
+ (FLO:LOG1P FLONUM-LOG1P)
(FLO:NEGATE FLONUM-NEGATE)
(FLO:NEGATIVE? FLONUM-NEGATIVE?)
(FLO:POSITIVE? FLONUM-POSITIVE?)