Subject: Re: ACL bug in (tanh x) ?
From: Erik Naggum <erik@naggum.no>
Date: 2000/06/08
Newsgroups: comp.lang.lisp
Message-ID: <3169488665982066@naggum.no>

* Tim Bradshaw <tfb@cley.com>
| 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.