log10 example


  public function updateWordWeights(array $words) {
    try {
      // Update word IDF (Inverse Document Frequency) counts for new/changed       // words.       $words = array_keys($words);
      foreach ($words as $word) {
        // Get total count.         $total = $this->replica->query("SELECT SUM([score]) FROM {search_index} WHERE [word] = :word", [':word' => $word])
          ->fetchField();
        // Apply Zipf's law to equalize the probability distribution.         $total = log10(1 + 1 / (max(1, $total)));
        $this->connection->merge('search_total')
          ->key('word', $word)
          ->fields(['count' => $total])
          ->execute();
      }
      // Find words that were deleted from search_index, but are still in       // search_total. We use a LEFT JOIN between the two tables and keep only       // the rows which fail to join.       $result = $this->replica->query("SELECT [t].[word] AS [realword], [i].[word] FROM {search_total} [t] LEFT JOIN {search_index} [i] ON [t].[word] = [i].[word] WHERE [i].[word] IS NULL");
      $or = $this->replica->condition('OR');
      foreach ($result as $word) {
        
$gainstring .= str_pad(decbin($storedreplaygain), 9, '0', STR_PAD_LEFT);

        return $gainstring;
    }

    /** * @param float $amplitude * * @return float */
    public static function RGADamplitude2dB($amplitude) {
        return 20 * log10($amplitude);
    }

    /** * @param string $imgData * @param array $imageinfo * * @return array|false */
    public static function GetDataImageSize($imgData, &$imageinfo=array()) {
        if (PHP_VERSION_ID >= 50400) {
            $GetDataImageSize = @getimagesizefromstring($imgData$imageinfo);
            

  public static function format($total$current) {
    if (!$total || $total == $current) {
      // If $total doesn't evaluate as true or is equal to the current set, then       // we're finished, and we can return "100".       $percentage = '100';
    }
    else {
      // We add a new digit at 200, 2000, etc. (since, for example, 199/200       // would round up to 100% if we didn't).       $decimal_places = max(0, floor(log10($total / 2.0)) - 1);
      do {
        // Calculate the percentage to the specified number of decimal places.         $percentage = sprintf('%01.' . $decimal_places . 'f', round($current / $total * 100, $decimal_places));
        // When $current is an integer, the above calculation will always be         // correct. However, if $current is a floating point number (in the case         // of a multi-step batch operation that is not yet complete), $percentage         // may be erroneously rounded up to 100%. To prevent that, we add one         // more decimal place and try again.         $decimal_places++;
      } while ($percentage == '100');
    }
    


/** * Default topic count scaling for tag links. * * @since 2.9.0 * * @param int $count Number of posts with that tag. * @return int Scaled count. */
function default_topic_count_scale( $count ) {
    return round( log10( $count + 1 ) * 100 );
}

/** * Generates a tag cloud (heatmap) from provided data. * * @todo Complete functionality. * @since 2.3.0 * @since 4.8.0 Added the `show_count` argument. * * @param WP_Term[] $tags Array of WP_Term objects to generate the tag cloud for. * @param string|array $args { * Optional. Array or string of arguments for generating a tag cloud. * * @type int $smallest Smallest font size used to display tags. Paired * with the value of `$unit`, to determine CSS text * size unit. Default 8 (pt). * @type int $largest Largest font size used to display tags. Paired * with the value of `$unit`, to determine CSS text * size unit. Default 22 (pt). * @type string $unit CSS text size unit to use with the `$smallest` * and `$largest` values. Accepts any valid CSS text * size unit. Default 'pt'. * @type int $number The number of tags to return. Accepts any * positive integer or zero to return all. * Default 0. * @type string $format Format to display the tag cloud in. Accepts 'flat' * (tags separated with spaces), 'list' (tags displayed * in an unordered list), or 'array' (returns an array). * Default 'flat'. * @type string $separator HTML or text to separate the tags. Default "\n" (newline). * @type string $orderby Value to order tags by. Accepts 'name' or 'count'. * Default 'name'. The {@see 'tag_cloud_sort'} filter * can also affect how tags are sorted. * @type string $order How to order the tags. Accepts 'ASC' (ascending), * 'DESC' (descending), or 'RAND' (random). Default 'ASC'. * @type int|bool $filter Whether to enable filtering of the final output * via {@see 'wp_generate_tag_cloud'}. Default 1. * @type array $topic_count_text Nooped plural text from _n_noop() to supply to * tag counts. Default null. * @type callable $topic_count_text_callback Callback used to generate nooped plural text for * tag counts based on the count. Default null. * @type callable $topic_count_scale_callback Callback used to determine the tag count scaling * value. Default default_topic_count_scale(). * @type bool|int $show_count Whether to display the tag counts. Default 0. Accepts * 0, 1, or their bool equivalents. * } * @return string|string[] Tag cloud as a string or an array, depending on 'format' argument. */
Home | Imprint | This part of the site doesn't use cookies.