[metapost] Accuracy of numbersystem double

Taco Hoekwater taco at elvenkind.com
Tue Feb 11 10:00:00 CET 2014


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 ?

Best wishes,
Taco




More information about the metapost mailing list