Initial commit
This commit is contained in:
commit
d7619777af
915 changed files with 59386 additions and 0 deletions
73
includes/application/code/community/Math.php
Normal file
73
includes/application/code/community/Math.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
class Math
|
||||
{
|
||||
protected static $_singleton = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
if (extension_loaded('bcmath')) {
|
||||
self::$_singleton = new Math_Bcmath();
|
||||
} else {
|
||||
self::$_singleton = new Math_Native();
|
||||
}
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
public static function add($a, $b)
|
||||
{
|
||||
return self::getSingleton()->add($a, $b);
|
||||
}
|
||||
|
||||
public static function sub($a, $b)
|
||||
{
|
||||
return self::getSingleton()->sub($a, $b);
|
||||
}
|
||||
|
||||
public static function mul($a, $b)
|
||||
{
|
||||
return self::getSingleton()->mul($a, $b);
|
||||
}
|
||||
|
||||
public static function div($a, $b)
|
||||
{
|
||||
return self::getSingleton()->div($a, $b);
|
||||
}
|
||||
|
||||
public static function comp($a, $b)
|
||||
{
|
||||
return self::getSingleton()->comp($a, $b);
|
||||
}
|
||||
|
||||
public static function pow($a, $b)
|
||||
{
|
||||
return self::getSingleton()->pow($a, $b);
|
||||
}
|
||||
|
||||
public static function mod($a, $b)
|
||||
{
|
||||
return self::getSingleton()->mod($a, $b);
|
||||
}
|
||||
|
||||
public static function ceil($a)
|
||||
{
|
||||
return self::getSingleton()->ceil($a);
|
||||
}
|
||||
|
||||
public static function floor($a)
|
||||
{
|
||||
return self::getSingleton()->floor($a);
|
||||
}
|
||||
|
||||
public static function round($a, $range = 0)
|
||||
{
|
||||
return self::getSingleton()->round($a, $range);
|
||||
}
|
||||
|
||||
public static function render($a)
|
||||
{
|
||||
return self::getSingleton()->render($a);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue