|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: rico dot humme at gmail dot com
New email:
PHP Version: OS:


 [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: Thu Jul 18 05:01:28 2024 UTC