Go Down

Topic: Arduino reference ABS(x) (Read 144 times) previous topic - next topic

oh1kh

Hi!
This was the site that Reference corrections link moved me.

I think there is an error with abs(x):


Reference   Language | Libraries | Comparison | Changes
abs(x)
Description

Computes the absolute value of a number.
Parameters

x: the number
Returns

x: if x is greater than or equal to 0.     

-x: if x is less than 0.          <-------------------Here     
Warning



Compared to c++ reference:   if x is less than 0, means negative number, returns x. (Not -x ! )


--
Saku

spycatcher2k

A negative of a negative number is a positive number, so the statement is correct.
-=-
http://www.uk-pcb.co.uk - UK Based PCB Fab & Assembly Company
Design & Assembly work undertaken - Arduino repairs & testing - PM for details. Arduino & C# PC programming.

Go Up