PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
Bug in division by 0?

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> Bug Reports 097
Display posts from previous:   

Author Message
Xadhoom



Joined: 26 May 2006
Posts: 30

PostPosted: Thu Jun 07, 2007 11:38 am    Post subject: Bug in division by 0? Reply with quote

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:
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?

Post new topic   Reply to topic    PenUltima Online Forum Index -> Bug Reports 097 All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty