Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Calculator.php

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\Internal

Code

public abstract function sqrt(string $n) : string;

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal