convert exponential to decimal

May 4, 2010 at 7:43am
I am struggling to convert an exponential number to the equivalent decimal value. ie. 2e2 to 200 or 12e-1 to 1.2
Any help would be much appreciated, even if just a push in the right direction.

Thanks,
Grant.
May 4, 2010 at 1:39pm
If you have "2e2" as a string, then read the characters up to but excluding the 'e' as an integer B.
Then if the integer E to the right of the 'e' is positive, multiply B by 10 E times. If the integer E
to the right of the 'e' is negative, divide B by 10 E times (ensuring to use floating point arithmetic).

Why are you needing to do this, btw?
May 4, 2010 at 3:35pm
You can read that as float or double in the first place and leave the hard work to operator >>
Topic archived. No new replies allowed.