Opened 11 years ago

Closed 11 years ago

#274 closed defect (fixed)

EXP doesn't signal overflow [on Mac]

Reported by: gz Owned by: gb
Priority: minor Milestone:
Component: ANSI CL Compliance Version:
Keywords: Cc:

Description

? (exp (+ 10 (log most-positive-single-float)))
1E++0

This was with dx86cl64 on my MacBook Pro. It works ok (signals FLOATING-POINT-OVERFLOW) with lx86cl64.

Change History (2)

comment:1 Changed 11 years ago by gb

  • Status changed from new to assigned

This is a workaround for a bug in Darwin's math library on x8664, which is a little too casual about intruducing spurious FP exceptions. With the workaround disabled:

Welcome to Clozure Common Lisp Version 1.2-r9020-trunk  (DarwinX8664)!
? (asin 1.0)
> Error: DIVISION-BY-ZERO detected
>        performing ASIN on (1.0)
> While executing: CCL::%FP-ERROR-FROM-STATUS, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > (software-version)
"8.8.1"   ; aka 10.4.8

The bug doesn't seem to be present in 10.4.10 or 10.5.x.

My recollection is that there were several such bugs in 10.4.8, and it seemed saner to ignore exceptions raised by math library routines than to try to figure out which ones were legitimate and which were spurious.

We could either say that we don't run on 10.4.8 (a few years old and no great loss), or set a bit at startup time and decide at runtime whether or not to trust the FP library to be implemented in a way that doesn't raise spurious exceptions.

comment:2 Changed 11 years ago by gb

  • Resolution set to fixed
  • Status changed from assigned to closed

This should be fixed via kernel changes in r057 (not reflected in the version string below.) As noted in the previous comment, some old OSX releases for x86-64 have math libraries that generate spurious FP exceptions, and it's not clear that we can easily tell which are spurious and which aren't; this bug is only "fixed" if we don't have to work around math library bugs.

? (lisp-implementation-version)
"Version 1.2-r9027:9029M-trunk  (DarwinX8664)"
? (exp (+ 10 (log most-positive-single-float)))
> Error: FLOATING-POINT-OVERFLOW detected
>        performing EXP on (98.72284)
Note: See TracTickets for help on using tickets.