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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: naspter at gmail dot com
New email:
PHP Version: OS:

 

 [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 Oct 14 09:01:27 2024 UTC