You are here

function fraction_from_decimal in Fraction 8

Same name and namespace in other branches
  1. 7 fraction.module \fraction_from_decimal()
  2. 2.x fraction.module \fraction_from_decimal()

Convert a decimal value into a fraction object.

Parameters

$value: The decimal value to be converted.

Return value

\Drupal\fraction\Fraction Returns a new fraction object.

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Use the static \Drupal\fraction\Fraction::createFromDecimal() instead.

File

./fraction.module, line 57
Fraction module code.

Code

function fraction_from_decimal($value) {
  return Fraction::createFromDecimal($value);
}