Remove savedPrecision from Calculation Engine

This commit is contained in:
MarkBaker 2015-10-15 23:07:22 +01:00
parent cd151ae2e4
commit ba04463cc9

View File

@ -208,12 +208,12 @@ class PHPExcel_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;
/** /**
@ -2070,12 +2070,7 @@ class PHPExcel_Calculation
private function __construct(PHPExcel $workbook = null) private function __construct(PHPExcel $workbook = 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 ($workbook !== null) { if ($workbook !== null) {
self::$workbookSets[$workbook->getID()] = $this; self::$workbookSets[$workbook->getID()] = $this;
@ -2087,13 +2082,6 @@ class PHPExcel_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/';