@@ -24,31 +24,31 @@ echo 'Value: ' . $decimalObject;
24
24
25
25
It will auto-cast to string where necessary, you can force it using ` (string)$decimalObject ` .
26
26
27
- ### Checks
28
-
29
- Boolean checks:
30
- - ` isZero() ` : If exactly ` 0 ` .
31
- - ` isNegative() ` : If < ` 0 ` .
32
- - ` isPositive() ` : If > ` 0 ` (zero itself is not included).
33
-
34
27
### Operations
35
28
36
- These return a new object :
29
+ Transformation :
37
30
- ` sign() ` : Returns int ` 0 ` if zero, ` -1 ` if negative, or ` 1 ` if positive.
38
- - ` absolute() ` : Returns the absolute (positive) value of this decimal.
39
- - ` negation() ` : Returns the negation (positive if negative and vice versa).
40
- - ` trim() ` : Remove trailing zeros after the comma (same value, but different semantic meaning in term of precision/scale).
41
-
42
- Also:
43
31
- ` toString() ` : Default casting mechanism (this method is equivalent to a cast to string).
44
32
- ` toFloat() ` : Returns some approximation of this Decimal as a PHP native float.
45
33
- ` toInt() ` : Returns integer value (this method is equivalent to a cast to integer).
46
34
35
+ These return a new object:
36
+ - ` absolute() ` : Returns the absolute (positive) value of this decimal.
37
+ - ` negate() ` : Returns the negation (positive if negative and vice versa).
38
+ - ` trim() ` : Remove trailing zeros after the comma (same value, but different semantic meaning in term of precision/scale).
39
+
47
40
There is only one static method and acts as a convenience wrapper to create an object:
48
41
- ` create() ` : Internally does ` new Decimal($value) ` , allows for easier chaining without need of ` () ` wrapping.
49
42
Use this if your input can already be the ` Decimal ` object as it will then just be re-used. Constructor creation
50
43
builds a new object.
51
44
45
+ ### Checks
46
+
47
+ Boolean checks:
48
+ - ` isZero() ` : If exactly ` 0 ` .
49
+ - ` isNegative() ` : If < ` 0 ` .
50
+ - ` isPositive() ` : If > ` 0 ` (zero itself is not included).
51
+
52
52
### Comparison
53
53
54
54
- ` compareTo() ` : Compare this Decimal to another value.
0 commit comments