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

Pull Requests

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: Sun Dec 22 11:01:30 2024 UTC