RE: Math crashes with translated programs (Rob?)
- Posted by Andy Serpa <renegade at earthling.net> Jun 13, 2002
- 460 views
rolf.schroeder at desy.de wrote: > Hi Andy, > > I didn't get 0 with the interpreter! Correctly it reports: > > tst.ex:5 > math function overflow error > --> see ex.err > Really? Maybe it is a processor thing. Do you have an Intel? > By the way: 0.05^-300.784 = 20^300.784 (~ 10^400) which is clearly not > representable as IEEE 64 fp. So, the overflow is correctly reported. Do > you expect +inf or something similar? > I frankly wouldn't know to expect. My program generates RANDOM mathematical expressions. They are all legal syntactically, but it is up to me to use "safe" functions to keep everything in bounds so it won't crash. It is just a pain to debug your program using the interpreter, then translate it and have it crash. I'm not saying it is Euphoria's fault. So I need a COMPLETE safe_power() function, it seems, that will protect me from overflows from any possible atoms (integer or floating point, positive or negative) used for base and exponent. Anyone? -- Andy > Andy Serpa wrote: > > ... > > BTW, I double-checked on that other anomaly. Using this code: > > > > atom x > > > > x = power(.02,-300.784) > > ? x > > > > I get the result 0 with the interpreter. Tranlated with Watcom, I get > > an overflow. With Borland, I get a msgbox that says overflow, then it > > prints "INF". With LCC, it prints "1.#INF". Same results on two > > different processors -- AMD k6-2 & and a brand new AMD Athlon 1800... > > >