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

2018-11-19 Thread Dennis Clarke
On 11/19/18 4:59 AM, Torbjörn Granlund wrote: [moved from gmp-devel] Richard Biener writes: For #include int main() { _Complex double x; __real x = 3.09126495087690770626068115234375e+8; __imag x = -4.045689747817175388336181640625e+8; volatile _Complex

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

2018-11-19 Thread Vincent Lefevre
On 2018-11-19 15:26:00 +0100, Richard Biener wrote: > On Mon, 19 Nov 2018, Vincent Lefevre wrote: > > 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). > > G

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

2018-11-19 Thread Dennis Clarke
On 11/19/18 5:40 AM, Torbjörn Granlund wrote: Richard Biener writes: > __real x = 3.09126495087690770626068115234375e+8; > __imag x = -4.045689747817175388336181640625e+8; > volatile _Complex double y = ctan (x); > return 0; > } > > If we get a test case s

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

2018-11-19 Thread Richard Biener
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”

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

2018-11-19 Thread Richard Biener
On Mon, 19 Nov 2018, Niels Möller wrote: > Vincent Lefevre 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 > f

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

2018-11-19 Thread Vincent Lefevre
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 da

Re: [Mpc-discuss] Bug in gmp/mpfr/mpc, never ending ctan computation

2018-11-19 Thread Andreas Enge
Hello all, On Mon, Nov 19, 2018 at 12:37:16PM +0100, Torbjörn Granlund wrote: > I'll leave this up to the mpc maintainers. indeed I suggest to continue the discussion only on the mpc mailing list; this is clearly not a bug of gmp. > > I simplified your test case using 1 as the real part and an

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

2018-11-19 Thread Niels Möller
Vincent Lefevre 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#

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

2018-11-19 Thread Vincent Lefevre
On 2018-11-19 11:14:49 +0100, Richard Biener wrote: [...] > Breakpoint 1, mpc_tan (rop=0x7fffdd50, op=0x7fffdd50, rnd=0) > at /space/rguenther/src/svn/trunk2/mpc/src/tan.c:189 > 189 prec += mpc_ceil_log2 (prec) + err; > $29 = 303084 > $30 = 303084 > ... > > So somehow err end

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

2018-11-19 Thread Vincent Lefevre
On 2018-11-19 12:49:12 +0100, Richard Biener wrote: > I see. So I guess one issue might be that mpfr numbers have a > precision (mantissa bits?) but no restriction on the exponent? MPFR has a bounded (user configurable) exponent range, with underflow and overflow exceptions for out-of-range resul

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

2018-11-19 Thread Richard Biener
On Mon, 19 Nov 2018, Torbjörn Granlund wrote: > Richard Biener writes: > > :/ But then with GCC we want deterministic behavior -- ISL > added some "computation budget" and error reporting if that was > taken up. Maybe gmp/mpfr/mpc could consider adding such a thing > (reporting budget

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

2018-11-19 Thread Torbjörn Granlund
Richard Biener writes: :/ But then with GCC we want deterministic behavior -- ISL added some "computation budget" and error reporting if that was taken up. Maybe gmp/mpfr/mpc could consider adding such a thing (reporting budget overruns via a signal could be acceptable if the API chur

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

2018-11-19 Thread Torbjörn Granlund
t...@gmplib.org (Torbjörn Granlund) writes: I simplified your test case using 1 as the real part and an integer for the imaginary part. With the real part set to 1, the computation finishes in about 10 seconds, with every doubling of it the runtime almost triples. (If my observation

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

2018-11-19 Thread Richard Biener
On Mon, 19 Nov 2018, Torbjörn Granlund wrote: > Richard Biener writes: > > > __real x = 3.09126495087690770626068115234375e+8; > > __imag x = -4.045689747817175388336181640625e+8; > > volatile _Complex double y = ctan (x); > > return 0; > > } > > > > If we get a

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

2018-11-19 Thread Torbjörn Granlund
Richard Biener writes: > __real x = 3.09126495087690770626068115234375e+8; > __imag x = -4.045689747817175388336181640625e+8; > volatile _Complex double y = ctan (x); > return 0; > } > > If we get a test case somewhat closer to GMP, then it is likely > somebody

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

2018-11-19 Thread Richard Biener
On Mon, 19 Nov 2018, Torbjörn Granlund wrote: > [moved from gmp-devel] > > > Richard Biener writes: > > For > > > #include > > > int main() > { > _Complex double x; > __real x = 3.09126495087690770626068115234375e+8; > __imag x = -4.045689747817175388336181640625e+8; >

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

2018-11-19 Thread Torbjörn Granlund
[moved from gmp-devel] Richard Biener writes: For > #include > int main() { _Complex double x; __real x = 3.09126495087690770626068115234375e+8; __imag x = -4.045689747817175388336181640625e+8; volatile _Complex double y = ctan (x); return 0; } If we get a test c