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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mail at sebastian-bopp dot de
New email:
PHP Version: OS:

 

 [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: Mon Dec 09 04:01:27 2024 UTC