Re: Bitten by a bug

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

DB James wrote:
> 
> 
> Hi,
> 
> This may be known to some others, but I wasted some time figuring this out,
> so I'm passing along the information.
> 
> There is a problem dividing atoms by a number that only showed up when the
> program
> was compiled to C.  In the process of clarifying it, I wrote this little test
> program:
> 
> --------------------------------------------
> --test.ex
> --test effect of compiling using WATCOM C/C++ Version 11.0c
> --run first without compiling, then with compiling
> integer fn
> atom x
> puts(1,"Adding data to result.txt\n\n")
> fn=open("c:\\euphoria\\result.txt","a")
> puts(fn,"Test results for values of x (set at 75 before each operation)\n\n")
> x=75
> x=x/100
> printf(fn,"With \"x=x/100\": x=%f\n",x)
> x=75
> x=x/100.0
> printf(fn,"With \"x=x/100.0\": x=%f\n",x)
> x=75
> x/=100
> printf(fn,"With \"x/=100\": x=%f\n",x)
> x=75
> x/=100.0
> printf(fn,"With \"x/=100.0\": x=%f\n",x)
> puts(fn,"\nEnd test results for values of x\n\n")
> close(fn)
> puts(1,"Done, any key...\n")
> while equal(get_key(),-1) do end while
> --------------------------------------------
> 
> The results were as follows:
> 
> First, without compiling the test program:
> 
> --------------------------------------------
> Test results for values of x (set at 75 before each operation)
> 
> With "x=x/100": x=0.750000
> With "x=x/100.0": x=0.750000
> With "x/=100": x=0.750000
> With "x/=100.0": x=0.750000
> 
> End test results for values of x
> --------------------------------------------
> 
> Then, with compiling:
> 
> --------------------------------------------
> Test results for values of x (set at 75 before each operation)
> 
> With "x=x/100": x=44169448.000000
> With "x=x/100.0": x=0.750000
> With "x/=100": x=44169452.000000
> With "x/=100.0": x=0.750000
> 
> End test results for values of x
> --------------------------------------------
> 
> Ironically, when I was trying to track down this bug, I tested for everything
> but the real culprit, so lost some time...
> 
> --Quark
> 

I tried out and tested your program with the 2.5 official translator with Open
Watcom v1.4 beta (uncompressed EXE), and the program returned appended this into
Result.txt after two runs:

Test results for values of x (set at 75 before each operation)

With "x=x/100": x=0.750000
With "x=x/100.0": x=0.750000
With "x/=100": x=0.750000
With "x/=100.0": x=0.750000

End test results for values of x

Test results for values of x (set at 75 before each operation)

With "x=x/100": x=0.750000
With "x=x/100.0": x=0.750000
With "x/=100": x=0.750000
With "x/=100.0": x=0.750000

End test results for values of x


So it seems to be working fine for me... hmm, maybe you should try a newer
version of Watcom or another supported C compiler.


Regards,
Vincent

----------------------------------------------
     ___	      __________      ___
    /__/\            /__________\    |\ _\
    \::\'\          //::::::::::\\   |'|::|
     \::\'\        //:::_::::_:::\\  |'|::|
      \::\'\      //::/  |::|  \::\\ |'|::|
       \::\'\    //::/   |::|   \::\\|'|::|
        \::\'\__//::/    |::|    \::\|'|::|
         \::\','/::/     |::|     \::\\|::|
          \::\_/::/      |::|      \::\|::|
           \::,::/       |::|       \:::::|
            \___/        |__|        \____|

 	                 .``.
		         ',,'

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

Search



Quick Links

User menu

Not signed in.

Misc Menu