Revision 52802
Added by Claudio Atzori almost 6 years ago
AlgorithmsTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.mapreduce; |
2 | 2 |
|
3 |
import java.math.BigDecimal; |
|
4 |
|
|
3 | 5 |
import org.apache.commons.math.util.MathUtils; |
4 | 6 |
import org.junit.Test; |
5 | 7 |
|
... | ... | |
13 | 15 |
final double th = 0.98; |
14 | 16 |
final double lb = th - 0.01; |
15 | 17 |
|
16 |
System.out.println(MathUtils.round(Algorithms.scale(0.98, lb, 1, 0, 1), 2)); |
|
18 |
final double scaled = Algorithms.scale(0.9976, lb, 1, 0, 1); |
|
19 |
System.out.println(MathUtils.round(scaled, 2, BigDecimal.ROUND_HALF_DOWN)); |
|
17 | 20 |
} |
18 | 21 |
|
19 | 22 |
} |
Also available in: Unified diff
javadoc and test