Pete C
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
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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.
ASKER
Thanks for your help!