PenUltima Online

It is currently Thu Aug 28, 2008 8:42 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Bug in division by 0?
PostPosted: Thu Jun 07, 2007 7:38 am 
Offline

Joined: Fri May 26, 2006 12:53 am
Posts: 30
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?

_________________
Scripter on Faerun's Legend
www.faerunslegends.it


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl