public static function canResize($imagePath) { $pictureInfo = getimagesize($imagePath); $memoryNeeded = round(($pictureInfo[0] * $pictureInfo[1] * $pictureInfo['bits'] * $pictureInfo['channels'] / 8 + Math::power(2, 16)) * 1.65); $memoryLimit = str_replace('M', '', Config::getMemoryLimit()) * Math::power(2, 20); return $memoryLimit > $memoryNeeded + memory_get_usage(TRUE) ? TRUE : FALSE; }
public static function discriminant3($a, $b, $c, $d) { return 18 * $a * $b * $c * $d - 4 * Math::power($b, 3) * $d + Math::power($b, 2) * Math::power($c, 2) - 4 * $a * Math::power($c, 3) - 27 * Math::power($a, 2) * Math::power($d, 2); }
public function numberPower($number) { if (!Validator::isNumber($number)) { throw new IllegalArgumentException(); } $newMatrix = []; for ($i = 0; $i < $this->getMatrixSizeA(); $i++) { for ($j = 0; $j < $this->getMatrixSizeB(); $j++) { $newMatrix[$i][$j] = Math::power($this->getMatrix()[$i][$j], $number); } } return new Matrix($newMatrix); }
public static function getFibonacci($x) { static $gro5; $gro5 = Math::squareRoot(5); $fi = (1 + $gro5) / 2; return Math::power($fi, $x) / $gro5 - Math::power(1 - $fi, $x) / $gro5; }