Link to home
Start Free TrialLog in
Avatar of Pete C
Pete CFlag for United States of America

asked on

convert exponential numbers to actual numbers

Hi -

I want to convert a value (which may or may not) be in exponential format to an actual value - e.g. I want 10,000,000,000 rather than the exponential equivalent.  Can anyone suggest code that will convert the exponential value to an actual value?

Thanks!

Pete
Avatar of Hube02
Hube02
Flag of United States of America image

what format is that exponential number in? is it a string? can you supply some example of that needs to be converted?
ASKER CERTIFIED SOLUTION
Avatar of marchent
marchent
Flag of Bangladesh image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Pete C

ASKER

Hi marchent - that works - thanks!  

The number could have decimals, so I am using the following formula:
$value = number_format  ($value, 20, '.', '')

My only question is that I am uncertain as to how many decimal places there may be, so I am just using an arbitrarily high number, e.g. 20.  Is there anything that I am overlooking - i.e. is there another way to handle a variable number of decimal places.

If not, that is fine - but I just thought that I would check.  Thanks again!

Pete



yeah, your 20 is for number of decimal places to handle.  I don't know any other way to do this.
Avatar of Pete C

ASKER

Thanks for your help!