function Calculator::sqrt
Returns the square root of the given number, rounded down.
The result is the largest x such that x² ≤ n. The input MUST NOT be negative.
3 methods override Calculator::sqrt()
- BcMathCalculator::sqrt in vendor/
brick/ math/ src/ Internal/ Calculator/ BcMathCalculator.php - Returns the square root of the given number, rounded down.
- GmpCalculator::sqrt in vendor/
brick/ math/ src/ Internal/ Calculator/ GmpCalculator.php - Returns the square root of the given number, rounded down.
- NativeCalculator::sqrt in vendor/
brick/ math/ src/ Internal/ Calculator/ NativeCalculator.php - Adapted from https://cp-algorithms.com/num_methods/roots_newton.html
File
-
vendor/
brick/ math/ src/ Internal/ Calculator.php, line 307
Class
- Calculator
- Performs basic operations on arbitrary size integers.
Namespace
Brick\Math\InternalCode
public abstract function sqrt(string $n) : string;