Long numerical tokens with new number systems

Toby Thurston <[email protected]>
Newsgroups gmane.comp.tex.metapost
Message-ID <[email protected]>
The syntax for <numeric token> that MP inherits from Metafont allows for "one or more" decimal digits in the fractional part of a number.  So it's legal to write:

numeric pi;
pi = 3.141592653589793238462643383279502884197169399375105820974944592;
show pi;

This works ok with all the number systems except "decimal" which complains about excessive precision.
Here's what I get with each number system

>> "scaled"
>> 3.14159 )

>> "double"
>> 3.1415926535897931 )

>> "binary"
>> 3.1415926535897932384626433832795028 )

>> "decimal"
! Number is too precise (numberprecision = 34).
l.80 ...643383279502884197169399375105820974944592
                                                  ;
?
>> 3.141592653589793238462643383279503 )

Doesn't this behaviour seem to be a bit inconsistent?

Clearly, with decimal it would be possible to avoid the error message by writing this sort of thing:

   if numbersystem="decimal": numberprecision := 64; fi

before defining the constant, but it would be nice to have a consistent syntax across all number systems.

One other thing that I notice is that the final digit rounding looks wrong for double and binary.

Any comments?

Thanks, Toby
--
http://tug.org/metapost/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.