Re: Test should pass? SunOS

new topic     » goto parent     » topic index » view thread      » older message » newer message
agrellum said...

In tests, t_literals.e, why does test at line 211 fail?

test_equal( "Avagadro #1", 6.022141 * power(10,23), scientific_to_atom("6.022141e23") )

If I run it stand alone, and add print result, I see no difference.

? 6.022141 * power(10,23) 
? scientific_to_atom("6.022141e23") 

agrellum@claudville:~$ eui confused.ex  
  failed: Avagadro #1, expected: 6.022141e+23 but got: 6.022141e+23 
6.022141e+23 
6.022141e+23 

What arch is this? (x86/amd64)

std/scinot.e has a complex algorithm for computing the floating point value which was largely developed on wintel.

Can you call atom_to_floatXX() on both and output the result? I suspect that on Solaris there is a subtle rounding issue that is throwing the result slightly off - not enough to show up when printed on the screen, but one that can tell the difference when looking at the individual bits.

For a good example and explanation, see http://www.exploringbinary.com/why-0-point-1-does-not-exist-in-floating-point/

Also, for a good general overview of the nature of the problem, see http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu