Re: New numbersystems strange behaviour of arclength
luigi scarso <[email protected]> Wed, 13 Mar 2019 09:49:31 +0100
| Newsgroups | gmane.comp.tex.metapost |
|---|---|
| Message-ID | <CAG5iGsAOW1Wy5PiJjM2ihq-5pbLd_q0oAE9VXD7vCx66bx1TuQ@mail.gmail.com> |
On Tue, Mar 12, 2019 at 7:03 PM Karel <[email protected]> wrote: > Dear Luigi, > > the following code > > beginfig(0); > path s; > s:=fullcircle scaled 30mm; > for k=0 upto 18: draw origin--point(arctime ((k/36)*arclength s) of s) > of s; endfor > endfig; > end > > gives very strange results when used with > numbersystem=decimal or binary (mpost 2.00 for TeXlive 2019). > > if numbersystem="decimal": numberprecision:=8; fi; if numbersystem="binary": numberprecision:=8; fi; beginfig(0); path s; s:=fullcircle scaled 30mm; %tracingall; message "==> " & decimal(arclength s); for k=1 upto 1: message "==> " & decimal(arctime((1/1)*arclength s) of s); %%draw origin--point(arctime ((k/36)*arclength s) of s) of s; endfor endfig; end. In mp.w : static void mp_get_arc_time (MP mp, mp_number *ret, mp_knot h, mp_number arc0_orig) : if (q == h) { @<Update |t_tot| and |arc| to avoid going around the cyclic path too many times but set |arith_error:=true| and |goto done| on overflow@>; @ @<Update |t_tot| and |arc| to avoid going around the cyclic...@>= if (number_positive(arc)) { when q==h decimal arc = 0.000004 scaled: arc = 0 This gives if (number_positive(arc)) true for decimal and false for scaled, so we return with different times. I don't know if it's correct -- iirc this algorithm was designed for scaled so different using numbersystems can give different results -- or if it's not robust even for scaled. Try for example with if numbersystem="decimal": numberprecision:=4; fi; -- luigi -- http://tug.org/metapost/