Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Calculation\Engineering; 4 5 use PhpOffice\PhpSpreadsheet\Calculation\Exception; 6 use PhpOffice\PhpSpreadsheet\Calculation\Functions; 7 8 class Compare 9 { 10 /** 11 * DELTA. 12 * 13 * Excel Function: 14 * DELTA(a[,b]) 15 * 16 * Tests whether two values are equal. Returns 1 if number1 = number2; returns 0 otherwise. 17 * Use this function to filter a set of values. For example, by summing several DELTA 18 * functions you calculate the count of equal pairs. This function is also known as the 19 * Kronecker Delta function. 20 * 21 * @param float $a the first number 22 * @param float $b The second number. If omitted, b is assumed to be zero. 23 * 24 * @return int|string (string in the event of an error) 25 */ 26 public static function DELTA($a, $b = 0) 27 { 28 $a = Functions::flattenSingleValue($a); 29 $b = Functions::flattenSingleValue($b); 30 31 try { 32 $a = EngineeringValidations::validateFloat($a); 33 $b = EngineeringValidations::validateFloat($b); 34 } catch (Exception $e) { 35 return $e->getMessage(); 36 } 37 38 return (int) ($a == $b); 39 } 40 41 /** 42 * GESTEP. 43 * 44 * Excel Function: 45 * GESTEP(number[,step]) 46 * 47 * Returns 1 if number >= step; returns 0 (zero) otherwise 48 * Use this function to filter a set of values. For example, by summing several GESTEP 49 * functions you calculate the count of values that exceed a threshold. 50 * 51 * @param float $number the value to test against step 52 * @param float $step The threshold value. If you omit a value for step, GESTEP uses zero. 53 * 54 * @return int|string (string in the event of an error) 55 */ 56 public static function GESTEP($number, $step = 0) 57 { 58 $number = Functions::flattenSingleValue($number); 59 $step = Functions::flattenSingleValue($step); 60 61 try { 62 $number = EngineeringValidations::validateFloat($number); 63 $step = EngineeringValidations::validateFloat($step); 64 } catch (Exception $e) { 65 return $e->getMessage(); 66 } 67 68 return (int) ($number >= $step); 69 } 70 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body