Re: bug in the label bbox

luigi scarso <[email protected]> Thu, 20 Aug 2020 10:20:48 +0200
Newsgroups gmane.comp.tex.metapost
Message-ID <CAG5iGsD=szLZWXe4CLe7Qgdw-S049SmdzLAf9vNxc=+FM9xpMQ@mail.gmail.com>
On Mon, Aug 17, 2020 at 4:09 PM luigi scarso <[email protected]> wrote:

>
>
> On Thu, Aug 6, 2020 at 8:28 PM Martin Budaj <[email protected]> wrote:
>
>> Hi,
>>
>> when using numbersystems other than scaled, the following example
>> fails to calculate the bounding box of an empty label (MetaPost
>> version 2.00):
>>
>> beginfig(1);
>>  path q;
>>  q:=bbox thelabel("",(0,0));
>>  message "BBOX: " & decimal xpart llcorner q & " " &
>>                     decimal ypart llcorner q & " " &
>>                     decimal xpart urcorner q & " " &
>>                     decimal ypart urcorner q;
>> endfig;
>> end
>>
>> The results are:
>>
>> scaled (OK, as bboxmargin is 2bp):
>>     BBOX: -2 -2 2 2
>> decimal:
>>     BBOX: -2 -1E+1000000 2 1E+1000000
>> binary:
>>     BBOX: -2 -9.999999999999999999999999999999999E+999999 2
>> 9.999999999999999999999
>> 999999999999E+999999
>> double:
>>     ! Arithmetic overflow.
>>
>> Best regards
>> Martin
>> --
>> http://tug.org/metapost/
>>
>
> hm, in mp_set_text_box
>
> @<Set the height and depth to zero if the bounding box is empty@>=
> if (number_to_scaled(p->height) < -number_to_scaled(p->depth)) {
>   set_number_to_zero(p->height);
>   set_number_to_zero(p->depth);
> }
>
> works only for scaled mode, the others  skip the test  because
> number_to_scaled  doesn't work if the value is neg_inf.
> I am doing some tests.
>
>
ok, fixed. I will commit this weekend.

-- 
luigi

--
http://tug.org/metapost/