Bug in gmp/mpfr/mpc, never ending ctan computation

Richard Biener rguenther at suse.de
Mon Nov 19 13:53:26 UTC 2018


On Mon, 19 Nov 2018, Niels Möller wrote:

> Vincent Lefevre <vincent at vinc17.net> writes:
> 
> > MPFR has a bounded (user configurable) exponent range, with underflow
> > and overflow exceptions for out-of-range results, like in IEEE 754.
> 
> Good! I didn't find that in the manual until I knew the phrase to search
> for. It's in
> https://www.mpfr.org/mpfr-current/mpfr.html#Exception-Related-Functions,
> and relevant functions are mpfr_set_emin, mpfr_set_emax and mpfr_subnormalize.
> 
> You might want to add an entry for "Exponent range" to the concept index
> in the manual.

Indeed I didn't find these functions either ...

> I guess gcc should set things up similarly to the example on that page,
> "This is an example of how to emulate binary double IEEE 754
> arithmetic", with the caveat "This emulates a double IEEE 754 arithmetic
> with correct rounding in the subnormal range, which may not be the case
> for your hardware".

OK, GCC doesn't use those, for the testcase if I set emax/emin to the
range from 128bit IEEE then the folding finishes quickly.

It looks like emin/emax is global and not per mpfr_t so for GCC we
have to jump through some additional hoops.  I'll see to adjust
GCC to set the limits based on the maximum range ever needed
(largest FP mode supported by the target) and look for fallout.

Richard.

> Regards,
> /Niels
> 
> 

-- 
Richard Biener <rguenther at suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)


More information about the gmp-bugs mailing list