-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eric Obermuhlner
committed
Nov 13, 2022
1 parent
a74d36c
commit a52c3eb
Showing
4 changed files
with
99 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Release 2.3.2 | ||
|
||
# API changes | ||
|
||
## `BigRational` implements now `Serializable` | ||
|
||
The `BigRational` class implements now the `Serializable` interface and can be serialized | ||
with the standard Java approach using `ObjectInputStream` and deserialized using `ObjectOutputStream`. | ||
|
||
## `BigRational` extends now `Number` | ||
|
||
The `BigRational` class extends now from `Number` and provides the following standard methods: | ||
- `int intValue()` | ||
- `long longValue()` | ||
- `float floatValue()` | ||
- `double doubleValue()` | ||
|
||
|
||
# Bugfixes | ||
|
||
## `BigRational.toFloat()` and `BigRational.toDouble()` with large nominators/denominators | ||
|
||
The methods `BigRational.toFloat()` and `BigRational.toDouble()` failed to convert large nominators/denominators | ||
into valid `float`, respectively `double` numbers. | ||
|
||
For example: | ||
```java | ||
BigRational x = BigRational.valueOf("8.804462619980757911125181749462772084351"); | ||
System.out.println("rational : " + x.toRationalString()); | ||
System.out.println("float : " + x.toFloat()); | ||
``` | ||
|
||
would print: | ||
``` | ||
rational : 8804462619980757911125181749462772084351/1000000000000000000000000000000000000000 | ||
float : NaN | ||
``` | ||
|
||
After the fix this example prints: | ||
``` | ||
rational : 8804462619980757911125181749462772084351/1000000000000000000000000000000000000000 | ||
float : 8.804462 | ||
``` | ||
|
||
|
||
## `BigRational.toIntegerRationalString()` with small negative numbers | ||
|
||
Negative rational numbers smaller than 1 where printed without `-` sign. | ||
|
||
For example: | ||
```java | ||
BigRational v = valueOf(-1, 2); | ||
System.out.println("small negative rational toString(): " + v); | ||
System.out.println("small negative rational toIntegerRationalString(): " + v); | ||
``` | ||
|
||
would print: | ||
``` | ||
small negative rational toString(): -0.5 | ||
small negative rational toIntegerRationalString(): 1/2 | ||
``` | ||
|
||
After the fix this example prints: | ||
``` | ||
small negative rational toString(): -0.5 | ||
small negative rational toIntegerRationalString(): -1/2 | ||
``` | ||
|
||
|
||
## `BigDecimalMath.root(x, n)` faster with large n | ||
|
||
The `BigDecimalMath.root(BigDecimal, BigDecimal, MathContext)` function converged very slowly for larger values of n. | ||
|
||
This was due to a bad initial value for the Newton-Raphson approximation. | ||
|
||
Now the initial value for the Newton-Raphson approximation is calculated using double precision. | ||
If the initial value cannot be calculated using double precision the function pow(x, 1/n) is used to calculate the root. | ||
|
||
|
||
# Enhancements | ||
|
||
No enhancements. | ||
|
||
|
||
# Examples | ||
|
||
Note: The example code is available on github, but not part of the big-math library. | ||
|
||
No changes in the examples. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters