X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=scheme.forth.jl.git;a=blobdiff_plain;f=src%2Fscheme-library.scm;h=e8e92454acbe64d5a709d60ec913fd5e7365b161;hp=fc3c9b91a2feeff79dcc28949fd6b551f4d2cfa0;hb=adf3bf12d8ae16055f381d06079804068e6c1611;hpb=ec9fd0159ca81657ec35ca99efb4365162672d42 diff --git a/src/scheme-library.scm b/src/scheme-library.scm index fc3c9b9..e8e9245 100644 --- a/src/scheme-library.scm +++ b/src/scheme-library.scm @@ -58,13 +58,15 @@ ; Binary operations +(define (fix:/ x y) ; Non-standard definition while we don't have rationals + (if (fix:= 0 (fix:remainder x y)) + (fix:quotient x y) + (flo:/ (fixnum->flonum x) (fixnum->flonum y)))) + (define (pair+ x y) (promote-dispatch (cons fix:+ flo:+) x y)) (define (pair- x y) (promote-dispatch (cons fix:- flo:-) x y)) (define (pair* x y) (promote-dispatch (cons fix:* flo:*) x y)) -(define (pair/ x y) (promote-dispatch - (cons (lambda 'args - (error "Division unsupported for integers.")) - flo:/) x y)) +(define (pair/ x y) (promote-dispatch (cons fix:/ flo:/) x y)) (define (pair> x y) (promote-dispatch (cons fix:> flo:>) x y)) (define (pair< x y) (promote-dispatch (cons fix:< flo:<) x y))