[metapost] Accuracy of numbersystem double

Hans Hagen pragma at wxs.nl
Tue Feb 11 11:00:23 CET 2014


On 2/11/2014 10:00 AM, Taco Hoekwater wrote:
>
> On 10 Feb 2014, at 22:21, Daniel H. Luecking <luecking at uark.edu> wrote:
>
>>
>> I would like to know a few details of numbersystem double.
>>
>> (1) I assume a double is stored in binary format with some fixed
>> number of significant binary places. If not, I'd be pleased to
>> know that.
>
> The numbersystem ‘double’ is a standard C language ‘double’. On
> all modern systems that should translate to EEE 754 double-precision
> binary floating-point format binary64.
>
>> (2) If so, how many binary places? It seems 52, but I'd like to know for sure.
>>
>> Also, I can understand why   show X;  might round to 15 decimal
>> places, but it seems to me that there should be some way to display
>> a value with full accuracy.   decimal X  does not produce that.  In fact
>> X = scantokens decimal X  is false for the assignment
>> X := 3.1415926535897934;  in MetaPost 1.803 (TeX Live 2013/W32TeX).
>> This reduces its usefulness in debugging.
>>
>> (3) So: is there a way to display accurate values of variables in
>> numbersystem double?
>
> It would be quite straightforward to change ‘decimal’ so that it matches
> the input reader ?

that makes sense, however, if decimal is also used to write stuff to the 
ps file then we have an issue with E notation (not only for very large 
but also for very small valuea) so maybe it's better to add a new 
primitive for it

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the metapost mailing list