[metapost] Long numerical tokens with new number systems
thurston at eml.cc
Sat Aug 15 21:52:11 CEST 2015
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:
pi = 3.141592653589793238462643383279502884197169399375105820974944592;
This works ok with all the number systems except "decimal" which complains about excessive precision.
Here's what I get with each number system
>> 3.14159 )
>> 3.1415926535897931 )
>> 3.1415926535897932384626433832795028 )
! Number is too precise (numberprecision = 34).
>> 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.
More information about the metapost