Skip to content

Commit fc09381

Browse files
authored
Docs (#7)
1 parent e3f781e commit fc09381

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

docs/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,31 @@ echo 'Value: ' . $decimalObject;
2424

2525
It will auto-cast to string where necessary, you can force it using `(string)$decimalObject`.
2626

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-
3427
### Operations
3528

36-
These return a new object:
29+
Transformation:
3730
- `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:
4331
- `toString()`: Default casting mechanism (this method is equivalent to a cast to string).
4432
- `toFloat()`: Returns some approximation of this Decimal as a PHP native float.
4533
- `toInt()`: Returns integer value (this method is equivalent to a cast to integer).
4634

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+
4740
There is only one static method and acts as a convenience wrapper to create an object:
4841
- `create()`: Internally does `new Decimal($value)`, allows for easier chaining without need of `()` wrapping.
4942
Use this if your input can already be the `Decimal` object as it will then just be re-used. Constructor creation
5043
builds a new object.
5144

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+
5252
### Comparison
5353

5454
- `compareTo()`: Compare this Decimal to another value.

0 commit comments

Comments
 (0)