public function FractionInterface::toDecimal in Fraction 2.x
Same name and namespace in other branches
- 8 src/FractionInterface.php \Drupal\fraction\FractionInterface::toDecimal()
Calculates the decimal equivalent of the fraction.
Parameters
int $precision: The desired decimal precision, defaults to 0.
bool $auto_precision: Boolean, whether or not the precision should be automatically calculated. This option provides more precision when you need it, and less when you don't. If set to TRUE, it will try to determine the maximum precision (this only works if the denominator is base 10). If the resulting precision is greater than $precision, it will be used instead.
Return value
string Returns the decimal equivalent of the fraction as a PHP string.
1 method overrides FractionInterface::toDecimal()
- Fraction::toDecimal in src/
Fraction.php - Calculates the decimal equivalent of the fraction.
File
- src/
FractionInterface.php, line 76
Class
- FractionInterface
- Defines the interface for Fraction class.
Namespace
Drupal\fractionCode
public function toDecimal(int $precision, bool $auto_precision = FALSE);