aboutsummaryrefslogtreecommitdiffstats
path: root/source/arduino/sq.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-10-25 21:15:28 -0400
committerMarti Bolivar <mbolivar@mit.edu>2010-11-17 12:44:28 -0500
commit2d429e75ce69e77f8c95490ac03881ec9aa0354a (patch)
treea3b810a6c75625b07a4b976e5d1e319c60e19a6b /source/arduino/sq.rst
parent30ac55d80c18e93f9c39a6dd850c10f9e7fd92ac (diff)
downloadlibrambutan-2d429e75ce69e77f8c95490ac03881ec9aa0354a.tar.gz
librambutan-2d429e75ce69e77f8c95490ac03881ec9aa0354a.zip
arduino language reference nearing completion, properly CC-BY-SA 3.0 attributed
Diffstat (limited to 'source/arduino/sq.rst')
-rw-r--r--source/arduino/sq.rst39
1 files changed, 39 insertions, 0 deletions
diff --git a/source/arduino/sq.rst b/source/arduino/sq.rst
new file mode 100644
index 0000000..2b6b1fe
--- /dev/null
+++ b/source/arduino/sq.rst
@@ -0,0 +1,39 @@
+.. highlight:: cpp
+
+.. _arduino-sq:
+
+sq(a)
+=====
+
+Description
+-----------
+
+(Macro) computes the square of a number.
+
+Parameters
+----------
+
+**a**: the number.
+
+Returns
+-------
+
+**a** squared (**a** × **a**).
+
+Warning
+-------
+
+Because of the way ``sq()`` is implemented, avoid using other
+functions or causing side effects inside the parentheses, as it may
+lead to incorrect results::
+
+ b = sq(a++); // avoid this - yields incorrect results
+
+ b = sq(a); // use this instead -
+ a++; // keep other operations outside sq()
+
+
+Arduino Compatibility
+---------------------
+
+Maple's implementation of ``sq()`` is compatible with Arduino.