Differences Between: [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Calculation\Statistical; 4 5 use PhpOffice\PhpSpreadsheet\Calculation\Exception; 6 use PhpOffice\PhpSpreadsheet\Calculation\Functions; 7 8 class Standardize extends StatisticalValidations 9 { 10 /** 11 * STANDARDIZE. 12 * 13 * Returns a normalized value from a distribution characterized by mean and standard_dev. 14 * 15 * @param float $value Value to normalize 16 * @param float $mean Mean Value 17 * @param float $stdDev Standard Deviation 18 * 19 * @return float|string Standardized value, or a string containing an error 20 */ 21 public static function execute($value, $mean, $stdDev) 22 { 23 $value = Functions::flattenSingleValue($value); 24 $mean = Functions::flattenSingleValue($mean); 25 $stdDev = Functions::flattenSingleValue($stdDev); 26 27 try { 28 $value = self::validateFloat($value); 29 $mean = self::validateFloat($mean); 30 $stdDev = self::validateFloat($stdDev); 31 } catch (Exception $e) { 32 return $e->getMessage(); 33 } 34 35 if ($stdDev <= 0) { 36 return Functions::NAN(); 37 } 38 39 return ($value - $mean) / $stdDev; 40 } 41 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body