Hi i am new to java can anyone help me to convert this formula to java code?
=ROUNDUP(POWER(4*B18/PI(),1/3)*100,0)
So far, I have this code:
(((4*variable)/3.142)*0.34)*100;
sorry for asking basic question
In its raw (and ugly) form, it should be something like this:
static double yourFormula(double b18) {
return Math.ceil(Math.pow(4.0 * b18 / Math.PI, 1.0/3) * 100.0);
}
EDIT: As noted by @Teepeemm, Math#cbrt already calculates the cube root of a number. So the formula should be
static double yourFormula(double b18) {
return Math.ceil(Math.cbrt(4.0 * b18 / Math.PI) * 100.0);
}
Math.ceil() instead of Math.round().1.0/3.01.0/3 is just fine :).excel issue. And everyone upvotes. See the post title.double multiplies =8 * 4;
System.out.println(Math.floor(Math.pow( multiplies/ Math.PI, 1.0/3)*100.0));
double multiplies =8 * 4;
System.out.println(Math.ceil(Math.pow( multiplies/ Math.PI, 1.0/3)*100.0));
double multiplies =8 * 4;
System.out.println(Math.round(Math.pow( multiplies/ Math.PI, 1.0/3)*100.0));
depending on your usage you can use this three methods
java.lang.Mathhas all the methods you need.