|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81285 Division of floats results strange values
Submitted: 2021-07-23 13:51 UTC Modified: 2021-07-23 13:55 UTC
From: rico dot humme at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Math related
PHP Version: 8.0.8 OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
23 + 30 = ?
Subscribe to this entry?

 [2021-07-23 13:51 UTC] rico dot humme at gmail dot com
I've come across this as trying to find a workaround for fmod()

9.6 / 3.2
9.9 / 3.3

Before PHP 8:

PHP 8+:

Test script:
Test script for testing on multiple versions:

Expected result:
Result should return float(3) on all versions


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-07-23 13:55 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-07-23 13:55 UTC]
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:

Thank you for your interest in PHP.

var_dump() uses serialize_precision instead of precision as of PHP
8.0.0, see <>.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 18:01:30 2024 UTC