Bug in division by 0?

Report core bugs regarding the Ultima Online Emulator Core release (version 097). You can attach your Core Dump. One bug per post.
Locked
Xadhoom
Neophyte Poster
Posts: 30
Joined: Fri May 26, 2006 12:53 am

Bug in division by 0?

Post by Xadhoom »

If into a script occurs a division by 0, the result is an error, and that's ok
But if the division is a Double / 0, like CDbl(5)/0, the result is "inf", which could be difficult to handle because it's not an error, but the worst thing happens if you do CDbl(0)/0, the result is "-nan".
This "number"seems to be negative, but not at all. If you multiply a positive int and -nan it gives -4000000 (int) but if you do somthing like this

Code: Select all

var res = Cdbl(0)/0; // this is -nan
if(res <0 || !res) print("yes"); endif
"yes" is never print.
It could be fixed by using CInt() if you don't need a double

Is this a bug or is it ok?
Locked