Solved

# convert exponential numbers to actual numbers

Posted on 2009-04-07
2,314 Views
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
0
Question by:shafer23
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2
• 2

LVL 18

Expert Comment

ID: 24090347
what format is that exponential number in? is it a string? can you supply some example of that needs to be converted?
0

LVL 13

Accepted Solution

marchent earned 500 total points
ID: 24090449
using php number_format()
\$number = 10e10;
print number_format(\$number);
0

Author Comment

ID: 24091406
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

0

LVL 13

Expert Comment

ID: 24091522
yeah, your 20 is for number of decimal places to handle.  I don't know any other way to do this.
0

Author Closing Comment

ID: 31567635
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
###### Suggested Courses
Course of the Month5 days, 22 hours left to enroll