Remove savedPrecision from Calculation Engine

This commit is contained in:
MarkBaker 2015-10-15 23:07:36 +01:00
parent 0985caf352
commit 26cf4c0709
1 changed files with 3 additions and 15 deletions

View File

@ -201,12 +201,12 @@ class Calculation
public $cyclicFormulaCount = 1; public $cyclicFormulaCount = 1;
/** /**
* Precision used for calculations * Epsilon Precision used for comparisons in calculations
* *
* @var integer * @var integer
* *
*/ */
private $savedPrecision = 14; private $delta = 0.0000000000001;
/** /**
@ -2063,12 +2063,7 @@ class Calculation
private function __construct(Spreadsheet $spreadsheet = null) private function __construct(Spreadsheet $spreadsheet = null)
{ {
$setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16; $this->delta = 1 * pow(10, 0 - ini_get('precision'));
$this->savedPrecision = ini_get('precision');
if ($this->savedPrecision < $setPrecision) {
ini_set('precision', $setPrecision);
}
$this->delta = 1 * pow(10, -$setPrecision);
if ($spreadsheet !== null) { if ($spreadsheet !== null) {
self::$spreadsheetSets[$spreadsheet->getID()] = $this; 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() private static function loadLocales()
{ {
$localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/'; $localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/';