aboutsummaryrefslogtreecommitdiffstats
path: root/source/lang/sq.rst
blob: bd3264865bdf14f316995797f1a424c166896d3f (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
43
44
45
46
.. highlight:: cpp

.. _lang-sq:

sq()
====

(Macro) computes the square of a number.

Syntax
------

::

    sq(a)

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