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

Breadcrumb

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

function 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\Utility

Code

protected function fixImprecision($input, $imprecision) {
    if ($this->delta($input) < abs($imprecision)) {
        return $input + $imprecision;
    }
    return $input;
}

API Navigation

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