php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46400 Floating number output problem
Submitted: 2008-10-27 10:55 UTC Modified: 2008-10-27 13:27 UTC
From: David dot Rolli at bl dot ch Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.6 OS: Windows XP Pro, SP2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: David dot Rolli at bl dot ch
New email:
PHP Version: OS:

 

 [2008-10-27 10:55 UTC] David dot Rolli at bl dot ch
Description:
------------
I want to outpu my floating number with 13 digits but not in scientific notation - this just doesn't work with certain numbers (see code).

Reproduce code:
---------------
<?php
  ini_set("precision", 14);

  $a = 123456789012;
  $b = 123456789012.0;
  $c = 12345678901203;
  $d = 1234567890123.0;
  
  $e = 1225099800;
  $f = 1225099800000;
  $h = 1225099800001;

  echo('$a: ' . $a. "<BR>");   // ->  123456789012
  echo('$b: ' . $b. "<BR>");   // ->  123456789012
  echo('$c: ' . $c. "<BR>");   // ->  1234567890123
  echo('$d: ' . $d. "<BR>");   // ->  1234567890123
  echo('$e: ' . $e. "<BR>");   // ->  1225099800
  echo('$f: ' . $f. "<BR>");   // ->  1.2250998E+12  !!!
  echo('$h: ' . $h. "<BR>");   // ->  1225099800001  !!!
?>

Expected result:
----------------
123456789012
123456789012
1234567890123
1234567890123
1225099800
1225099800000
1225099800001

Actual result:
--------------
123456789012
123456789012
1234567890123
1234567890123
1225099800
12250998E+12
1225099800001

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-27 11:47 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

PLEASE, search the bug database before you submit a bug report. This has actually been fixed already, IIRC.
 [2008-10-27 13:27 UTC] David dot Rolli at bl dot ch
Would be nice if you could tell me which bug report seems to point out this same problem (I didn't find it) and which version of PHP has this fix ! PLEASE
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 10:01:30 2025 UTC