Bug #80170 [Opn->Nab]: incorrect floating

From: Date: Thu, 01 Oct 2020 18:41:19 +0000
Subject: Bug #80170 [Opn->Nab]: incorrect floating
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229325@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80170&edit=1

 ID:                 80170
 Updated by:         girgias@php.net
 Reported by:        wapinet at mail dot ru
 Summary:            incorrect floating
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Math related
 PHP Version:        8.0.0beta4
 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:
------------------------------------------------------------------------
[2020-10-01 18:12:54] wapinet at mail dot ru

Description:
------------
https://3v4l.org/X4I7W

Test script:
---------------
<?php
var_dump(34.99 - 10);

// Output for 8.0.0alpha1 - beta4
//     float(24.990000000000002)
// Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.23, 7.4.0 - 7.4.11
//     float(24.99)


Expected result:
----------------
24.99

Actual result:
--------------
24.990000000000002


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



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


Thread (4 messages)

« previous php.bugs (#229325) next »