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

Breadcrumb

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

function BigDecimal::getFractionalPart

Returns a string representing the fractional part of this decimal number.

If the scale is zero, an empty string is returned.

Examples: `-123.456` => '456', `123` => ''.

1 call to BigDecimal::getFractionalPart()
BigDecimal::hasNonZeroFractionalPart in vendor/brick/math/src/BigDecimal.php
Returns whether this decimal number has a non-zero fractional part.

File

vendor/brick/math/src/BigDecimal.php, line 593

Class

BigDecimal
Immutable, arbitrary-precision signed decimal numbers.

Namespace

Brick\Math

Code

public function getFractionalPart() : string {
    if ($this->scale === 0) {
        return '';
    }
    $value = $this->getUnscaledValueWithLeadingZeros();
    return \substr($value, -$this->scale);
}

API Navigation

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