@@ 409-422 (lines=14) @@ | ||
406 | * @param float $number Number to cast to an integer |
|
407 | * @return int Integer value |
|
408 | */ |
|
409 | public static function INT($number) |
|
410 | { |
|
411 | $number = Functions::flattenSingleValue($number); |
|
412 | ||
413 | if (is_null($number)) { |
|
414 | return 0; |
|
415 | } elseif (is_bool($number)) { |
|
416 | return (int) $number; |
|
417 | } |
|
418 | if (is_numeric($number)) { |
|
419 | return (int) floor($number); |
|
420 | } |
|
421 | ||
422 | return Functions::VALUE(); |
|
423 | } |
|
424 | ||
425 | /** |
|
@@ 1046-1060 (lines=15) @@ | ||
1043 | * @param float $number Number to round |
|
1044 | * @return int sign value |
|
1045 | */ |
|
1046 | public static function SIGN($number) |
|
1047 | { |
|
1048 | $number = Functions::flattenSingleValue($number); |
|
1049 | ||
1050 | if (is_bool($number)) { |
|
1051 | return (int) $number; |
|
1052 | } |
|
1053 | if (is_numeric($number)) { |
|
1054 | if ($number == 0.0) { |
|
1055 | return 0; |
|
1056 | } |
|
1057 | ||
1058 | return $number / abs($number); |
|
1059 | } |
|
1060 | ||
1061 | return Functions::VALUE(); |
|
1062 | } |
|
1063 |