(14^2x) (] - [ * [: <. ] % [)5729082486784839x
147
(14^2) (] - [ * [: <. ] % [)5729082486784839
_49
(14^2) (] - [ * _1 + [: <. ] % [)5729082486784839
147
/Erling
Den 2017-09-11 kl. 15:40, skrev Erling Hellenäs:
From what I see, floor gives an incorrect result which I correct with
the " _1 + " There is not other problem. No loss of precision. /Erling
Den 2017-09-11 kl. 15:27, skrev Raul Miller:
I do not know what you are thinking, and you have not illustrated your
thoughts sufficiently for me to grasp them.
So, I thought I'd work through this:
(14^2) (] - [ * _1 + [: <. ] % [)5729082486784839
147
(14^2x) (] - [ * _1 + [: <. ] % [)5729082486784839x
343
Clearly, the exact answer is different from the quick answer.
If we compare
load'debug/dissect'
dissect '(14^2) (] - [ * _1 + [: <. ] % [)5729082486784839'
dissect '(14^2x) (] - [ * _1 + [: <. ] % [)5729082486784839x'
We can see the initial off-by-one errors, but the big difference shows
up at the end (where we subtract from 5729082486784839)
The value we are subtracting is:
(14^2x) ([ * _1 + [: <. ] % [)5729082486784839x
5729082486784496
(14^2) ([ * _1 + [: <. ] % [)5729082486784839
5.72908e15
Looking at the bits needed to represent that as an integer:
2^.(14^2) ([ * _1 + [: <. ] % [)5729082486784839
52.3472
we can see that that's right on the edge of being the number of
representable digits in a 64 bit float.
But, also, it's the result of multiplying
14^2
196
by an off-by-one amount. And...
343-196
147
...
Anyways, I'm not sure what you were thinking, but I guess we can take
this as a good example of the idea that errors can actually
accumulate.
Thanks,
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm