AntiCheatBase/src/main/java/utils/MathUtils.java
// Returns cube root of a no n
Returns cube root of a no n
Returns cube root of a no n
public static double cbrt(double n)
    {
        double start = 0, end = n;
        double e = 0.0000001;
        double mid = -1;
        double error = 1000;
        long ticks = 0;
        while (error > e)
        {
            mid = (start + end)/2;
            error = diff(n, mid);
            if ((mid*mid*mid) > n)
                end = mid;
            else
                start = mid;
            if(error > e && ticks++ > 3E4) {
                return -1;
            }
        }
        return mid;
    }
public static double cbrt ( double n ) { double start = 0 , end = n ; double e = 0.0000001 ; double mid = - 1 ; double error = 1000 ; long ticks = 0 ; while ( error > e ) { mid = ( start + end ) / 2 ; error = diff ( n , mid ) ; if ( ( mid * mid * mid ) > n ) end = mid ; else start = mid ; if ( error > e && ticks ++ > 3E4 ) { return - 1 ; } } return mid ; }
Returns cube root of a no n
Returns cube root of a no n
// Set start and end for binary search // Set precision // If error is less than e then mid is // our answer so return mid // If mid*mid*mid is greater than n set // end = mid // If mid*mid*mid is less than n set // start = mid