Kip Murray wrote:
> 
> [...]
> 
>     NB. The culprit appears to be
> 
>     1 o. o. 1
> 1.22465e_16
> 
> [...]
> 
>     NB. Sometimes I think verb "clean" should be incorporated
>     NB. in the elementary functions!  Maybe just in 1&o. and 2&o.
>     NB. The TI-83 calculator gives "clean" results for i^2 and e^(i pi).
> [...]
> 
Don't do it Kip.  :) 
Imagine that J cleans its results as you suggest--you would not
have found this tiny error at all.

You can always get "cleaner" results by changing the print formating.

Furthermore, floating point rules are strict:

Imagine that you have a single precision number in x 
and a double precision number in y.  Both are accurate
to the last bit.  Now you want to multiply them.  

Which of the following two calculations would give you
more accurate result:
(a) Extending x to double precision then do double precision * with y,
or
(b) Chopping/rounding y to the single precision then do single 
precision * with x?

The answer is that they both give you the result accurate only to the 
single precision.  The rest of bits of mantissa of the result in (a) is 
considered garbage.

-- 
View this message in context: 
http://www.nabble.com/xmonad--was-Re%3A--Jprogramming--tail-recursion-TCO---tp23636312s24193p23662031.html
Sent from the J Chat mailing list archive at Nabble.com.

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

Reply via email to