<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 17, 2020 at 4:09 PM luigi scarso <<a href="mailto:luigi.scarso@gmail.com">luigi.scarso@gmail.com</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"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 6, 2020 at 8:28 PM Martin Budaj <<a href="mailto:m.budaj@gmail.com" target="_blank">m.budaj@gmail.com</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">Hi,<br>
<br>
when using numbersystems other than scaled, the following example<br>
fails to calculate the bounding box of an empty label (MetaPost<br>
version 2.00):<br>
<br>
beginfig(1);<br>
 path q;<br>
 q:=bbox thelabel("",(0,0));<br>
 message "BBOX: " & decimal xpart llcorner q & " " &<br>
                    decimal ypart llcorner q & " " &<br>
                    decimal xpart urcorner q & " " &<br>
                    decimal ypart urcorner q;<br>
endfig;<br>
end<br>
<br>
The results are:<br>
<br>
scaled (OK, as bboxmargin is 2bp):<br>
    BBOX: -2 -2 2 2<br>
decimal:<br>
    BBOX: -2 -1E+1000000 2 1E+1000000<br>
binary:<br>
    BBOX: -2 -9.999999999999999999999999999999999E+999999 2<br>
9.999999999999999999999<br>
999999999999E+999999<br>
double:<br>
    ! Arithmetic overflow.<br>
<br>
Best regards<br>
Martin<br>
--<br>
<a href="http://tug.org/metapost/" rel="noreferrer" target="_blank">http://tug.org/metapost/</a><br>
</blockquote></div><div><br></div>hm, in mp_set_text_box<div><br></div><div><div>@<Set the height and depth to zero if the bounding box is empty@>=<br>if (number_to_scaled(p->height) < -number_to_scaled(p->depth)) {<br>  set_number_to_zero(p->height);<br>  set_number_to_zero(p->depth);<br>}<br></div><div><br></div><div>works only for scaled mode, the others  skip the test  because number_to_scaled  doesn't work if the value is neg_inf.</div><div>I am doing some tests.</div><div><br></div></div></div></blockquote></div><div><br></div><div>ok, fixed. I will commit this weekend.</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">luigi<br></div></div>