note 80108 added to function.abs

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
If we want to into a war about speed with negative absolute numbers, I think bitwise operations should just about do it. 

<?php
function n_abs($v) { return ~abs($v) + 1; }
?>

A NOT operation on any number with a sign bit will produce the negative of that number minus one. All we need to do is add one. Voila! 

Speed test results (30000 iterations of various methods) produced very close dueling between the previous suggested method. Although I am on an overloaded Windows PC so I'm no benchmark, and I'll leave it up to you, the reader of this message.
----
Server IP: 194.145.210.3
Probable Submitter: 86.149.171.101
----
Manual Page -- http://www.php.net/manual/en/function.abs.php
Edit        -- https://master.php.net/note/edit/80108
Del: integrated  -- https://master.php.net/note/delete/80108/integrated
Del: useless     -- https://master.php.net/note/delete/80108/useless
Del: bad code    -- https://master.php.net/note/delete/80108/bad+code
Del: spam        -- https://master.php.net/note/delete/80108/spam
Del: non-english -- https://master.php.net/note/delete/80108/non-english
Del: in docs     -- https://master.php.net/note/delete/80108/in+docs
Del: other reasons-- https://master.php.net/note/delete/80108
Reject      -- https://master.php.net/note/reject/80108
Search      -- https://master.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.