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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Sat Mar 06 15:01:23 2021 UTC