Doc #53523 [Opn->Wfx]: Missing documentation for edge case of abs() function.
| From: | dtajchreber@php.net | Date: | Sat, 11 Dec 2010 23:23:00 +0000 |
| Subject: | Doc #53523 [Opn->Wfx]: Missing documentation for edge case of abs() function. | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5654@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53523&edit=1
ID: 53523
Updated by: dtajchreber@php.net
Reported by: pinja_kolada at yahoo dot com
Summary: Missing documentation for edge case of abs()
function.
-Status: Open
+Status: Wont fix
Type: Documentation Problem
Package: Documentation problem
Operating System: GNU/Linux
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Integer overflow is described here: http://tinyurl.com/38rusjo
It's not really an edge case. It's just how PHP handles overflow. None
of the
other pages that return an integer specifically talk about it and I
don't think
it's necessary to note just on the abs() page.
Previous Comments:
------------------------------------------------------------------------
[2010-12-11 23:45:19] pinja_kolada at yahoo dot com
Description:
------------
---
From manual page: http://www.php.net/function.abs
---
Currently return type is described as:
"The absolute value of number. If the argument number is of type float,
the return type is also float, otherwise it is integer (as float usually
has a bigger value range than integer)."
and should be something like:
"The absolute value of number. If the argument number is of type float,
the return type is also float, otherwise it is integer (as float usually
has a bigger value range than integer). If the argument is of type
integer with value of - PHP_INT_MAX - 1 (minimum signed integer value)
the return type is float due to integer overflow...."
It's an edge case, but can be source of confusion if type is important.
Test script:
---------------
$n = - PHP_INT_MAX - 1;
var_dump($n); // type - int
var_dump(abs($n)); // type - float
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53523&edit=1