bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GMP bug - mpf_get_str for very small numbers


From: Kevin Ryde
Subject: Re: GMP bug - mpf_get_str for very small numbers
Date: 11 May 2001 08:57:17 +1000
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.5

Rezac David <address@hidden> writes:
>
> I've tried to run the 'machar()' function which gets some detailed info
> about the FP aritmetics

Not sure if mpf is tight enough at the edges to stand probing for its
limits.

>   a = "1e-2147483640";
>   cout << a << "\n";    //works's
>   a=a*a;
>   cout << a << "\n";    //doesn't

If that's 10^-(2^31) then it should be in range and should work.

> In the function mpf_get_str() [file mpf/get_str.c] some asserts fail
> and the conversion kills the program.
> 
> The output is:
>  0.1e-2147483639
> get_str.c:374: GNU MP assertion failed: tstr[0] != 0
> Ended with failure (SIGABRT) (core dumped)

I'm unable to reproduce that, please put together a small test program
to exhibit it.

> When I use "1e+214783640" in the same code, the exponent becomes negative
> but no assertion-related problems show up. [Well, don't mention that the
> result is unusable~]

Oh, is this base 2^32?  You can expect problems near the exponent
limits (+/-2^31 limbs).

> From what I found out, the exponent is stored in long int, and I
> haven't noticed any detection of its over-/under-flow.

That's because there isn't any detection.  :)

> [Of course that when it underflows, the number should go to 0.0, not
> infinity as I wrote. To +/-infinity it goes when it overflows,
> right?].

Underflow could go to a NaN maybe, as an option, just so it doesn't
happen silently.  Something like that might be implemented in the
future, or maybe just an exception trap.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]