php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49342 gnu_cmp doesn't work with decimal strings
Submitted: 2009-08-24 04:36 UTC Modified: 2009-08-24 09:33 UTC
From: scott at connerly dot net Assigned:
Status: Not a bug Package: GNU MP related
PHP Version: 5.2.10 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: scott at connerly dot net
New email:
PHP Version: OS:

 

 [2009-08-24 04:36 UTC] scott at connerly dot net
Description:
------------
gnu_cmp doesn't work with decimal strings



Reproduce code:
---------------
---
From manual page: function.gmp-cmp
---

$integers = gmp_cmp('2','5');
$floats = gmp_cmp('2.5','5');

var_dump($integers,$floats);

Expected result:
----------------
both should return -1

Actual result:
--------------
int(-1)
bool(false)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-24 09:33 UTC] sjoerd@php.net
Thank you for your bug report.

The documentation on GMP says:
These functions allow you to work with arbitrary-length integers using the GNU MP library.

Since 2.5 is not an integer, I don't think your example is supposed to work. Also, I can't find the example on the function.gmp-cmp page, so it also does not seem an error in the documentation.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC