From cb341bd1d790eb1f8c49fc683e3a3b8428bd01ea Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 14 Dec 2018 16:24:58 +0000 Subject: [PATCH] Disable FLONUM-EXP open-coding on i386. The instruction sequence we had was not very good, e.g. (exp -708) was off by far more than 1ulp. It can be done that way, but we need to use 64-bit precision for it, and setting the i387 precision here is getting a bit far afield from open-coding. --- src/compiler/machines/i386/machin.scm | 3 +++ src/compiler/machines/i386/rulflo.scm | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/compiler/machines/i386/machin.scm b/src/compiler/machines/i386/machin.scm index 17dd499dd..2643098eb 100644 --- a/src/compiler/machines/i386/machin.scm +++ b/src/compiler/machines/i386/machin.scm @@ -357,6 +357,9 @@ USA. ;; <= pi/4. Correct argument reduction requires a ;; better approximation of pi than the i387 has. FLONUM-SIN FLONUM-COS FLONUM-TAN + ;; Disabled: exp is too much trouble to get right in + ;; i387; need 64-bit precision. Let libm do it. + FLONUM-EXP VECTOR-CONS STRING-ALLOCATE FLOATING-VECTOR-CONS FLONUM-IS-LESS? FLONUM-IS-LESS-OR-EQUAL? FLONUM-IS-GREATER? FLONUM-IS-GREATER-OR-EQUAL? diff --git a/src/compiler/machines/i386/rulflo.scm b/src/compiler/machines/i386/rulflo.scm index 7bd2aaf69..d4ba63aab 100644 --- a/src/compiler/machines/i386/rulflo.scm +++ b/src/compiler/machines/i386/rulflo.scm @@ -335,7 +335,10 @@ USA. (LAP (FLDL2E) (FMULP (ST 1) (ST 0)) (F2XM1))))) + +;; XXX This is disabled because it is inadequate in 53-bit precision. +#; (define-arithmetic-method 'FLONUM-EXP flonum-methods/1-arg (flonum-unary-operation/stack-top (lambda () -- 2.25.1