Bug #14646 Updated: pow and floor misbehavior

From: Date: Fri, 21 Dec 2001 16:08:49 +0000
Subject: Bug #14646 Updated: pow and floor misbehavior
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-74710@lists.php.net to get a copy of this message
ID: 14646
Updated by: sander
Reported By: reboot@gmx.ch
Old Status: Assigned
Status: Bogus
Bug Type: Math related
Operating System: Linux (Debian sid)
PHP Version: 4.1.0
Old Assigned To: derick
Assigned To: 
New Comment:

It works fine for me, on Debian Potato/PHP4.1.0/Apache1.3.22, and on Windows 2000 (with the same
php/apache versions).

Previous Comments:
------------------------------------------------------------------------

[2001-12-21 11:07:14] derick@php.net

Checking it out.

------------------------------------------------------------------------

[2001-12-21 10:55:47] reboot@gmx.ch

Executing this code:

print((      floor(7)  ==       floor(7.1) ) . "<BR>");
print((pow(2,floor(7)) == pow(2,floor(7.1))) . "<BR>");

outputs

1<BR><BR>

So, if floor(7) is equal to floor(7.1) how can pow(2,x) from both numbers be different?

PHP 4.0.3pl1 gives the correct output 1<BR>1<BR>

Using the === to compare both non of the expressions is true, so i think floor and pow return int if
the input is a integer, but the documentation says they always returns float. If i use 7.0 instead
if 7 the output is correct and both expressions are equal.


------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=14646&edit=1



Thread (5 messages)

« previous php.dev (#74710) next »