From 73be98c4ab64941418a7773929ffa0ca6b9b34b2 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 26 Oct 2018 23:32:37 +0000 Subject: [PATCH] Expose the minimum and maximum finite normal floating-point exponents. --- src/microcode/utabmd.c | 10 ++++++++-- src/runtime/microcode-tables.scm | 6 ++++++ src/runtime/runtime.pkg | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/microcode/utabmd.c b/src/microcode/utabmd.c index 463a86bc9..a587ca64d 100644 --- a/src/microcode/utabmd.c +++ b/src/microcode/utabmd.c @@ -60,8 +60,10 @@ static SCHEME_OBJECT names_to_vector (unsigned long, const char **); #define ID_STACK_TYPE 10 /* Scheme stack type (string) */ #define ID_MACHINE_TYPE 11 /* Machine type (string) */ #define ID_CC_ARCH 12 /* Compiled-code support (string) */ +#define ID_FLONUM_EXP_MIN 13 /* Minimum finite (normal) exponent */ +#define ID_FLONUM_EXP_MAX 14 /* Maximum finite exponent */ -#define N_IDENTITY_NAMES 0x0D +#define N_IDENTITY_NAMES 0x0F static const char * identity_names [] = { /* 0x00 */ "system-release-string", @@ -76,7 +78,9 @@ static const char * identity_names [] = /* 0x09 */ "os-variant-string", /* 0x0A */ "stack-type-string", /* 0x0B */ "machine-type-string", - /* 0x0C */ "cc-arch-string" + /* 0x0C */ "cc-arch-string", + /* 0x0D */ "flonum-exponent-min", + /* 0x0E */ "flonum-exponent-max", }; SCHEME_OBJECT @@ -94,6 +98,8 @@ make_microcode_identification_vector (void) VECTOR_SET (v, ID_OS_VARIANT, (char_pointer_to_string (OS_Variant))); VECTOR_SET (v, ID_STACK_TYPE, (char_pointer_to_string ("standard"))); VECTOR_SET (v, ID_MACHINE_TYPE, (char_pointer_to_string (MACHINE_TYPE))); + VECTOR_SET (v, ID_FLONUM_EXP_MIN, (LONG_TO_FIXNUM (DBL_MIN_EXP - 1))); + VECTOR_SET (v, ID_FLONUM_EXP_MAX, (LONG_TO_FIXNUM (DBL_MAX_EXP - 1))); { const char * name = (cc_arch_name ()); if (name != 0) diff --git a/src/runtime/microcode-tables.scm b/src/runtime/microcode-tables.scm index a196d2c5a..ff26f220c 100644 --- a/src/runtime/microcode-tables.scm +++ b/src/runtime/microcode-tables.scm @@ -180,6 +180,8 @@ USA. (define microcode-version-string) (define microcode-id/floating-mantissa-bits) (define microcode-id/floating-epsilon) +(define microcode-id/floating-exponent-min) +(define microcode-id/floating-exponent-max) (define microcode-id/operating-system) (define microcode-id/operating-system-name) (define microcode-id/operating-system-variant) @@ -194,6 +196,10 @@ USA. (microcode-identification-item 'flonum-mantissa-length)) (set! microcode-id/floating-epsilon (microcode-identification-item 'flonum-epsilon)) + (set! microcode-id/floating-exponent-min + (microcode-identification-item 'flonum-exponent-min)) + (set! microcode-id/floating-exponent-max + (microcode-identification-item 'flonum-exponent-max)) (set! microcode-id/operating-system-name (microcode-identification-item 'os-name-string)) (set! microcode-id/operating-system diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index dc5aa5ae8..685c0b8a6 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -3224,6 +3224,8 @@ USA. microcode-id/compiled-code-type microcode-id/floating-epsilon microcode-id/floating-mantissa-bits + microcode-id/floating-exponent-max + microcode-id/floating-exponent-min microcode-id/machine-type microcode-id/operating-system microcode-id/operating-system-suffix -- 2.25.1