RE: Math crashes with translated programs (Rob?)

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

> 
> Yes, you've found a Translator bug. Thanks for reporting it.
> 
I knew I could find one!  Do I get a prize?


> The C code generated by the Translator is wrong
> in the 3rd case, so it doesn't matter which C compiler
> you use, you will get a crash or a failure of some kind.
> 
> It seems the Translator let its guard down, and wasn't
> expecting that two integer values would result in a number
> greater than Euphoria's 31-bit integers at this particular
> point in the code. You can work around the bug by adding
> ".0" to one or more of the numbers involved in the last
> calculation, e.g. replace:
>     x = x * 1000
> by
>     x = x * 1000.0
> 
Ok, good to know I can get around it for now.  But how do I get around 
it when the 1000 is an a variable (an atom)?

y = 1000
x = x * y

How about this?

x = x * (y + 0.0) 

or 

y = y + 0.0, then x = x * y


Is there any easy way to force all atoms to be considered floats?

Is this a problem for any calculation involving two integers (like 
addition), or just multiplication?

Can we get a quick patch on this, or will it be a long time?


> > BTW, here's another one that I came across while trying to make a 
> > safe_power() function of my own: power(.02,-300.24) gives a 0 in the 
> > interpreter and a math overflow error translated with Watcom.  The 
> > problem seems to be the decimal as it works ok with just -300. ???
> 
> On my machine, using WATCOM 10.6, I get a math overflow
> error with both the interpreter and the Translator with WATCOM,
> and it doesn't matter if I use -300.24 or -300. So it's consistent.
> I wonder if you are using a different version of WATCOM, and
> if you have a different CPU. I have a 350MHz Pentium II. (although
> I just got a Pentium 4 yesterday smile)
> 
I think it fails on both my machines here, but I haven't checked out 
that case thoroughly, nor have I tried it on Borland or LCC. I don't 
know what version of Watcom I have (sort of) because I got it via 
Euman's method of downloading the 11.x patch, and then filling in the 
libraries via Hutch's Masm32, so it may just be a little off, or could 
be a processor thing...

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

Search



Quick Links

User menu

Not signed in.

Misc Menu