java bigdecimal third root
public static long ITER = 1000;
public static BigDecimal cuberoot(BigDecimal b) {
// Specify a math context with 40 digits of precision.
MathContext mc = new MathContext(40);
BigDecimal x = new BigDecimal("1", mc);
// Search for the cube root via the Newton-Raphson loop. Output each // successive iteration's value.
for (int i = 0; i < ITER; i++) {
x = x.subtract(
x.pow(3, mc)
.subtract(b, mc)
.divide(new BigDecimal("3", mc).multiply(
x.pow(2, mc), mc), mc), mc);
}
return x;
}
Also in Java:
- java type casting
- java d'intervalle de resultat
- main class java
- split arraylist items java
- how do I change the opacity of a JButton
- never gonna give you up
- java empty array
- simple javascript to detect browser using java utils
- java replaceall single character
- counting the number of characters in a string java
- java logical operator
- java return new instance of generic type
- how to print in java
- java stream sort Collator
- how to create gravity in java
- Unhandled exception: java.lang.InterruptedException
- how to detect if someone clicks on a jpanel in java
- how to make a variable unchangeable in java
- java script removing first three indexes
- how to check how many anagrams a word has in java
- Java array multidimensional hashcode
- Compare integers java sort
- print a list java
- check java version cmd