ID: 19621 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Feature/Change Request Operating System: Mandrake linux PHP Version: 4.2.0 New Comment:
Quick search showed that there is no well know scripting language that has such function. C++/C# has this but they are not scripting languages. The following code does the same. Also we have to think about BC(backward compatibility) with older scripts. function sign($x){ return (int)((abs($x)-$x)? -1:$x>0); } Thank you for you suggestion. Previous Comments: ------------------------------------------------------------------------ [2002-09-26 13:52:07] [EMAIL PROTECTED] The wonderful math-function list is missing a very important and simple function: sign(). The is the comlpementof abs(), and together with abs() allows you to separate the magnitude and sign of a number, e.g. for graphing purposes (it's hard to graph a negative number of pixels, and displaying money as "$-99" looks dumb). It's a one-line function, so I've already written my own, but it really ought to be built-in. Thanks! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19621&edit=1