Solved

convert exponential numbers to actual numbers

Posted on 2009-04-07
5
2,272 Views
Last Modified: 2012-05-06
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
Comment
Question by:shafer23
  • 2
  • 2
5 Comments
 
LVL 18

Expert Comment

by:Hube02
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

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

Open in new window

0
 

Author Comment

by:shafer23
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

by:marchent
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

by:shafer23
ID: 31567635
Thanks for your help!
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

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…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question