php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78556 bcmul
Submitted: 2019-09-18 07:29 UTC Modified: 2019-09-18 07:32 UTC
From: shinzan69 at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: BC math related
PHP Version: 7.2.22 OS: CentOS Linux release 7.6.1810 (C
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: shinzan69 at gmail dot com
New email:
PHP Version: OS:

 

 [2019-09-18 07:29 UTC] shinzan69 at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.bcmul
---

echo bcmul(10000000, 0.00001, 5);
=> 0



I expect "100". But return 0

Test script:
---------------
echo bcmul(10000000, 0.00001, 5);


Expected result:
----------------
100

Actual result:
--------------
0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-18 07:32 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2019-09-18 07:32 UTC] cmb@php.net
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:
http://www.floating-point-gui.de/

Use strings for BCMath functions, e.g. <https://3v4l.org/2A2l3>.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 08:01:28 2024 UTC