dly <[EMAIL PROTECTED]> wrote:
> So constants in J are strictly a memory aid and are otherwise treated  
> as any other variable?  What a waste!

Remember that J (like most programming languages, and unlike
symbolic mathematical languages like Maple and Mathematica) is
designed for reasonable efficiency in calculations, rather than
absolute mathematical accuracy. When you want to calculate,
say, billing information for a million customers, it is more important
to be able to perform the calculation in a reasonable amount of time
to an accuracy of a fraction of a cent, rather than to take a year of
CPU time to make sure that each one is accurate to an infinite number
of decimal places. J's primary focus is the solving of practical problems,
rather than being the end-all solution for abstract mathematical
equations (something that symbolic languages are more suitable for).

J peforms all its real calculations using efficient data types (machine
integers and real number supported directly by the underlying hardware).
If you want more precision, there are the extended and rational types
provided to assist you (although to use them to obtain arbitrarily accurate
approximations to irrational values, you have to do some of the additional
work yourself).

So, in J, mnemonics like 1p1 mean "as close to Pi as possible (given the
architectural constraints)." This is the same meaning for Pi used by all
other computing languages, desk calculators, etc. - other than places
where symbolic math is performed. It would be quite burdensome on J
if it had to have an additional data type to mean "exact representations
of transcendental irrationals" - even if it did, the number of places in the
language where such values could provide any kind of additional use
which is more accurate than the current values is very limited.

1 2 3 o. 1p1*k NB. for any integer k
^.1x1*k NB. for any integer k

Can you think of any others? Adding such an albatross to the language
so that two (2) expressions happen to yield exact integers, rather than
being off in the 16th binary place would be unjustifiable.

-- Mark D. Niemiec <[EMAIL PROTECTED]>

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

Reply via email to