From: Taylor R Campbell Date: Sat, 27 Oct 2018 01:39:58 +0000 (+0000) Subject: Define and export some more floating-point parameters. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~148 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=3dc80642c54b5c8f3893ede0e3fa430d2f97bae3;p=mit-scheme.git Define and export some more floating-point parameters. --- diff --git a/src/runtime/arith.scm b/src/runtime/arith.scm index 71c66b399..990af61f5 100644 --- a/src/runtime/arith.scm +++ b/src/runtime/arith.scm @@ -93,6 +93,17 @@ USA. (define rec:pi/2 (flo:* 2. (flo:atan2 1. 1.))) (define rec:pi (flo:* 2. rec:pi/2)) +(define flo:epsilon) +(define flo:log-epsilon) +(define flo:normal-exponent-max-base-2) +(define flo:normal-exponent-min-base-2) +(define flo:normal-exponent-max-base-e) +(define flo:normal-exponent-min-base-e) +(define flo:normal-exponent-max-base-10) +(define flo:normal-exponent-min-base-10) +(define flo:subnormal-exponent-min-base-2) +(define flo:subnormal-exponent-min-base-e) +(define flo:subnormal-exponent-min-base-10) (define flo:significand-digits-base-2) (define flo:significand-digits-base-10) (define int:flonum-integer-limit) @@ -111,6 +122,29 @@ USA. (flo:/ (int:->flonum p) (flo:/ (flo:log 10.) (flo:log 2.)))))) (set! int:flonum-integer-limit (int:expt 2 p))) + (set! flo:epsilon microcode-id/floating-epsilon) + (set! flo:log-epsilon (flo:log flo:epsilon)) + (set! flo:normal-exponent-max-base-2 microcode-id/floating-exponent-max) + (set! flo:normal-exponent-min-base-2 microcode-id/floating-exponent-min) + (set! flo:subnormal-exponent-min-base-2 + (int:- flo:normal-exponent-min-base-2 + (int:- flo:significand-digits-base-2 1))) + (set! flo:normal-exponent-max-base-e + (flo:log (flo:expt 2. (int:->flonum flo:normal-exponent-max-base-2)))) + (set! flo:normal-exponent-min-base-e + (flo:log (flo:expt 2. (int:->flonum flo:normal-exponent-min-base-2)))) + (set! flo:subnormal-exponent-min-base-e + (flo:+ + flo:normal-exponent-min-base-e + (flo:log + (flo:expt 2. + (flo:- 0. (int:->flonum flo:significand-digits-base-2)))))) + (set! flo:normal-exponent-max-base-10 + (flo:/ flo:normal-exponent-max-base-e (flo:log 10.))) + (set! flo:normal-exponent-min-base-10 + (flo:/ flo:normal-exponent-min-base-e (flo:log 10.))) + (set! flo:subnormal-exponent-min-base-10 + (flo:/ flo:subnormal-exponent-min-base-e (flo:log 10.))) unspecific) (define (initialize-package!) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 685c0b8a6..3a05dd288 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -3354,8 +3354,19 @@ USA. cube exact-nonnegative-integer? exact-positive-integer? + flo:epsilon + flo:log-epsilon + flo:normal-exponent-max-base-10 + flo:normal-exponent-max-base-2 + flo:normal-exponent-max-base-e + flo:normal-exponent-min-base-10 + flo:normal-exponent-min-base-2 + flo:normal-exponent-min-base-e flo:significand-digits-base-10 flo:significand-digits-base-2 + flo:subnormal-exponent-min-base-10 + flo:subnormal-exponent-min-base-2 + flo:subnormal-exponent-min-base-e flonum-printer:engineering-output flonum-printer:normal-output flonum-printer:scientific-output