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

Richard Biener rguenther at suse.de
Mon Nov 19 14:26:00 UTC 2018


On Mon, 19 Nov 2018, Vincent Lefevre wrote:

> On 2018-11-19 14:17:13 +0100, Niels Möller wrote:
> > You might want to add an entry for "Exponent range" to the concept index
> > in the manual.
> 
> The concept index already has "Exponent", and the corresponding
> paragraph is:
> 
>    An “exponent” is a component of a regular floating-point number.  Its
> C data type is ‘mpfr_exp_t’.  Valid exponents are restricted to a subset
> of this type, and the exponent range can be changed globally as
> described in *note Exception Related Functions::.  Special values do not
> have an exponent.
> 
> I think that this is quite explicit.
> 
> > 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".
> 
> AFAIK, GCC already changes the exponent range to the binary64 one
> (the lack of subnormals is not an issue, because in case of underflow,
> GCC ignores the computations done with MPFR).

GCC does ignore results in case of overflow or underflow but it
doesn't currently limit mpfrs exponent range.  Or rather most
languages don't - I do see mpfr_set_e{min,max} calls being
done in the Fortran frontend only, but only temporarily and
seemingly only to call mpfr_subnormalize.

> But for its internal computations, I assume that mpc extends the
> exponent range (if it didn't you would have the same kind of problem,
> but much more often). Here it seems that the issue is that the maximum
> supported exponent range is not large enough for the chosen algorithm
> (which may not be the right one for this kind of input).

It happens that limiting the range makes the CPOW computation fast.

Richard.

-- 
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