A modest proposal
Toby Thurston <[email protected]>
| Newsgroups | gmane.comp.tex.metapost |
|---|---|
| Message-ID | <[email protected]> |
Now that the higher precision number systems are maturing, and being used more, it might be a good time to update "plain.mp" to remove the hard coded 5-figure decimals. In all cases it's fairly easy to find an equivalent definition which would work accurately at full numeric precision regardless of which engine is being used. The values I can see are > eps := .00049; % this is a pretty small positive number > infinity := 4095.99998; % and this is the largest > > . > . > . > > %% units of measure > > mm=2.83464; pt=0.99626; dd=1.06601; bp:=1; > cm=28.34645; pc=11.95517; cc=12.79213; in:=72; > > vardef magstep primary m = mexp(46.67432m) enddef; The definition of epsilon shows us a better way > epsilon := 1/256/256; % but this is the smallest Adopting that strategy we can write the following which work well regardless of number system eps := 1/2048; infinity := 64*64-epsilon; The units require a little bit more thought (and a quick reference to the Texbook for "dd"), but nevertheless here are some exact definitions that would also work with all number systems 1 = 1 bp; 72 = 1 in; 800 = 803 pt; 360 = 127 mm; 3600 = 127 cm; 1 pc = 12 pt; 1 cc = 12 dd; 1157 dd = 1238 pt; Finally for magstep we could have vardef magstep primary m = mexp(mlog(1.2)*m) enddef; Any thoughts? Could these be changes in the next version of plain.mp? Toby T. -- http://tug.org/metapost/