java.lang.Math.cbrt()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中java.lang.Math.cbrt()方法的一些代码示例,展示了Math.cbrt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Math.cbrt()方法的具体详情如下:
包路径:java.lang.Math
类名称:Math
方法名:cbrt

Math.cbrt介绍

[英]Returns the closest double approximation of the cube root of the argument.

Special cases:

  • cbrt(+0.0) = +0.0
  • cbrt(-0.0) = -0.0
  • cbrt(+infinity) = +infinity
  • cbrt(-infinity) = -infinity
  • cbrt(NaN) = NaN
    [中]

代码示例

代码示例来源:origin: libgdx/libgdx

public float apply (float a) {
    return 1 - (float)Math.cbrt(-(a - 1));
  }
};

代码示例来源:origin: libgdx/libgdx

public float apply (float a) {
    return 1 - (float)Math.cbrt(-(a - 1));
  }
};

代码示例来源:origin: libgdx/libgdx

public float apply (float a) {
    return (float)Math.cbrt(a);
  }
};

代码示例来源:origin: libgdx/libgdx

public float apply (float a) {
    return (float)Math.cbrt(a);
  }
};

代码示例来源:origin: libgdx/libgdx

/** Calls {@link #ellipse(float, float, float, float, int)} by estimating the number of segments needed for a smooth ellipse. */
public void ellipse (float x, float y, float width, float height) {
  ellipse(x, y, width, height, Math.max(1, (int)(12 * (float)Math.cbrt(Math.max(width * 0.5f, height * 0.5f)))));
}

代码示例来源:origin: libgdx/libgdx

/** Calls {@link #arc(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth arc. */
public void arc (float x, float y, float radius, float start, float degrees) {
  arc(x, y, radius, start, degrees, Math.max(1, (int)(6 * (float)Math.cbrt(radius) * (degrees / 360.0f))));
}

代码示例来源:origin: libgdx/libgdx

/** Calls {@link #circle(float, float, float, int)} by estimating the number of segments needed for a smooth circle. */
public void circle (float x, float y, float radius) {
  circle(x, y, radius, Math.max(1, (int)(6 * (float)Math.cbrt(radius))));
}

代码示例来源:origin: libgdx/libgdx

/** Calls {@link #ellipse(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth ellipse. */
public void ellipse (float x, float y, float width, float height, float rotation) {
  ellipse(x, y, width, height, rotation, Math.max(1, (int)(12 * (float)Math.cbrt(Math.max(width * 0.5f, height * 0.5f)))));
}

代码示例来源:origin: libgdx/libgdx

/** Calls {@link #circle(float, float, float, int)} by estimating the number of segments needed for a smooth circle. */
public void circle (float x, float y, float radius) {
  circle(x, y, radius, Math.max(1, (int)(6 * (float)Math.cbrt(radius))));
}

代码示例来源:origin: libgdx/libgdx

/** Calls {@link #ellipse(float, float, float, float, int)} by estimating the number of segments needed for a smooth ellipse. */
public void ellipse (float x, float y, float width, float height) {
  ellipse(x, y, width, height, Math.max(1, (int)(12 * (float)Math.cbrt(Math.max(width * 0.5f, height * 0.5f)))));
}

代码示例来源:origin: libgdx/libgdx

/** Calls {@link #arc(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth arc. */
public void arc (float x, float y, float radius, float start, float degrees) {
  arc(x, y, radius, start, degrees, Math.max(1, (int)(6 * (float)Math.cbrt(radius) * (degrees / 360.0f))));
}

代码示例来源:origin: libgdx/libgdx

/** Calls {@link #ellipse(float, float, float, float, float, int)} by estimating the number of segments needed for a smooth ellipse. */
public void ellipse (float x, float y, float width, float height, float rotation) {
  ellipse(x, y, width, height, rotation, Math.max(1, (int)(12 * (float)Math.cbrt(Math.max(width * 0.5f, height * 0.5f)))));
}

代码示例来源:origin: org.springframework.boot/spring-boot

private double f(double t) {
  return (t > (216.0 / 24389.0)) ? Math.cbrt(t)
      : (1.0 / 3.0) * Math.pow(29.0 / 6.0, 2) * t + (4.0 / 29.0);
}

代码示例来源:origin: apache/incubator-druid

@Override
 protected ExprEval eval(double param)
 {
  return ExprEval.of(Math.cbrt(param));
 }
}

代码示例来源:origin: EngineHub/WorldEdit

public static double cbrt(RValue x) throws EvaluationException {
  return Math.cbrt(x.getValue());
}

代码示例来源:origin: apache/hive

@Override
public Object evaluate(DeferredObject[] arguments) throws HiveException {
 Double val = getDoubleValue(arguments, 0, converters);
 if (val == null) {
  return null;
 }
 double cbrt = Math.cbrt(val);
 output.set(cbrt);
 return output;
}

代码示例来源:origin: apache/drill

@Override
public Object evaluate(DeferredObject[] arguments) throws HiveException {
 Double val = getDoubleValue(arguments, 0, converters);
 if (val == null) {
  return null;
 }
 double cbrt = Math.cbrt(val);
 output.set(cbrt);
 return output;
}

代码示例来源:origin: prestodb/presto

@Test
public void testCbrt()
{
  for (double doubleValue : DOUBLE_VALUES) {
    assertFunction("cbrt(" + doubleValue + ")", DOUBLE, Math.cbrt(doubleValue));
    assertFunction("cbrt(REAL '" + (float) doubleValue + "')", DOUBLE, Math.cbrt((float) doubleValue));
  }
  assertFunction("cbrt(NULL)", DOUBLE, null);
}

代码示例来源:origin: prestodb/presto

@Description("cube root")
@ScalarFunction
@SqlType(StandardTypes.DOUBLE)
public static double cbrt(@SqlType(StandardTypes.DOUBLE) double num)
{
  return Math.cbrt(num);
}

代码示例来源:origin: jtablesaw/tablesaw

default DoubleColumn cubeRoot() {
  DoubleColumn newColumn = DoubleColumn.create(name() + "[cbrt]", size());
  for (int i = 0; i < size(); i++) {
    newColumn.set(i, Math.cbrt(getDouble(i)));
  }
  return newColumn;
}

相关文章