This is how JWithATwist handles the same situation:

{ |<. 0.5 + 10 ^ 14 }
 100000000000000
{ |<. 0.5 + 10 ^ 15 }
 1000000000000000
{ |<. 0.5 + 10 ^ 16 }
Domain error
{ |>. 0.5 + 10 ^ 14 }
 100000000000001
{ |>. 0.5 + 10 ^ 15 }
 1000000000000001
{ |>. 0.5 + 10 ^ 16 }
Domain error

No ones invented. No data loss. Domain error if you use Floor or Ceiling on a double when precision is higher than 1.

/Erling


On 2016-08-22 10:16, Erling Hellenäs wrote:
0j3 ": 0.5+10^14

100000000000000.500

The strange result under discussion. How does J create this result?

0j3 ": <. 0.5+10^14

100000000000001.000

I must admit I don't understand why this happens. It is loss of precision?

0j3 ": 0.5+10^15

1000000000000000.500

Here we have loss of precision:

0j3 ": 0.5+10^16

10000000000000000.000

/Erling


On 2016-08-20 19:38, Raul Miller wrote:
If loss of precision is a problem, you should be using extended precision
numbers (or rationals) for your values.

And, of course, you should be careful to use operations whose results are
extended precision numbers (or rationals) for the values you are working
with.

For example:

    <.1r2+10^13x

10000000000000


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

Reply via email to