Go Down

Topic: Non-existing sq() function (Read 1 time) previous topic - next topic


Aug 19, 2012, 11:53 am Last Edit: Aug 19, 2012, 12:02 pm by Djui Reason: 1
The http://arduino.cc/en/Reference/Sqrt documentation references the 'sq' function but online, this function is not in the index, and offline (at least on OSX) the documentation for it is non-existing neither is it in the index.


I suspect it is omitted because it is such a trivial thing to implement oneself.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


You do not need it implement by yourself, of course, both compile with 1.0.1 fine:
 float x, y;
 x = 123.456;
 y = sqrt(x);
 y = sq(y);

Tom Carpenter

If it doesn't exist for you, you can add it by including this line at the top of your sketch:

#define sq(x) ((x)*(x))

That is all it is defined as in the Arduino.h file of Arduino 1.0.1

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131