Opened 10 years ago

Last modified 8 years ago

#10 new defect

libduke_mr/minf_parabolic_info.py unit test results differ depending on platform

Reported by: flip Owned by:
Priority: major Milestone:
Component: libduke_mr Version:
Keywords: Cc: bsoher

Description

The unit test for minf_parabolic_info.py which returns wildly different results on OS X, Windows and Linux.
Windows = 2.16607634704e-005
OS X = -2.62861404276e-05
Linux = 2.95252603967e-05

Jeff suggested as a possible suspect the value of zeps a.k.a. the machine epsilon which is embedded in the function. zeps is set like so --

zeps = 1.e-7

Wikipedia has an article on machine epsilon and even suggests Python code for determining it. Their code is just pow(2, -24).
http://en.wikipedia.org/wiki/Machine_epsilon

However, replacing this --

zeps = 1.e-7

with this --

zeps = pow(2, -24)

as the Wikipedia article suggested didn't change the result of the function significantly. Ditto for pow(2, -53).

So while I think Jeff's instinct was a good one and that we should consider changing that code to use pow(2, -24), that doesn't fix the fact that the unit test doesn't return a positive result.

Change History (1)

comment:1 Changed 8 years ago by flip

The unit test now gives consistent results (-15.1988292988, 15) on OS X, Linux and Windows, assuming some tolerance for small floating point error. However, the comment indicates that the expected result is 2.16607634704e-005 so either the comment is wrong or the code is wrong.

Note: one must comment out the pylab calls to get the unit test to work properly.

Note: See TracTickets for help on using tickets.