IonicWind Software

Aurora Compiler => General Discussion => Topic started by: kryton9 on August 16, 2006, 08:38:01 PM

Title: int()
Post by: kryton9 on August 16, 2006, 08:38:01 PM
I want to use something like a normal int() function. Can't seem to get it to work.

I have a float vector and want to make it an int to check for this:

if ( int(cDir.z) < 0) do stuff here;

I read about using a u, but not sure how to do that in this case?
Title: Re: int()
Post by: Ionic Wind Support Team on August 16, 2006, 08:49:27 PM
Don't need the INT in this case since you can test for 0.  Unless your really looking for -1 or less.

I did post a couple of functions in tips and tricks that do the same thing as INT did in IBasic.
Title: Re: int()
Post by: Ionic Wind Support Team on August 16, 2006, 08:50:25 PM
http://www.ionicwind.com/forums/index.php?topic=525.0
Title: Re: int()
Post by: kryton9 on August 16, 2006, 08:54:22 PM
I test for zero but being a float when I make an adjustment it never seems to hit just 0 exactly and keeps rotating. Getting frustrated, going to work on seomthing else, maybe that will help and I can figure it all out. Thanks anyways.
Title: Re: int()
Post by: Ionic Wind Support Team on August 16, 2006, 09:15:09 PM
When working with floating point numbers always use an epsilon value instead of an equality test for zero.

if(abs(a) < .0001)
    //close enough to zero

The epsilon range is your choice but in most calculations you will never end up with an exact equality from the FPU.