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

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

本文整理了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

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

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

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

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

  1. public float apply (float a) {
  2. return (float)Math.cbrt(a);
  3. }
  4. };

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

  1. public float apply (float a) {
  2. return (float)Math.cbrt(a);
  3. }
  4. };

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. @Override
  2. protected ExprEval eval(double param)
  3. {
  4. return ExprEval.of(Math.cbrt(param));
  5. }
  6. }

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

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

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

  1. @Override
  2. public Object evaluate(DeferredObject[] arguments) throws HiveException {
  3. Double val = getDoubleValue(arguments, 0, converters);
  4. if (val == null) {
  5. return null;
  6. }
  7. double cbrt = Math.cbrt(val);
  8. output.set(cbrt);
  9. return output;
  10. }

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

  1. @Override
  2. public Object evaluate(DeferredObject[] arguments) throws HiveException {
  3. Double val = getDoubleValue(arguments, 0, converters);
  4. if (val == null) {
  5. return null;
  6. }
  7. double cbrt = Math.cbrt(val);
  8. output.set(cbrt);
  9. return output;
  10. }

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

  1. @Test
  2. public void testCbrt()
  3. {
  4. for (double doubleValue : DOUBLE_VALUES) {
  5. assertFunction("cbrt(" + doubleValue + ")", DOUBLE, Math.cbrt(doubleValue));
  6. assertFunction("cbrt(REAL '" + (float) doubleValue + "')", DOUBLE, Math.cbrt((float) doubleValue));
  7. }
  8. assertFunction("cbrt(NULL)", DOUBLE, null);
  9. }

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

  1. @Description("cube root")
  2. @ScalarFunction
  3. @SqlType(StandardTypes.DOUBLE)
  4. public static double cbrt(@SqlType(StandardTypes.DOUBLE) double num)
  5. {
  6. return Math.cbrt(num);
  7. }

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

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

相关文章