#24508 [Asn->Csd]: Different result of round()

From: Date: Mon, 28 Jul 2003 22:07:30 +0000
Subject: #24508 [Asn->Csd]: Different result of round()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-44939@lists.php.net to get a copy of this message
 ID:               24508
 Updated by:       edink@php.net
 Reported By:      erlendkb at online dot no
-Status:           Assigned
+Status:           Closed
 Bug Type:         *Math Functions
 Operating System: Windows XP
 PHP Version:      5.0.0b1 (beta1)
 Assigned To:      edink
 New Comment:

Fixed in the latest snaps from snaps.php.net.


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

[2003-07-24 08:22:07] dj-bj at gmx dot de

Experienced the same problem with that PHP version on Windows 2000
Server.

$foo = round (1.95583,2);   // $foo != 1.96, $foo = 1.95

round() seems to work like floor() or to simply cut off the numbers
behind the comma.

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

[2003-07-07 10:17:14] sniper@php.net

This is due to some funky build problem Edin has..
Assigning to him so he won't forget about it. :)


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

[2003-07-05 16:29:36] robert at aristoteles dot xhaven dot net

It WFM @ Linux build (Apache 2.0.46, PHP5.0.0b1) - returns 4177.42

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

[2003-07-05 16:00:13] erlendkb at online dot no

Description:
------------
This script gives different results in PHP4 (PHP 4.3.2) og PHP5 (5.0.0
BETA 1)

Reproduce code:
---------------
<?php

$end =   date ("U", mktime (11, 00, 0, 7, 4, 2003));
$start = date ("U", mktime (8, 35, 0, 1, 11, 2003));

$hanne = $end - $start;

echo round ($hanne/3600, 2);

?>

Expected result:
----------------
PHP4:
4177.42

PHP5:
4177.41

Actual result:
--------------
...


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


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



Thread (5 messages)

« previous php.bugs (#44939) next »