php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15403 Strange behavior of floor() with negative values
Submitted: 2002-02-06 08:31 UTC Modified: 2002-02-06 08:59 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mail at sebastian-bopp dot de Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 4.1.1 OS: Windows NT
Private report: No CVE-ID: None
 [2002-02-06 08:31 UTC] mail at sebastian-bopp dot de
echo floor(1.6); // will output "1"
This is allright...

echo floor(-1.6); // will output "-2"
But shouldn't this one output "-1" instead?

---
Sebastian

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-06 08:59 UTC] hholzgra@php.net
from http://php.net/floor:
"Returns the next lowest integer ..."

-2 < -1.6 < -1

so -2 is the next lowest integeter, not -1
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC