Roger Hui wrote:
> I don't understand something here:
>
>    y=: 100
>    n=: <.0.5*y% ^.2
>    (2^n)*^y-n*^.2
> 2.68812e43
>    ^ y
> 2.68812e43
>    y-n*^.2
> 50.0934
>
> But 50.09 requires more than "relatively few terms"
> of the Taylor series, and (at least in this case)
> y-n*^.2 does not involve subtracting nearly equal
> quantities.
>
Mathematically, n is y%^.2 rounded to the nearest integer, so
0.5:>|n-y%^.2 , and ^.2:|y-n*^.2 , and only a few Taylor series terms
are needed.  For large y, you need to use a value of ^.2 to higher
precision than 64 bits, otherwise you will get the loss of
significance you observe.

John


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to