Skip to content

Commit 086afa0

Browse files
committed
release 2.3.1
1 parent 462b528 commit 086afa0

File tree

4 files changed

+94
-72
lines changed

4 files changed

+94
-72
lines changed

ch.obermuhlner.math.big/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
group = 'ch.obermuhlner'
12-
version = '2.3.0'
12+
version = '2.3.1'
1313
archivesBaseName = 'big-math'
1414

1515
ext {
@@ -82,7 +82,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
8282
}
8383

8484
artifacts {
85-
archives jar
85+
//archives jar // no longer needed tp add - will lead to duplicate
8686
archives sourcesJar
8787
archives javadocJar
8888
}

docs/releases/next_release_note.md

Lines changed: 2 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,11 @@
11
# API changes
22

3-
## `BigRational` implements now `Serializable`
4-
5-
The `BigRational` class implements now the `Serializable` interface and can be serialized
6-
with the standard Java approach using `ObjectInputStream` and deserialized using `ObjectOutputStream`.
7-
8-
## `BigRational` extends now `Number`
9-
10-
The `BigRational` class extends now from `Number` and provides the following standard methods:
11-
- `int intValue()`
12-
- `long longValue()`
13-
- `float floatValue()`
14-
- `double doubleValue()`
3+
No API changes.
154

165

176
# Bugfixes
187

19-
## `BigRational.toFloat()` and `BigRational.toDouble()` with large nominators/denominators
20-
21-
The methods `BigRational.toFloat()` and `BigRational.toDouble()` failed to convert large nominators/denominators
22-
into valid `float`, respectively `double` numbers.
23-
24-
For example:
25-
```java
26-
BigRational x = BigRational.valueOf("8.804462619980757911125181749462772084351");
27-
System.out.println("rational : " + x.toRationalString());
28-
System.out.println("float : " + x.toFloat());
29-
```
30-
31-
would print:
32-
```
33-
rational : 8804462619980757911125181749462772084351/1000000000000000000000000000000000000000
34-
float : NaN
35-
```
36-
37-
After the fix this example prints:
38-
```
39-
rational : 8804462619980757911125181749462772084351/1000000000000000000000000000000000000000
40-
float : 8.804462
41-
```
42-
43-
44-
## `BigRational.toIntegerRationalString()` with small negative numbers
45-
46-
Negative rational numbers smaller than 1 where printed without `-` sign.
47-
48-
For example:
49-
```java
50-
BigRational v = valueOf(-1, 2);
51-
System.out.println("small negative rational toString(): " + v);
52-
System.out.println("small negative rational toIntegerRationalString(): " + v);
53-
```
54-
55-
would print:
56-
```
57-
small negative rational toString(): -0.5
58-
small negative rational toIntegerRationalString(): 1/2
59-
```
60-
61-
After the fix this example prints:
62-
```
63-
small negative rational toString(): -0.5
64-
small negative rational toIntegerRationalString(): -1/2
65-
```
66-
67-
68-
## `BigDecimalMath.root(x, n)` faster with large n
69-
70-
The `BigDecimalMath.root(BigDecimal, BigDecimal, MathContext)` function converged very slowly for larger values of n.
71-
72-
This was due to a bad initial value for the Newton-Raphson approximation.
73-
74-
Now the initial value for the Newton-Raphson approximation is calculated using double precision.
75-
If the initial value cannot be calculated using double precision the function pow(x, 1/n) is used to calculate the root.
8+
No Bugfix changes.
769

7710

7811
# Enhancements

docs/releases/v2.3.1.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Release 2.3.1
2+
3+
# API changes
4+
5+
## `BigRational` implements now `Serializable`
6+
7+
The `BigRational` class implements now the `Serializable` interface and can be serialized
8+
with the standard Java approach using `ObjectInputStream` and deserialized using `ObjectOutputStream`.
9+
10+
## `BigRational` extends now `Number`
11+
12+
The `BigRational` class extends now from `Number` and provides the following standard methods:
13+
- `int intValue()`
14+
- `long longValue()`
15+
- `float floatValue()`
16+
- `double doubleValue()`
17+
18+
19+
# Bugfixes
20+
21+
## `BigRational.toFloat()` and `BigRational.toDouble()` with large nominators/denominators
22+
23+
The methods `BigRational.toFloat()` and `BigRational.toDouble()` failed to convert large nominators/denominators
24+
into valid `float`, respectively `double` numbers.
25+
26+
For example:
27+
```java
28+
BigRational x = BigRational.valueOf("8.804462619980757911125181749462772084351");
29+
System.out.println("rational : " + x.toRationalString());
30+
System.out.println("float : " + x.toFloat());
31+
```
32+
33+
would print:
34+
```
35+
rational : 8804462619980757911125181749462772084351/1000000000000000000000000000000000000000
36+
float : NaN
37+
```
38+
39+
After the fix this example prints:
40+
```
41+
rational : 8804462619980757911125181749462772084351/1000000000000000000000000000000000000000
42+
float : 8.804462
43+
```
44+
45+
46+
## `BigRational.toIntegerRationalString()` with small negative numbers
47+
48+
Negative rational numbers smaller than 1 where printed without `-` sign.
49+
50+
For example:
51+
```java
52+
BigRational v = valueOf(-1, 2);
53+
System.out.println("small negative rational toString(): " + v);
54+
System.out.println("small negative rational toIntegerRationalString(): " + v);
55+
```
56+
57+
would print:
58+
```
59+
small negative rational toString(): -0.5
60+
small negative rational toIntegerRationalString(): 1/2
61+
```
62+
63+
After the fix this example prints:
64+
```
65+
small negative rational toString(): -0.5
66+
small negative rational toIntegerRationalString(): -1/2
67+
```
68+
69+
70+
## `BigDecimalMath.root(x, n)` faster with large n
71+
72+
The `BigDecimalMath.root(BigDecimal, BigDecimal, MathContext)` function converged very slowly for larger values of n.
73+
74+
This was due to a bad initial value for the Newton-Raphson approximation.
75+
76+
Now the initial value for the Newton-Raphson approximation is calculated using double precision.
77+
If the initial value cannot be calculated using double precision the function pow(x, 1/n) is used to calculate the root.
78+
79+
80+
# Enhancements
81+
82+
No enhancements.
83+
84+
85+
# Examples
86+
87+
Note: The example code is available on github, but not part of the big-math library.
88+
89+
No changes in the examples.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>ch.obermuhlner</groupId>
66
<artifactId>big-math</artifactId>
7-
<version>2.3.0</version>
7+
<version>2.3.1</version>
88
<dependencies>
99
<dependency>
1010
<groupId>junit</groupId>

0 commit comments

Comments
 (0)