Bug #71877 [Opn->Nab]: results not as expected

From: Date: Tue, 22 Mar 2016 09:44:36 +0000
Subject: Bug #71877 [Opn->Nab]: results not as expected
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200026@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71877&edit=1

 ID:                 71877
 Updated by:         requinix@php.net
 Reported by:        iskandarm at live dot com
 Summary:            results not as expected
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            *Math Functions
 Operating System:   linux
 PHP Version:        5.5.33
 Block user comment: N
 Private report:     N

 New Comment:

Floating point values have a limited precision. Hence a value might 
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly 
printing it without any mathematical operations.

If you would like to know more about "floats" and what IEEE
754 is, read this:
http://www.floating-point-gui.de/

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------
[2016-03-22 09:36:33] iskandarm at live dot com

Description:
------------
---
From manual page: http://www.php.net/function.ceil
---

i am trying to use ceil function , but for some numbers , i got unexpected results 

please find example in the test script .

Test script:
---------------
<?php
$dNumber = 1.1;
$dExponential = 100;
$x = ($dExponential*$dNumber);
var_dump($x);
var_dump(ceil($x));

Expected result:
----------------
expected results of the ceil is 110

Actual result:
--------------
111


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



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


Thread (4 messages)

« previous php.bugs (#200026) next »