aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/arduino/sq.rst
blob: c918d50c35c9d00151f16d576a81dc865f06a6a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
.. 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.


.. include:: cc-attribution.txt