FISHERINV

Returns the inverse of the Fisher transformation. Use this transformation when
analyzing correlations between ranges or arrays of data. If y = FISHER(x), then
FISHERINV(y) = x.

@param    float        $value
@return    float
324143
public static function FISHERINV($value)
    {
        $value    = PHPExcel_Calculation_Functions::flattenSingleValue($value);

        if (is_numeric($value)) {
            return (exp(2 * $value) - 1) / (exp(2 * $value) + 1);
        }
        return PHPExcel_Calculation_Functions::VALUE();
    }
282688
public function reverseTransform($value)
    {
        if (null === $value) {
            return null;
        }

        if (!\is_int($value) && !\is_float($value)) {
            throw new TransformationFailedException('Expected a numeric.');
        }

        if ($this->scale > 0) {
            return number_format((float) $value, $this->scale, '.', '');
        }

        return (string) $value;
    }
133650
public static function compareFloat(float $value, float $value1) {
        $epsilon = 0.00001;
        if (abs($value - $value1) < $epsilon) {
            return true;
        }
        return false;
    }
1300427
public static function float(&$value=0, bool $flatten=false) {
		// Short circuit.
		if (\is_float($value)) {
			return;
		}

		if (! $flatten && \is_array($value)) {
			foreach ($value as $k=>$v) {
				static::float($value[$k]);
			}
		}
		else {
			static::number($value, true);
			try {
				$value = (float) $value;
			} catch (\Throwable $e) {
				$value = 0.0;
			}
		}
	}
1254509
public static function ppTruthValue($value) {
        if (is_array($value)) {
            foreach ($value as $k => $v) {
                $value[$k] = self::$SNMP_TRUTHVALUES[$v];
            }
        } else {
            $value = self::$SNMP_TRUTHVALUES[$value];
        }
        return $value;
    }
39536
private function normalize($value)
    {
        // Normalize array values
        if (is_array($value)) {
            foreach ($value as &$subValue) {
                $subValue = $this->normalize($subValue);
            }

            return $value;
        }

        // Don't normalize non-string value
        if (!is_string($value)) {
            return $value;
        }

        // Normalize true boolean value
        if ($this->compareValues($value, ['true', 'on', 'yes'])) {
            return true;
        }

        // Normalize false boolean value
        if ($this->compareValues($value, ['false', 'off', 'no', 'none'])) {
            return false;
        }

        // Normalize null value
        if ($this->compareValues($value, ['null'])) {
            return;
        }

        // Normalize numeric value
        if (is_numeric($value)) {
            $numericValue = $value + 0;

            if ((is_int($numericValue) && (int) $value === $numericValue)
                || (is_float($numericValue) && (float) $value === $numericValue)
            ) {
                $value = $numericValue;
            }
        }

        return $value;
    }
470763
private function getInt64Value($value)
    {
        if ($value > self::$int64Max || $value < -self::$int64Max - 1) {
            return false;
        }

        if (PHP_INT_SIZE !== 8 && ($value > self::$int32Max || $value < -self::$int32Max - 1)) {
            return (float) $value;
        }

        return (int) $value;
    }
485837
private static function identify($value)
    {
        if (!is_numeric($value) || !is_float($value)) {
            return gettype($value);
        }

        if (is_infinite($value)) {
            return $value < 0 ? '-INF' : 'INF';
        }

        if (is_nan($value)) {
            return 'NAN';
        }

        return 'float';
    }
783090
public function setInternalValue($value)
    {
        if ($value instanceof \ArrayObject) {
            $value = $value->getArrayCopy();
        }

        if ($value instanceof \Iterator) {
            $value = iterator_to_array($value);
        }

        // force null values conversion to empty arrays
        if (is_null($value)) {
            $value = [];
        }

        if (!is_array($value)) {
            $value = [$value];
        }

        $this->clear();

        foreach ($value as $k => $v) {
            $this->set($k, $v);
        }

        return $this;
    }
1016298
private function castValue(string $value)
    {
        $value = $this->normalize($value);
        if (\preg_match('/^[0-9]+$/', $value)) {
            $value = (int)$value;
        } elseif (\preg_match('/^[0-9\.]+$/', $value)) {
            $value = (float)$value;
        } elseif (\preg_match('/^true|false$/', $value)) {
            $value = $value === 'true' ? true : false;
        }
        return $value;
    }
384447
private function mapYvalue($value)
    {

        $rangeMapper = new \sb\Math\RangeMapper(Array(30, $this->graph_height), Array($this->min, $this->max));
        return $rangeMapper->convert($value);
    }
1077699
public function reverseTransform($value)
    {
        if (null === $value) {
            return null;
        }

        if (!$value instanceof \DateTime) {
            throw new TransformationFailedException('Expected a \DateTime.');
        }

        return \DateTimeImmutable::createFromMutable($value);
    }
1187891
public function pdf(float $value)
    {
        // Calculate the probability density by use of normal/Gaussian distribution
        // Ref: https://en.wikipedia.org/wiki/Normal_distribution
        $std2 = $this->std ** 2;
        $mean = $this->mean;

        return exp(-(($value - $mean) ** 2) / (2 * $std2)) / ((2 * $std2 * M_PI) ** .5);
    }
34764
public static function createFloat($value)
    {
        if ($value instanceof NumericTypeInterface) {
            return $value->asFloatType();
        }
        if (!is_numeric($value)) {
            throw new \InvalidArgumentException("'{$value}' is no valid numeric for FloatType");
        }
        
        if (self::getRequiredType() == self::TYPE_GMP) {
            return RationalTypeFactory::create($value);
        }
        
        return new FloatType($value);
    }
589004
public function reverseTransform($value)
    {
        if (null === $value || '' === $value) {
            return null;
        }

        if (!is_scalar($value)) {
            throw new TransformationFailedException('Expected a scalar.');
        }

        if (!($value === $this->trueValue || $value === $this->falseValue)) {
            throw new TransformationFailedException('Expected true/false boolean value.');
        }

        return $value === $this->trueValue;
    }
536743
public static function VALUE($value = '')
    {
        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);

        if (!is_numeric($value)) {
            $numberValue = str_replace(
                PHPExcel_Shared_String::getThousandsSeparator(),
                '',
                trim($value, " \t\n\r\0\x0B" . PHPExcel_Shared_String::getCurrencyCode())
            );
            if (is_numeric($numberValue)) {
                return (float) $numberValue;
            }

            $dateSetting = PHPExcel_Calculation_Functions::getReturnDateType();
            PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);

            if (strpos($value, ':') !== false) {
                $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($value);
                if ($timeValue !== PHPExcel_Calculation_Functions::VALUE()) {
                    PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
                    return $timeValue;
                }
            }
            $dateValue = PHPExcel_Calculation_DateTime::DATEVALUE($value);
            if ($dateValue !== PHPExcel_Calculation_Functions::VALUE()) {
                PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
                return $dateValue;
            }
            PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);

            return PHPExcel_Calculation_Functions::VALUE();
        }
        return (float) $value;
    }
659048
protected function transformValue($value)
    {
        // first of all remove any quotation marks
        $value = preg_replace('/("|\')(.+)("|\')/', '$2', $value);

        $this->transformToDate($value);
        $this->transformToFloat($value);
        $this->transformToInt($value);

        return $value;
    }