1. Test should pass? SunOS

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 

new topic     » topic index » view message » categorize

2. Re: Test should pass? SunOS

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 message » categorize

3. Re: Test should pass? SunOS

I just wanted to suggest that perhaps a more sensible test might be:

test_true( "Avagadro #1", abs(6.022141 * power(10,23) - scientific_to_atom("6.022141e23"))<1e8 ) 

aside: 1e8 might look like a massive error margin, but of course it is tiny relative to 1e23 (and in fact one millionth of one millionth of 0.1%).

Pete

EDIT: I now realize it may be impossible to replicate the precise floating point rounding modes on a completely different chip.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Test should pass? SunOS

agrellum@claudville:~$ dmesg | grep cpu[0,1] 
 
Sep 17 17:58:50 claudville unix: [ID 950921 kern.info] cpu0: x86 (chipid 0x0 AuthenticAMD 200F31 family 17 model 3 step 1 clock 2100 MHz) 
Sep 17 17:58:50 claudville unix: [ID 950921 kern.info] cpu0: AMD Athlon Dual-Core QL-64 
Sep 17 17:58:50 claudville unix: [ID 950921 kern.info] cpu1: x86 (chipid 0x0 AuthenticAMD 200F31 family 17 model 3 step 1 clock 2100 MHz) 
Sep 17 17:58:50 claudville unix: [ID 950921 kern.info] cpu1: AMD Athlon Dual-Core QL-64 
Sep 17 17:58:50 claudville unix: [ID 557947 kern.info] cpu1 initialization complete - online 
 
agrellum@claudville:~$ cat confused.ex  
 
include std/unittest.e 
include std/scinot.e 
include std/convert.e 
 
test_equal( "Avagadro #1", 6.022141 * power(10,23), scientific_to_atom("6.022141e23") ) 
 
? atom_to_float32( (6.022141 * power(10,23))) 
? atom_to_float32( (scientific_to_atom("6.022141e23"))) 
 
? atom_to_float64( (6.022141 * power(10,23))) 
? atom_to_float64( (scientific_to_atom("6.022141e23"))) 
 
agrellum@claudville:~$ eui confused.ex  
 
  failed: Avagadro #1, expected: 6.022141e+23 but got: 6.022141e+23 
{47,12,255,102} 
{47,12,255,102} 
{245,188,168,223,133,225,223,68} 
{244,188,168,223,133,225,223,68} 
agrellum@claudville:~$  

new topic     » goto parent     » topic index » view message » categorize

5. Re: Test should pass? SunOS

agrellum said...

agrellum@claudville:~$ dmesg | grep cpu[0,1] 
 
Sep 17 17:58:50 claudville unix: [ID 950921 kern.info] cpu0: x86 (chipid 0x0 AuthenticAMD 200F31 family 17 model 3 step 1 clock 2100 MHz) 
Sep 17 17:58:50 claudville unix: [ID 950921 kern.info] cpu0: AMD Athlon Dual-Core QL-64 
Sep 17 17:58:50 claudville unix: [ID 950921 kern.info] cpu1: x86 (chipid 0x0 AuthenticAMD 200F31 family 17 model 3 step 1 clock 2100 MHz) 
Sep 17 17:58:50 claudville unix: [ID 950921 kern.info] cpu1: AMD Athlon Dual-Core QL-64 
Sep 17 17:58:50 claudville unix: [ID 557947 kern.info] cpu1 initialization complete - online 

Can you do a uname -a to confirm that the OS arch matches the CPU arch?

and a file `which eui` to confirm that the eui arch matches the OS arch?

agrellum said...

agrellum@claudville:~$ cat confused.ex  
 
include std/unittest.e 
include std/scinot.e 
include std/convert.e 
 
test_equal( "Avagadro #1", 6.022141 * power(10,23), scientific_to_atom("6.022141e23") ) 
 
? atom_to_float32( (6.022141 * power(10,23))) 
? atom_to_float32( (scientific_to_atom("6.022141e23"))) 
 
? atom_to_float64( (6.022141 * power(10,23))) 
? atom_to_float64( (scientific_to_atom("6.022141e23"))) 
 
agrellum@claudville:~$ eui confused.ex  
 
  failed: Avagadro #1, expected: 6.022141e+23 but got: 6.022141e+23 
{47,12,255,102} 
{47,12,255,102} 
{245,188,168,223,133,225,223,68} 
{244,188,168,223,133,225,223,68} 
agrellum@claudville:~$  

Ok, try atom_to_float80().

new topic     » goto parent     » topic index » view message » categorize

6. Re: Test should pass? SunOS

agrellum@claudville:~$ uname -a 
SunOS claudville 5.11 illumos-ed992b0aac i86pc i386 i86pc 
 
In .bashrc now 
export PATH=$PATH:$HOME/NetRexx-3.05GA/bin:$HOME/euphoria/bin 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/euphoria/lib 
 
FLOAT80 is different: 
{0,168,231,69,253,46,12,255,77,64} 
{0,160,231,69,253,46,12,255,77,64} 
 
config.gnu used in building 
# File generated from configure 
CONFIGURE_PARAMS=--prefix=/export/home/agrellum --arch x86 
 
EHOST=EBSD 
PREFIX=/export/home/agrellum 
EREL_TYPE=-DEREL_TYPE="development" 
ROOTDIR=/export/home/agrellum/SunOS/euphoria 
EBSD=1 
EUPHORIA=1 
 
TRANSLATE=eui /export/home/agrellum/SunOS/euphoria/source/euc.ex 
ETARGET=EBSD 
ARCH=ix86 
MSIZE=-m32 
CC_SUFFIX=gcc 
SCP=scp -C 
SSH=ssh -C 
HG=hg 
TRUNKDIR=/export/home/agrellum/SunOS/euphoria 
SOURCEDIR=/export/home/agrellum/SunOS/euphoria/source 
BUILDDIR=/export/home/agrellum/SunOS/euphoria/source/build 
CYPTRUNKDIR=/export/home/agrellum/SunOS/euphoria 
CYPBUILDDIR=/export/home/agrellum/SunOS/euphoria/source/build 
XLTTARGETCC=gcc 
VERSION=4.1.0 
 
Files patched for BUILD 
 
Makefile.gnu 
 
ifeq "$(EBSD)" "1" 
  LDLFLAG=-lresolv -lnsl -lsocket 
 
buildsys.e 
 
			elsif TBSD then 
				l_flags &= " -lm -lpthread -lresolv -lnsl -lsocket" 
 
be_machine.c 
 
Copied lines 63 to 67 """workaround for ARM not recognizing INFINITY""" 
#ifdef __sun 
#ifndef INFINITY 
#define INFINITY (1.0/0.0) 
#endif  
#endif 
 
be_rterror.c 
 
#ifdef EUNIX 
#include <sys/ioctl.h> 
#include <unistd.h> 
#  ifdef __sun 
#    include <sys/termios.h> 
#  endif 
#endif 
 

new topic     » goto parent     » topic index » view message » categorize

7. Re: Test should pass? SunOS

It means there is disagreement but only in the last least significant bit. When displayed the difference cannot be seen you would need to display about 20 digits to see it but it's there. I don't think this test reveals anything that should cause a problem in software. It would be better if people focus on other problems for getting Euphoria ready for SunOS. It might be that all of the problems are like this one and everything just works.

The 'make test' also makes a test-report.html file in the build directory. It's a good way of showing all of the problems a build is having.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu