Reference+
Name
sqrt()
Description
Calculates the square root of a number. The square root of a number is always positive, even though there may be a valid negative root. The square root s of number a is such that s*s = a. It is the opposite of squaring.
Examples
size(400, 400); noStroke(); float a = sqrt(104976); // Sets 'a' to 324 float b = sqrt(10000); // Sets 'b' to 100 float c = sqrt(256); // Sets 'c' to 16 rect(0, 100, a, 40); rect(0, 180, b, 40); rect(0, 260, c, 40);
Syntax
sqrt(n)
Parameters
n
(float)
non-negative number
Return
float
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.