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

Breadcrumb

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

function BigNumber::toScale

Converts this number to a BigDecimal with the given scale, using rounding if necessary.

Parameters

int $scale The scale of the resulting `BigDecimal`.:

RoundingMode $roundingMode An optional rounding mode, defaults to UNNECESSARY.:

Throws

RoundingNecessaryException If this number cannot be converted to the given scale without rounding. This only applies when RoundingMode::UNNECESSARY is used.

3 methods override BigNumber::toScale()
BigDecimal::toScale in vendor/brick/math/src/BigDecimal.php
Converts this number to a BigDecimal with the given scale, using rounding if necessary.
BigInteger::toScale in vendor/brick/math/src/BigInteger.php
Converts this number to a BigDecimal with the given scale, using rounding if necessary.
BigRational::toScale in vendor/brick/math/src/BigRational.php
Converts this number to a BigDecimal with the given scale, using rounding if necessary.

File

vendor/brick/math/src/BigNumber.php, line 474

Class

BigNumber
Common interface for arbitrary-precision rational numbers.

Namespace

Brick\Math

Code

public abstract function toScale(int $scale, RoundingMode $roundingMode = RoundingMode::UNNECESSARY) : BigDecimal;

API Navigation

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