From ... From: Erik Naggum Subject: Re: ACL bug in (tanh x) ? Date: 2000/06/08 Message-ID: <3169488665982066@naggum.no>#1/1 X-Deja-AN: 632776320 References: <393F7EBB.7D13850B@studi.epfl.ch> <393FE716.5AC4C70E@studi.epfl.ch> mail-copies-to: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsmaster@eunet.no X-Trace: oslo-nntp.eunet.no 960499870 20227 195.0.192.66 (8 Jun 2000 21:31:10 GMT) Organization: Naggum Software; vox: +47 8800 8879; fax: +47 8800 8601; http://www.naggum.no User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.6 Mime-Version: 1.0 NNTP-Posting-Date: 8 Jun 2000 21:31:10 GMT Newsgroups: comp.lang.lisp * Tim Bradshaw | So they've got a test in to stop it dying through overflow, but the | test assumes doubles, and it overflows with singles much earlier. | (I guess the test is something like `if it's greater than this just | return 1 coerced to the approprate type'). This is all bogus. (tanh x) is defined as (/ (sinh x) (cosh x)), and those are defined as (/ (+/- (exp x) (exp (- x))) 2), but (exp x) doesn't do a test, it bloats the value to double-float, computes the value, then abbreviates it to single-float, which fails for a whole truckload of double-floats, naturally. The NaN-single result is simply that of of (/ infinity infinity). I don't have an equally good explanation for the 1.0 result, which I actually don't get on my Intel Pentium III running Linux. *sigh* #:Erik -- If this is not what you expected, please alter your expectations.