src/bbn/x.php
public static function compare_floats($v1, $v2, string $operator = '===', int $precision = 4): bool
  {
    $v1 = round((float)$v1 * pow(10, $precision));
    $v2 = round((float)$v2 * pow(10, $precision));
    switch ($operator ){
      case '===':
        return $v1 === $v2;
      case '==':
        return $v1 == $v2;
      case '>=':
        return $v1 >= $v2;
      case '<=':
        return $v1 <= $v2;
      case '>':
        return $v1 > $v2;
      case '<':
        return $v1 < $v2;
    }
    return false;
  }
public static function compare_floats($v1, $v2, string $operator = '===', int $precision = 4): bool
  {
    $v1 = round((float)$v1 * pow(10, $precision));
    $v2 = round((float)$v2 * pow(10, $precision));
    switch ($operator ){
      case '===':
        return $v1 === $v2;
      case '==':
        return $v1 == $v2;
      case '>=':
        return $v1 >= $v2;
      case '<=':
        return $v1 <= $v2;
      case '>':
        return $v1 > $v2;
      case '<':
        return $v1 < $v2;
    }
    return false;
  }
public static function compare_floats ( $ v1 , $ v2 , string $ operator = '===' , int $ precision = 4 ) : bool { $ v1 = round ( ( float ) $ v1 * pow ( 10 , $ precision ) ) ; $ v2 = round ( ( float ) $ v2 * pow ( 10 , $ precision ) ) ; switch ( $ operator ) { case '===' : return $ v1 === $ v2 ; case '==' : return $ v1 == $ v2 ; case '>=' : return $ v1 >= $ v2 ; case '<=' : return $ v1 <= $ v2 ; case '>' : return $ v1 > $ v2 ; case '<' : return $ v1 < $ v2 ; } return false ; }
Compares two float numbers with the given operator.

@param float $v1
@param float $v2
@param string $operator
@param int $precision
@return boolean
Compares two float numbers with the given operator .