Reputation: 77
I've a huge numbers, for example 1.98726575488820e+30, and i want to rounding it to this form: floor + "." (without quoting) + five-digit mantissa + "e+..." (if there is e) but I don't know how can I do it. In this case: 1.98727e+30.
Please so much for help.
Upvotes: 2
Views: 189
Reputation: 2254
Number.toPrecision will give you a String like this:
var hugeNumber:Number = Number("1.98726575488820e+30");
var rounded:String = hugeNumber.toPrecision(6);
trace(rounded); // "1.98727e+30"
Upvotes: 3