From 8f0b60660915b62af8c7bdf98ee50c90403317d4 Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Mon, 3 Mar 2008 13:49:47 -0500 Subject: [PATCH] sin, cos, tan, asin, acos, and atan now support rational numbers. --- scheme/ikarus.numerics.ss | 18 ++++++++++++------ scheme/last-revision | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/scheme/ikarus.numerics.ss b/scheme/ikarus.numerics.ss index f61a968..96c647a 100644 --- a/scheme/ikarus.numerics.ss +++ b/scheme/ikarus.numerics.ss @@ -1873,42 +1873,48 @@ (cond [(flonum? x) (foreign-call "ikrt_fl_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 (lambda (x) (cond [(flonum? x) (foreign-call "ikrt_fl_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 (lambda (x) (cond [(flonum? x) (foreign-call "ikrt_fl_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 (lambda (x) (cond [(flonum? x) (foreign-call "ikrt_fl_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 (lambda (x) (cond [(flonum? x) (foreign-call "ikrt_fl_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 (lambda (x) (cond [(flonum? x) (foreign-call "ikrt_fl_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 (lambda (x) diff --git a/scheme/last-revision b/scheme/last-revision index 08507bb..4b486a6 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1409 +1410