php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55464 differ is_float() from is_double()
Submitted: 2011-08-19 20:02 UTC Modified: 2011-08-23 03:45 UTC
From: zandor_zz at yahoo dot it Assigned:
Status: Not a bug Package: Variables related
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
 [2011-08-19 20:02 UTC] zandor_zz at yahoo dot it
Description:
------------
It would be nice to differ the behavior of is_float() from is_double(). This 
situation is not consistent cause float and double do differ for different 
byte size.
I have created a PHP class to handle advanced read/write operations on files and I 
crashed onto this ambiguous situation. Thus I wrote myself a workaround to solve 
this ambiguous situation. Then I suggest that it would be nice to rely on this 
feature in the standard PHP library.

Test script:
---------------
It is known from PHP standard documentation that is_double() is an alias of is_float().


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-23 03:45 UTC] cataphract@php.net
-Status: Open +Status: Bogus
 [2011-08-23 03:45 UTC] cataphract@php.net
There is only one floating point type in PHP -- it is named float, with "double" (and "real") as an alias and the underlying representation is a C double. Both is_float and is_double (and also is_real) test for this type. So the proposal makes no sense. As such, I'm closing this as bogus.

What I think you actually wanted to suggest is introducing a new type with single precision. This would be a rather big change with no compelling advantages (the double can represent all the values the float can) and possible BC breaks. In any case, such a change would require extended discussion; see https://wiki.php.net/rfc
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 20:01:30 2024 UTC