php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77152 In the documentation says it returns 0.5 but when I did tests returns 0
Submitted: 2018-11-14 12:30 UTC Modified: 2018-11-14 14:09 UTC
From: naspter at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: BC math related
PHP Version: 7.2.12 OS: Windows 10
Private report: No CVE-ID: None
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:
MUST BE VALID
Solve the problem:
28 + 41 = ?
Subscribe to this entry?

 
 [2018-11-14 12:30 UTC] naspter at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.bcmod
---

var_dump(bcmod('4', '3.5'));
var_dump(fmod('4', '3.5'));
var_dump('4'%'3.5');

>= PHP 7.2.*
0
0.5
1

< PHP 7.2.0
1
0.5
1

Test script:
---------------
var_dump(bcmod('4', '3.5'));
var_dump(fmod('4', '3.5'));
var_dump('4'%'3.5');

>= PHP 7.2.*
0
0.5
1

< PHP 7.2.0
1
0.5
1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-14 14:09 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Package: Math related +Package: BC math related -Assigned To: +Assigned To: cmb
 [2018-11-14 14:09 UTC] cmb@php.net
You need to set a scale greater than 0 like in the example in the
docs, see <https://3v4l.org/Bi8sU>.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 09 04:01:27 2024 UTC