sin, cos, tan, asin, acos, and atan now support rational numbers.
This commit is contained in:
parent
5210f1448b
commit
8f0b606609
|
@ -1873,42 +1873,48 @@
|
||||||
(cond
|
(cond
|
||||||
[(flonum? x) (foreign-call "ikrt_fl_sin" x)]
|
[(flonum? x) (foreign-call "ikrt_fl_sin" x)]
|
||||||
[(fixnum? x) (foreign-call "ikrt_fx_sin" x)]
|
[(fixnum? x) (foreign-call "ikrt_fx_sin" x)]
|
||||||
[else (die 'sin "BUG: unsupported" x)])))
|
[(number? x) (sin (inexact x))]
|
||||||
|
[else (die 'sin "not a number" x)])))
|
||||||
|
|
||||||
(define cos
|
(define cos
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(cond
|
(cond
|
||||||
[(flonum? x) (foreign-call "ikrt_fl_cos" x)]
|
[(flonum? x) (foreign-call "ikrt_fl_cos" x)]
|
||||||
[(fixnum? x) (foreign-call "ikrt_fx_cos" x)]
|
[(fixnum? x) (foreign-call "ikrt_fx_cos" x)]
|
||||||
[else (die 'cos "BUG: unsupported" x)])))
|
[(number? x) (cos (inexact x))]
|
||||||
|
[else (die 'cos "not a number" x)])))
|
||||||
|
|
||||||
(define tan
|
(define tan
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(cond
|
(cond
|
||||||
[(flonum? x) (foreign-call "ikrt_fl_tan" x)]
|
[(flonum? x) (foreign-call "ikrt_fl_tan" x)]
|
||||||
[(fixnum? x) (foreign-call "ikrt_fx_tan" x)]
|
[(fixnum? x) (foreign-call "ikrt_fx_tan" x)]
|
||||||
[else (die 'tan "BUG: unsupported" x)])))
|
[(number? x) (tan (inexact x))]
|
||||||
|
[else (die 'tan "not a number" x)])))
|
||||||
|
|
||||||
(define asin
|
(define asin
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(cond
|
(cond
|
||||||
[(flonum? x) (foreign-call "ikrt_fl_asin" x)]
|
[(flonum? x) (foreign-call "ikrt_fl_asin" x)]
|
||||||
[(fixnum? x) (foreign-call "ikrt_fx_asin" x)]
|
[(fixnum? x) (foreign-call "ikrt_fx_asin" x)]
|
||||||
[else (die 'asin "BUG: unsupported" x)])))
|
[(number? x) (asin (inexact x))]
|
||||||
|
[else (die 'asin "not a number" x)])))
|
||||||
|
|
||||||
(define acos
|
(define acos
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(cond
|
(cond
|
||||||
[(flonum? x) (foreign-call "ikrt_fl_acos" x)]
|
[(flonum? x) (foreign-call "ikrt_fl_acos" x)]
|
||||||
[(fixnum? x) (foreign-call "ikrt_fx_acos" x)]
|
[(fixnum? x) (foreign-call "ikrt_fx_acos" x)]
|
||||||
[else (die 'acos "BUG: unsupported" x)])))
|
[(number? x) (acos (inexact x))]
|
||||||
|
[else (die 'acos "not a number" x)])))
|
||||||
|
|
||||||
(define atan
|
(define atan
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(cond
|
(cond
|
||||||
[(flonum? x) (foreign-call "ikrt_fl_atan" x)]
|
[(flonum? x) (foreign-call "ikrt_fl_atan" x)]
|
||||||
[(fixnum? x) (foreign-call "ikrt_fx_atan" x)]
|
[(fixnum? x) (foreign-call "ikrt_fx_atan" x)]
|
||||||
[else (die 'atan "BUG: unsupported" x)])))
|
[(number? x) (atan (inexact x))]
|
||||||
|
[else (die 'atan "not a number" x)])))
|
||||||
|
|
||||||
(define sqrt
|
(define sqrt
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1409
|
1410
|
||||||
|
|
Loading…
Reference in New Issue