Release 1.3.0
API changes
No API changes.
Bugfixes
No Bugfix changes.
Enhancements
Factory methods for BigDecimal
and BigFloat
streams
The classes BigDecimalStream
and BigFloatStream
provide factory methods for streams of BigDecimal
respectively BigFloat
elements.
Overloaded variants of range(start, end, step)
provide sequential elements equivalent to IntStream.range(start, end)
but with configurable step.
Similar methods for the rangeClosed()
(inclusive end) are available.
The streams are well behaved when used in parallel mode.
The following code snippet:
System.out.println("Range [0, 10) step 1 (using BigDecimal as input parameters)");
BigDecimalStream.range(BigDecimal.valueOf(0), BigDecimal.valueOf(10), BigDecimal.ONE, mathContext)
.forEach(System.out::println);
System.out.println("Range [0, 10) step 3 (using long as input parameters)");
BigDecimalStream.range(0, 10, 3, mathContext)
.forEach(System.out::println);
produces this output:
Range [0, 10) step 1 (using BigDecimal as input parameters)
0
1
2
3
4
5
6
7
8
9
Range [0, 12] step 3 (using long as input parameters)
0
3
6
9
12
Added BigDecimalMath.atan2(y, x)
The atan2(y, x)
function calculates the arc tangens (inverted tangens) of y / x in the range -π to π.
This is useful to calculate the angle θ from the conversion of rectangular coordinates (x, y) to polar coordinates (r, θ).
Added BigFloat.signum()
and convenience BigFloat.isNegative()
, BigFloat.isZero()
, BigFloat.isPositive()
The signum()
function and its convenience variants where added to the BigFloat
class:
BigFloat.signum()
returns -1, 0, or 1 as the value is negative, zero, or positiveBigFloat.isNegative()
returns whether the value is negativeBigFloat.isZero()
returns whether the value is zeroBigFloat.isPositive()
returns whether the value is positive
Examples
Note: The example code is available on github, but not part of the big-math library.
No changes in the examples.