Hi all !

As I see it when you write a complex system it is not easy to know what values different variables can take. A language with automatic type conversions makes this problem even more complex. Maybe when you designed and tested the system the variable had the type you intended. In production the user enters a value which causes the variable to be of a different type in which the loss of precision might occur, in which you can get memory full, in which the calculation is suddenly extremely slow, in which you get an exception or in which you get an unexpected NaN or infinite result. Since I did not investigate all these possibilities I just posed an open question about if this is relevant to the discussion. If the programmer controls the type he can be held accountable, when he does not he obviously still is held accountable, but the responsibility is harder to take and the resulting code might be more error prone. Errors in production might well be serious and can cause things like loss of life.

I'll be back about the strange ones J invented.

Cheers,

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

Reply via email to