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: Rezac David
Subject: Re: GMP bug - mpf_get_str for very small numbers
Date: Tue, 15 May 2001 13:23:48 +0200 (CEST)

Hello again!
I'm sending that small demo program that shows the error.

I hope it will help a bit.

Oh,...I have this:
* Redhat 7.0
* Celeron CPU
* gcc 2.96


If you'd need anything else [rpm versions or so], don't hesitate and
write, I'll surely find a moment to answer.

With regards,
David Rezac



On 11 May 2001, Kevin Ryde wrote:

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


                                                     Zdravi Dave

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
                    E-mail:          address@hidden
                                     address@hidden
                                     address@hidden
                    WWW home page:   http://www.stud.fee.vutbr.cz/~xrezac01
                                     http://www.sweb.cz/Rezac.David/
                                     http://davidr.kgb.cz/
                    ICQ:             68387449
-------------------------------------------------------------------------------
Any spam sent to my email will be rewarded by complaint to your ISP abuse
  team and abuse teams of servers that relayed that message. It works.

Attachment: demo.cc
Description: demo.cc


reply via email to

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