You are here

protected static function SuggestionHelper::getDelta in Autocomplete Search Suggestions 8.2

Same name and namespace in other branches
  1. 8 src/SuggestionHelper.php \Drupal\suggestion\SuggestionHelper::getDelta()
  2. 3.0.x src/SuggestionHelper.php \Drupal\suggestion\SuggestionHelper::getDelta()

Estimate the performance.

Parameters

float $delta: The current performance remainder.

int $n: The summation N - 1.

Return value

float The suggestion's remainder summation.

1 call to SuggestionHelper::getDelta()
SuggestionHelper::calculateDensity in src/SuggestionHelper.php
Calculate the ngram's density.

File

src/SuggestionHelper.php, line 415

Class

SuggestionHelper
Provides helper methods for suggestions.

Namespace

Drupal\suggestion

Code

protected static function getDelta($delta, $n) {
  if ($delta < self::MIN_DELTA || !$n) {
    return 0;
  }
  $x = pow($delta, self::EXP);
  return $x + self::getDelta($delta - $x, $n - 1);
}