php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80867 bccomp warning for INF
Submitted: 2021-03-15 09:37 UTC Modified: 2021-03-15 10:55 UTC
From: marian dot sedivy at gmail dot com Assigned:
Status: Not a bug Package: BC math related
PHP Version: 7.4.16 OS: MacOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: marian dot sedivy at gmail dot com
New email:
PHP Version: OS:

 

 [2021-03-15 09:37 UTC] marian dot sedivy at gmail dot com
Description:
------------
---
From manual page: https://php.net/function.bccomp
---

This code: var_dump(bccomp(-INF, 1.0, 2)); produces error

PHP Warning:  bccomp(): bcmath function argument is not well-formed

But according to docs (https://www.php.net/manual/en/math.constants.php) INF is float, so I think, that this Warning is wrong.

Test script:
---------------
var_dump(bccomp(-INF, 1.0, 2));

Expected result:
----------------
No warning

Actual result:
--------------
PHP Warning:  bccomp(): bcmath function argument is not well-formed

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-15 09:39 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2021-03-15 09:39 UTC] nikic@php.net
bcmath does *not* work with floating-pointing point numbers. It works with fixed-point numbers represented as strings. It does not have a concept of "INF".
 [2021-03-15 10:55 UTC] cmb@php.net
-Package: *Math Functions +Package: BC math related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 18:01:30 2024 UTC