Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Outputting Large Numbers
beeseven
post Apr 6 2005, 01:54 AM
Post #1


Privileged Member
*********

Group: Members
Posts: 629
Joined: 26-February 05
Member No.: 3,995



Usually when you output a large number (>14 digits), it takes it and turns it into an exponential expression (eg: 1.6E+15). Is there a way to change it so that it doesn't turn it into that and just keeps outputting all the digits?
Go to the top of the page
 
+Quote Post
Spectre
post Apr 6 2005, 03:11 PM
Post #2


Privileged Member
*********

Group: Members
Posts: 874
Joined: 30-July 04
Member No.: 246



The first two options that spring to mind would be assigning the value to a string variable type, or using the number_format() function (which returns the value as a string, and also groups the digits in blocks of three seperated by a comma, by default).

For example:
CODE
// If printed, would display '1.e+14'
$number = 100000000000000;
// If printed, would display the value as a string, exactly as you see it
// (the quotes indicate a string value)
$number = '100000000000000';
// If printed, would display the number with digit grouping
$number = number_format(1.e+14);


Hope that explains things for you.
Go to the top of the page
 
+Quote Post
beeseven
post Apr 7 2005, 10:50 PM
Post #3


Privileged Member
*********

Group: Members
Posts: 629
Joined: 26-February 05
Member No.: 3,995



Number format is good, I just used number_format($n,0,'','') the separator '', which achieved the desired affect.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Showing Numbers Of Mysql Entries In A Database Table(7)


 



- Lo-Fi Version Time is now: 16th May 2008 - 06:14 PM