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

Breadcrumb

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

function Calculator::init

Extracts the sign & digits of the operands.

Return value

array{bool, bool, string, string} Whether $a and $b are negative, followed by their digits.

5 calls to Calculator::init()
Calculator::bitwise in vendor/brick/math/src/Internal/Calculator.php
Performs a bitwise operation on a decimal number.
Calculator::cmp in vendor/brick/math/src/Internal/Calculator.php
Compares two numbers.
NativeCalculator::add in vendor/brick/math/src/Internal/Calculator/NativeCalculator.php
Adds two numbers.
NativeCalculator::divQR in vendor/brick/math/src/Internal/Calculator/NativeCalculator.php
Returns the quotient and remainder of the division of two numbers.
NativeCalculator::mul in vendor/brick/math/src/Internal/Calculator/NativeCalculator.php
Multiplies two numbers.

File

vendor/brick/math/src/Internal/Calculator.php, line 93

Class

Calculator
Performs basic operations on arbitrary size integers.

Namespace

Brick\Math\Internal

Code

protected final function init(string $a, string $b) : array {
    return [
        $aNeg = $a[0] === '-',
        $bNeg = $b[0] === '-',
        $aNeg ? \substr($a, 1) : $a,
        $bNeg ? \substr($b, 1) : $b,
    ];
}

API Navigation

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