<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 15, 2015 at 9:52 PM, Toby Thurston <span dir="ltr"><<a href="mailto:thurston@eml.cc" target="_blank">thurston@eml.cc</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">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:<br>
<br>
numeric pi;<br>
pi = 3.141592653589793238462643383279502884197169399375105820974944592;<br>
show pi;<br>
<br>
This works ok with all the number systems except "decimal" which complains about excessive precision.<br>
Here's what I get with each number system<br>
<br>
>> "scaled"<br>
>> 3.14159 )<br>
<br>
>> "double"<br>
>> 3.1415926535897931 )<br>
<br>
>> "binary"<br>
>> 3.1415926535897932384626433832795028 )<br>
<br>
>> "decimal"<br>
! Number is too precise (numberprecision = 34).<br>
l.80 ...643383279502884197169399375105820974944592<br>
;<br>
?<br>
>> 3.141592653589793238462643383279503 )<br>
<br>
Doesn't this behaviour seem to be a bit inconsistent?<br>
<br>
Clearly, with decimal it would be possible to avoid the error message by writing this sort of thing:<br>
<br>
if numbersystem="decimal": numberprecision := 64; fi<br>
<br>
before defining the constant, but it would be nice to have a consistent syntax across all number systems.<br>
<br>
One other thing that I notice is that the final digit rounding looks wrong for double and binary.<br>
<br>
Any comments?<br>
<br>
Thanks, Toby<br>
--<br>
<a href="http://tug.org/metapost/" rel="noreferrer" target="_blank">http://tug.org/metapost/</a><br>
</blockquote></div><br><br clear="all"><div>Rev. 2070 has now a patch based on </div><div>"27 bits are not enough for 8-digit accuracy" by <span class="" style="white-space:pre"> </span>I. Bennett Goldberg<span class="" style="white-space:pre"> </span><br></div><div><br></div><div><br></div><div><br></div>-- <br><div class="gmail_signature">luigi<br></div>
</div></div>