diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index b704f4c2..8b98d37f 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -201,12 +201,12 @@ class Calculation public $cyclicFormulaCount = 1; /** - * Precision used for calculations + * Epsilon Precision used for comparisons in calculations * * @var integer * */ - private $savedPrecision = 14; + private $delta = 0.0000000000001; /** @@ -2063,12 +2063,7 @@ class Calculation private function __construct(Spreadsheet $spreadsheet = null) { - $setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16; - $this->savedPrecision = ini_get('precision'); - if ($this->savedPrecision < $setPrecision) { - ini_set('precision', $setPrecision); - } - $this->delta = 1 * pow(10, -$setPrecision); + $this->delta = 1 * pow(10, 0 - ini_get('precision')); if ($spreadsheet !== null) { self::$spreadsheetSets[$spreadsheet->getID()] = $this; @@ -2080,13 +2075,6 @@ class Calculation } - public function __destruct() - { - if ($this->savedPrecision != ini_get('precision')) { - ini_set('precision', $this->savedPrecision); - } - } - private static function loadLocales() { $localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/';