PluginProbe
TablePress – Tables in WordPress made easy / 3.4
TablePress – Tables in WordPress made easy v3.4
3.4 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 All 45 releases
tablepress / libraries / vendor / PhpSpreadsheet / Calculation / MathTrig / Trunc.php

Trunc.php in TablePress – Tables in WordPress made easy 3.4, at libraries/vendor/PhpSpreadsheet/Calculation/MathTrig/Trunc.php

37 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace TablePress\PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
4
5 use TablePress\PhpOffice\PhpSpreadsheet\Calculation\ArrayEnabled;
6
7 class Trunc
8 {
9 use ArrayEnabled;
10
11 /**
12 * TRUNC.
13 *
14 * Truncates value to the number of fractional digits by number_digits.
15 * This will probably not be the precise result in the unlikely
16 * event that the number of digits to the left of the decimal
17 * plus the number of digits to the right exceeds PHP_FLOAT_DIG
18 * (or possibly that value minus 1).
19 * Excel is unlikely to do any better.
20 *
21 * @param null|array<mixed>|float|string $value Or can be an array of values
22 * @param array<mixed>|float|int|string $digits Or can be an array of values
23 *
24 * @return array<mixed>|float|string Truncated value, or a string containing an error
25 * If an array of numbers is passed as an argument, then the returned result will also be an array
26 * with the same dimensions
27 */
28 public static function evaluate($value = 0, $digits = 0)
29 {
30 if (is_array($value) || is_array($digits)) {
31 return self::evaluateArrayArguments([self::class, __FUNCTION__], $value, $digits);
32 }
33
34 return Round::down($value, $digits);
35 }
36 }
37