[metapost] Units unaccuracy with numbersystem set to double

Franck Pastor franck.pastor at mac.com
Wed Apr 2 15:07:07 CEST 2014

Le 2 avr. 2014 à 12:25, Akira Kakuto <kakuto at fuk.kindai.ac.jp> a écrit :

>> Maybe this problem has been solved in this last version.
> MetaPost 1.900 shows
> *show cm;
>>> 28.346450000000001

Thus  the same value, in fact…

> Note that MetaPost does not calculate it from an exact formula.
> It simply prints the value defined in plain.mp: cm=28.34645;

Indeed, I knew this already. My point is that I'm surprised that these values have not already been replaced in plain.mp by more accurate ones, as

cm  =  28.3464566929134;
mm = 2.83464566929134;
pt = 0.99626400996264;

and so on.

If "numbersystem" is set to double, MetaPost would make use of these more accurate values appropriately. If "numbersystem" is set to "scaled", I suppose they would be automatically rounded to their ancient values. As it happens in the examples I've made for myself. For example, if I run the following program with the default number system (scaled):

cm = 28.3464566929134; show cm;

I obtain

>> 28.34645 

So, there would be no harm whatsoever in introducing more accurate values in plain.mp for the usual units. Or at least it seems so. Maybe I'm wrong in this?

Best regards,

Franck Pastor

More information about the metapost mailing list