java.lang.Double.floatValue()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(185)

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

Double.floatValue介绍

[英]Returns the float value of this Double object.
[中]返回此双精度对象的浮点值。

代码示例

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

public float getValue () {
  return ((Double)spinner.getValue()).floatValue();
}

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

public float getValue () {
  return ((Double)spinner.getValue()).floatValue();
}

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

public float getValue () {
  return ((Double)spinner.getValue()).floatValue();
}

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

public float getValue () {
  return ((Double)spinner.getValue()).floatValue();
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
 public int number2intPrimitive( final Double v ) {
  return v == null ? -1 : Math.round( v.floatValue() );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public int number2intPrimitive( Double v ) throws KettleValueException {
 return Math.round( v.floatValue() );
}

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

public void showDialog () {
  JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, min, max, 0.1f));
  if (showValueDialog(spinner, description)) value = String.valueOf(((Double)spinner.getValue()).floatValue());
}

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

public void showDialog () {
  JSpinner spinner = new JSpinner(new SpinnerNumberModel(currentValue, min, max, 0.1f));
  if (showValueDialog(spinner, description)) value = String.valueOf(((Double)spinner.getValue()).floatValue());
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

protected static void readVectorFromProp(Vector3f store, FbxElement propElement) {
    float x = ((Double) propElement.properties.get(4)).floatValue();
    float y = ((Double) propElement.properties.get(5)).floatValue();
    float z = ((Double) propElement.properties.get(6)).floatValue();
    store.set(x, y, z);
  }
}

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

@JsonCreator
public static RowBasedKey fromJsonArray(final Object[] key)
{
 // Type info is lost during serde:
 // Floats may be deserialized as doubles, Longs may be deserialized as integers, convert them back
 for (int i = 0; i < key.length; i++) {
  if (key[i] instanceof Integer) {
   key[i] = ((Integer) key[i]).longValue();
  } else if (key[i] instanceof Double) {
   key[i] = ((Double) key[i]).floatValue();
  }
 }
 return new RowBasedKey(key);
}

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

/**
 * Returns the value of the node as a float.
 * @param value a model node
 * @return the value of the node as a float.
 */
public static float asFloat(ModelNode value) {
  return Double.valueOf(value.asDouble()).floatValue();
}

代码示例来源:origin: MovingBlocks/Terasology

@Override
public Float get() {
  return ((Double) fieldMetadata.getValueChecked(target)).floatValue();
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public void fromElement(FbxElement element) {
  super.fromElement(element);
  for (FbxElement prop : element.getFbxProperties()) {
    String propName = (String) prop.properties.get(0);
    String propType = (String) prop.properties.get(1);
    if (propType.equals("Number")) {
      float propValue = ((Double) prop.properties.get(4)).floatValue();
      propertyToDefaultMap.put(propName, propValue);
    }
  }
}

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

@Override
public float getFloat(String name)
{
  return ((Double) decode(REAL, getFieldValue(name))).floatValue();
}

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

private static Iterable<Float> floatSequence(double start, double step, int items)
{
  return transform(doubleSequence(start, step, items), input -> {
    if (input == null) {
      return null;
    }
    return input.floatValue();
  });
}

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

@OutputFunction("map(real,real)")
  public static void output(@AggregationState DoubleHistogramAggregation.State state, BlockBuilder out)
  {
    if (state.get() == null) {
      out.appendNull();
    }
    else {
      Map<Double, Double> value = state.get().getBuckets();
      BlockBuilder entryBuilder = out.beginBlockEntry();
      for (Map.Entry<Double, Double> entry : value.entrySet()) {
        REAL.writeLong(entryBuilder, floatToRawIntBits(entry.getKey().floatValue()));
        REAL.writeLong(entryBuilder, floatToRawIntBits(entry.getValue().floatValue()));
      }
      out.closeEntry();
    }
  }
}

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

@Override
  public Graph<LongValue, NullValue, NullValue> generate(ExecutionEnvironment env) throws Exception {
    RandomGenerableFactory<JDKRandomGenerator> rnd = new JDKRandomGeneratorFactory(seed.getValue());

    long vertexCount = 1L << scale.getValue();
    long edgeCount = vertexCount * edgeFactor.getValue();

    return new org.apache.flink.graph.generator.RMatGraph<>(
        env, rnd, vertexCount, edgeCount)
      .setConstants(a.getValue().floatValue(), b.getValue().floatValue(), c.getValue().floatValue())
      .setNoise(noiseEnabled.getValue(), noise.getValue().floatValue())
      .setParallelism(parallelism.getValue().intValue())
      .generate();
  }
}

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

@Override
  public DataSet plan(Graph<K, VV, EV> graph) throws Exception {
    return graph
      .run(new org.apache.flink.graph.library.similarity.AdamicAdar<K, VV, EV>()
        .setMinimumRatio(minRatio.getValue().floatValue())
        .setMinimumScore(minScore.getValue().floatValue())
        .setMirrorResults(mirrorResults.getValue())
        .setParallelism(parallelism.getValue().intValue()));
  }
}

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

@Test
public void testFloat()
    throws Exception
{
  AccumuloRowSerializer serializer = serializerClass.getConstructor().newInstance();
  Type type = REAL;
  Float expected = 123.45678f;
  byte[] data = serializer.encode(type, expected);
  Float actual = ((Double) serializer.decode(type, data)).floatValue();
  assertEquals(actual, expected);
  deserializeData(serializer, data);
  actual = serializer.getFloat(COLUMN_NAME);
  assertEquals(actual, expected);
}

代码示例来源:origin: CalebFenton/simplify

@Test
public void canDoubleToFloat() {
  Double value = 11204.0345612345D;
  when(item.getValue()).thenReturn(value);
  when(item.getType()).thenReturn("D");
  when(instruction.getOpcode()).thenReturn(Opcode.DOUBLE_TO_FLOAT);
  op = (UnaryMathOp) opFactory.create(location, addressToLocation, vm);
  op.execute(node, mState);
  verify(mState, times(1)).assignRegister(eq(REGISTER_A), eq(new HeapItem(value.floatValue(), "F")));
  assertEquals("double-to-float r" + REGISTER_A + ", r" + REGISTER_B, op.toString());
}

相关文章