IonicWind Software

Aurora Compiler => Coding Help - Aurora 101 => Topic started by: kibalab on October 30, 2007, 08:46:52 AM

Title: Convert int to double?
Post by: kibalab on October 30, 2007, 08:46:52 AM
How to convert a int to double?
I have 2 integer var and 1 double var.

Now I want to do this:  myDouble = myInt1 / myInt2;

But the result is still integer!
What to do?
Title: Re: Convert int to double?
Post by: talun on October 30, 2007, 09:47:32 AM
Hi, I'm not an Aurora expert but the sample below seems to work


global sub main( )
{
   double myDouble;
   int myInt1, myInt2;

   myInt1 = 123;
   myInt2 = 456;
   myDouble = myInt1 / (myInt2*1.0);

   print (using("#.######",myDouble));
   print("press any key to close");
   While GetKey() = "";

}


Please let me know if I'm wrong

bye

Sergio
Title: Re: Convert int to double?
Post by: kibalab on October 30, 2007, 09:55:35 AM
Thank you, the "*1.0" did it  :D