1
0
mirror of https://github.com/danog/math.git synced 2024-12-13 09:47:38 +01:00
Commit Graph

13 Commits

Author SHA1 Message Date
Benjamin Morel
27bc623b70 BigNumber::of() now throws NumberFormatException instead of InvalidArgumentException
This allows to catch all of() exceptions with the parent, ArithmeticException.
2015-06-22 22:13:19 +02:00
Benjamin Morel
d6aa1007a9 Introducing a specific RoundingNecessaryException 2015-06-22 21:53:32 +02:00
Benjamin Morel
ed8e1075e2 Introducing a specific DivisionByZeroException 2015-06-22 14:12:40 +02:00
Benjamin Morel
7680dcf634 Move ArithmeticException to an Exception sub-namespace 2015-06-22 13:57:47 +02:00
Benjamin Morel
c343e0aeb9 Merge of() factory methods in BigNumber 2015-06-22 12:50:44 +02:00
Benjamin Morel
65d4dd75d6 Rename BigRational factory methods
- `BigRational::parse()` is now `of()`
- `BigRational::of()` is now `nd()`

This keeps BigRational in line with BigInteger and BigDecimal, whose `of()` factory method accepts a single parameter.
The new way to create a BigRational from two numbers is now called `nd()` for numerator/denominator.
2015-06-21 14:48:26 +02:00
Benjamin Morel
321c00281d CS fixes
Shorthand "int" and "bool" are now used instead of "integer" and "boolean".
This makes more sense as the latter are not accepted as synonyms in PHP 7 scalar type hints and return types.
2015-06-21 14:37:51 +02:00
Benjamin Morel
8f296871f2 Add BigRational::toBigDecimal() 2015-06-20 00:36:01 +02:00
Benjamin Morel
7ef1c1fa0d isFiniteDecimal() tests for negative values 2015-06-19 14:19:48 +02:00
Benjamin Morel
c9a518affc Add BigRational::isFiniteDecimal() 2015-06-19 14:10:31 +02:00
Benjamin Morel
095ae53a9b BigRational now implements Serializable
This allows for a more compact serialized representation.
2015-06-12 23:35:34 +02:00
Benjamin Morel
b1239d9f44 Add tests for lines not covered 2015-06-12 23:07:22 +02:00
Benjamin Morel
38e7c83089 Add a BigRational class to deal with fractions 2015-06-12 15:49:35 +02:00