aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/sq.rst
blob: a14817f056263087ad4e666a0be038d31c65b68b (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

.. _lang-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