bug-gmp
[Top][All Lists]
Advanced

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

GMP bug - mpf_get_str for very small numbers [read this, not former1]


From: Rezac David
Subject: GMP bug - mpf_get_str for very small numbers [read this, not former1]
Date: Tue, 8 May 2001 19:19:59 +0200 (CEST)

Hello again!

I'm very sorry for the previous letter. That one is probably the most
impossible ever. I don't know what I was thinking when I was writing that.
I mixed few things together, so now I send something [hopefully] better.

The problem is with numbers that are very small. Like in this example:

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

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

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

>From what I found out, the exponent is stored in long int, and I haven't
noticed any detection of its over-/under-flow. [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?]. Well might it be that way
or another, the point is that the extreme values are not handled properly
[as it seems to me].

Well, I hope I didn't messed things again and that this will help you to
fix the problem.

Thank you for your patience.

With regards,
David Rezac

P.S.: the code of the machar() function [determines the info about the FP
arithmetics] is in the book "Numerical Recipes in C", chapter 20-1. It's
available in .ps on web [don't remember the URL, try www.google.com].

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





reply via email to

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