note 130462 added to language.operators.arithmetic
| From: | flip@example.com | Date: | Wed, 27 Aug 2025 07:27:54 +0000 |
| Subject: | note 130462 added to language.operators.arithmetic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-222321@lists.php.net to get a copy of this message | ||
The modulo % does not work on Floats, use fmod()
https://www.php.net/manual/en/function.fmod.php
php > echo (1.1 % 1);
0
php > echo fmod(1.1, 1);
0.1
Could be a discussion on if it should, but at least at the moment it doesn't.
https://en.wikipedia.org/wiki/Modulo
has a list of languages that do/don't support modulo on floats
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 2001:41f0:2a29:10:64b0:7798:ee7c:e824)
----
Manual Page -- https://php.net/manual/en/language.operators.arithmetic.php
Edit -- https://main.php.net/note/edit/130462
Del: integrated -- https://main.php.net/note/delete/130462/integrated
Del: useless -- https://main.php.net/note/delete/130462/useless
Del: bad code -- https://main.php.net/note/delete/130462/bad+code
Del: spam -- https://main.php.net/note/delete/130462/spam
Del: non-english -- https://main.php.net/note/delete/130462/non-english
Del: in docs -- https://main.php.net/note/delete/130462/in+docs
Del: other reasons-- https://main.php.net/note/delete/130462
Reject -- https://main.php.net/note/reject/130462
Search -- https://main.php.net/manage/user-notes.php