You are here

public static function Calculator::multiply in Physical Fields 8

Multiplies the first number by the second number.

Parameters

string $first_number: The first number.

string $second_number: The second number.

int $scale: The maximum number of digits after the decimal place. Any digit after $scale will be truncated.

Return value

string The result.

3 calls to Calculator::multiply()
Measurement::convert in src/Measurement.php
Converts the current measurement to a new unit.
Measurement::multiply in src/Measurement.php
Multiplies the current measurement by the given number.
Temperature::convert in src/Temperature.php
Converts the current temperature measurement to a new unit.

File

src/Calculator.php, line 74

Class

Calculator
Provides helpers for bcmath-based arithmetic.

Namespace

Drupal\physical

Code

public static function multiply($first_number, $second_number, $scale = 16) {
  self::assertNumberFormat($first_number);
  self::assertNumberFormat($second_number);
  $result = bcmul($first_number, $second_number, $scale);
  return self::trim($result);
}