php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5672 floor() cant handle large numbers
Submitted: 2000-07-19 11:32 UTC Modified: 2000-07-30 23:53 UTC
From: ole at chaos dot dk Assigned: david (profile)
Status: Closed Package: Misbehaving function
PHP Version: 4.0.0 OS: FreeBSD 3.4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ole at chaos dot dk
New email:
PHP Version: OS:

 

 [2000-07-19 11:32 UTC] ole at chaos dot dk
<?
   $bytes=2640947434103;
   $a=floor($bytes/1024);
?>

This fails. If you substitute floor with either ciel or round it works fine. The bug is also in php 3.0.12.

Only module added is mysql.

No changes is made to php.ini


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-19 13:02 UTC] stas at cvs dot php dot net
This should be fixed for 4.0.1pl2. Please reopen if you still have this bug.
 [2000-07-20 03:51 UTC] david at cvs dot php dot net
this bug still exists in cvs
it also happens to ceil(), despite what the user says

it's because ceil and floor return longs
they need to return doubles so they can handle larger values - this is what the C library's doing anyway

does anyone object to this change?

 [2000-07-30 23:53 UTC] hholzgra@php.net
fixed in cvs
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 04:01:29 2024 UTC