I suspect that if  tanh 0.2+T is still not exactly 1
then the computation used in tanh is not the best.

To settle it, we can use
http://www.jsoftware.com/jwiki/Essays/Extended_Precision_Functions#head-f43abe4b382ab35179da8c5ad8c8906158ae0a3e



----- Original Message -----
From: Zsbán Ambrus <[EMAIL PROTECTED]>
Date: Sunday, March 2, 2008 9:03
Subject: Re: [Jprogramming] What is interesting about 27*^.2 ?
To: Programming forum <[email protected]>

> On Sun, Mar 2, 2008 at 7:45 AM, Roger Hui <[EMAIL PROTECTED]> wrote:
> >    T=: 27*^.2
> >
> >  (spoiler alert.)
> >
> >
> >  What is interesting about T=:27*^.2 ?  In IEEE 64-bit
> >  floating point calculation, for all y>:T, 1=tanh y
> >  (and _1=tanh -y) and T is the smallest number with
> >  this property.
> >
> >    tanh=: (^ - [EMAIL PROTECTED]) % (^ + [EMAIL PROTECTED])
> 
> I would rather defined tanh as
> 
>  tanh1 =: 7&o.
> 
> If you use this definition, then the above statement is not 
> true.  In
> fact, (tanh1 0.2 + T) is still not exactly one.  This is 
> similary to
> what I get if I use the tanh function in the GNU libc, which is
> supposed to be very precise, so I assume that for such large values,
> tanh1 gives a more precise result than your tanh function (the
> difference is minute of course).
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to