mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 10:00:42 +01:00
57 lines
911 B
XML
57 lines
911 B
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
<root>
|
|
<name>sq()</name>
|
|
|
|
<category>Math</category>
|
|
|
|
<subcategory>Calculation</subcategory>
|
|
|
|
<usage>Web & Application</usage>
|
|
|
|
<example>
|
|
<image>sq_.gif</image>
|
|
<code>
|
|
noStroke();
|
|
float a = sq(1); // Sets a to 1
|
|
float b = sq(-5); // Sets b to 25
|
|
float c = sq(9); // Sets c to 81
|
|
rect(0, 25, a, 10);
|
|
rect(0, 45, b, 10);
|
|
rect(0, 65, c, 10);
|
|
</code>
|
|
</example>
|
|
|
|
<description>
|
|
Squares a number (multiplies a number by itself). The result is always a positive number, as multiplying two negative numbers always yields a positive result. For example, -1 * -1 = 1.
|
|
</description>
|
|
|
|
<syntax>
|
|
sq(<c>value</c>)
|
|
</syntax>
|
|
|
|
<parameter>
|
|
<label>value</label>
|
|
<description>int or float</description>
|
|
</parameter>
|
|
|
|
<returns>float</returns>
|
|
|
|
<related>
|
|
sqrt()
|
|
</related>
|
|
|
|
<availability>1.0</availability>
|
|
|
|
<type>Function</type>
|
|
|
|
<partof>PDE</partof>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</root>
|