protected function Rectangle::fixImprecision in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::fixImprecision()
- 10 core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::fixImprecision()
Performs an imprecision check on the input value and fixes it if needed.
GD that uses C floats internally, whereas we at PHP level use C doubles. In some cases, we need to compensate imprecision.
Parameters
float $input: The input value.
float $imprecision: The imprecision factor.
Return value
float A value, where imprecision is added to input if the delta part of the input is lower than the absolute imprecision.
1 call to Rectangle::fixImprecision()
- Rectangle::rotate in core/
lib/ Drupal/ Component/ Utility/ Rectangle.php - Rotates the rectangle.
File
- core/
lib/ Drupal/ Component/ Utility/ Rectangle.php, line 141
Class
- Rectangle
- Rectangle rotation algebra class.
Namespace
Drupal\Component\UtilityCode
protected function fixImprecision($input, $imprecision) {
if ($this
->delta($input) < abs($imprecision)) {
return $input + $imprecision;
}
return $input;
}