Skip to content

Commit 87a051c

Browse files
committed
add example HighPrecisionMath
1 parent de68b88 commit 87a051c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package ch.obermuhlner.math.big.example;
2+
3+
import ch.obermuhlner.math.big.BigDecimalMath;
4+
5+
import java.math.BigDecimal;
6+
import java.math.MathContext;
7+
8+
/**
9+
* Example class for a fictive project that needs a specific precision in its calculations.
10+
*/
11+
public class HighPrecisionMath {
12+
public static MathContext MATH_CONTEXT = new MathContext(100);
13+
14+
public static BigDecimal PI = BigDecimalMath.pi(MATH_CONTEXT);
15+
16+
public static BigDecimal pow(BigDecimal x, BigDecimal y) {
17+
return BigDecimalMath.pow(x, y, MATH_CONTEXT);
18+
}
19+
20+
public static BigDecimal sin(BigDecimal x) {
21+
return BigDecimalMath.sin(x, MATH_CONTEXT);
22+
}
23+
}

0 commit comments

Comments
 (0)