After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 726464 - test t6501-numbers fails
test t6501-numbers fails
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Analytics
1.12.x
Other Linux
: Normal normal
: ---
Assigned To: Morten Welinder
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2014-03-16 16:45 UTC by Andrew Warshall
Modified: 2014-03-17 17:50 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andrew Warshall 2014-03-16 16:45:08 UTC
Hi-

   Minor issue --- the test t6501-numbers fails, computing log2(1) = -3.35018471298021E-17 (which is, of course, very close to 0, but not quite). glibc on my system gets it right, both using its log2 () call and using frexp () and log () as your source code does. Thanks for your attention.

              -Andrew Warshall
Comment 1 Morten Welinder 2014-03-16 17:34:13 UTC
Are you sure you have re-compiled the math plugin?  The log code was
changed recently.

Can you add print statements to gnm_log2 in mathfunc.c to see the values
of x and e?
Comment 2 Andrew Warshall 2014-03-17 14:34:47 UTC
I added

 printf ("x = %a, e = %d\n", x, e);

to gnm_log2() just before the return... line and recompiled

Now, when computing log2(1), I get on stdout 

x = 0x1p-1, e = 1

which is what it should be (if I'm understanding the source code correctly), but gnumeric still computes the same answer as before (-3.35018471298021E-17).

                        -Andrew Warshall
Comment 3 Morten Welinder 2014-03-17 17:44:36 UTC
Well, in hindsight that was obvious.  The whole idea was to get x==1 in there,
but we get 0.5

Please try adding this after the gnm_frexp call:

	if (x == 0.5)
		x = 1.0, e--;
Comment 4 Morten Welinder 2014-03-17 17:50:37 UTC
This problem has been fixed in our software repository. The fix will go into the next software release. Thank you for your bug report.