if i make a function that simply return a double value like this
double example ()
{
double i = 999999999;
return i;
}
the output will be:
example() => 9.99999999E8
i don't know how to obtain it with ruby.. can someone help me?
To just turn it into a float, you can use to_f
, for displaying in scientific notation a format string will help:
>> 999999999.to_f #=> 999999999.0
>> "%E" % 999999999 #=> "1.000000E+09"