You are here

protected function Rectangle::delta in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::delta()
  2. 10 core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::delta()

Returns the difference of a fraction from the closest between 0 and 1.

Parameters

float $input: The input value.

Return value

float the difference of a fraction from the closest between 0 and 1.

1 call to Rectangle::delta()
Rectangle::fixImprecision in core/lib/Drupal/Component/Utility/Rectangle.php
Performs an imprecision check on the input value and fixes it if needed.

File

core/lib/Drupal/Component/Utility/Rectangle.php, line 170

Class

Rectangle
Rectangle rotation algebra class.

Namespace

Drupal\Component\Utility

Code

protected function delta($input) {
  $fraction = $this
    ->fraction($input);
  return $fraction > 0.5 ? 1 - $fraction : $fraction;
}