<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 12, 2019 at 7:03 PM Karel <<a href="mailto:horakk@math.cas.cz">horakk@math.cas.cz</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Luigi,<br>
<br>
the following code<br>
<br>
beginfig(0);<br>
path s;<br>
s:=fullcircle scaled 30mm;<br>
for k=0 upto 18: draw origin--point(arctime ((k/36)*arclength s) of s) <br>
of s; endfor<br>
endfig;<br>
end<br>
<br>
gives very strange results when used with<br>
numbersystem=decimal or binary (mpost 2.00 for TeXlive 2019).<br>
<br></blockquote><div><br></div><div><br></div><div><div>if numbersystem="decimal":</div><div> numberprecision:=8;</div><div>fi;</div><div>if numbersystem="binary":</div><div> numberprecision:=8;</div><div>fi;</div><div>beginfig(0);<br></div><div>path s;</div><div>s:=fullcircle scaled 30mm;</div><div>%tracingall;</div><div>message "==> " & decimal(arclength s);</div><div>for k=1 upto 1: </div><div>message "==> " & decimal(arctime((1/1)*arclength s) of s);</div><div>%%draw origin--point(arctime ((k/36)*arclength s) of s) of s; </div><div>endfor</div><div>endfig;</div><div>end.</div></div><div><br></div><div><br></div><div>In mp.w :<br></div><div><div>static void mp_get_arc_time (MP mp, mp_number *ret, mp_knot h, mp_number arc0_orig)<br></div><div>:</div><div><br></div><div><div> if (q == h) { </div><div> @<Update |t_tot| and |arc| to avoid going around the cyclic</div><div> path too many times but set |arith_error:=true| and |goto done| on</div><div> overflow@>; </div></div><div><br></div><div>@ @<Update |t_tot| and |arc| to avoid going around the cyclic...@>= <br></div><div>if (number_positive(arc)) { <br></div><div><br></div><div>when q==h</div><div>decimal arc = 0.000004<br></div><div>scaled: arc = 0</div></div><div>This gives </div><div>if (number_positive(arc)) true for decimal and false for scaled, so we return with different times.<br></div><div><br></div><div>I don't know if it's correct -- iirc this algorithm was designed for scaled so different using numbersystems can give different results --<br></div><div>or if it's not robust even for scaled.</div></div><div dir="ltr"><br></div><div>Try for example with </div><div dir="ltr"><div dir="ltr">if numbersystem="decimal":</div><div dir="ltr"> numberprecision:=4;</div><div dir="ltr">fi;</div><div><br></div></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature">luigi<br></div></div></div></div></div></div></div></div>