aboutsummaryrefslogtreecommitdiffstats
path: root/source/lang/api/sq.rst
blob: 96724d3e22d4337c53743ddca2f1b5c2dff0bd43 (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
.. 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:: /arduino-cc-attribution.txt