本文整理了Java中java.math.BigInteger.floatValue()
方法的一些代码示例,展示了BigInteger.floatValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BigInteger.floatValue()
方法的具体详情如下:
包路径:java.math.BigInteger
类名称:BigInteger
方法名:floatValue
[英]Returns this BigInteger as a float. If this is too big to be represented as a float, then Float.POSITIVE_INFINITY or Float.NEGATIVE_INFINITY is returned. Note that not all integers in the range [-Float.MAX_VALUE, Float.MAX_VALUE] can be exactly represented as a float.
[中]以浮点形式返回此BigInteger。如果该值太大,无法表示为浮点,则为浮点。正无穷大或浮点数。返回负无穷大。请注意,[-Float.MAX_VALUE,Float.MAX_VALUE]范围内的所有整数都不能精确表示为浮点。
代码示例来源:origin: prestodb/presto
@Override
public float floatValue() { return _value.floatValue(); }
代码示例来源:origin: redisson/redisson
@Override
public float floatValue() { return _value.floatValue(); }
代码示例来源:origin: apache/drill
@Override
public float floatValue() { return _value.floatValue(); }
代码示例来源:origin: org.apache.hadoop/hadoop-common
/**
* Return percentage of cpu time spent over the time since last update.
* CPU time spent is based on elapsed jiffies multiplied by amount of
* time for 1 core. Thus, if you use 2 cores completely you would have spent
* twice the actual time between updates and this will return 200%.
*
* @return Return percentage of cpu usage since last update, {@link
* CpuTimeTracker#UNAVAILABLE} if there haven't been 2 updates more than
* {@link CpuTimeTracker#minimumTimeInterval} apart
*/
public float getCpuTrackerUsagePercent() {
if (lastSampleTime == UNAVAILABLE ||
lastSampleTime > sampleTime) {
// lastSampleTime > sampleTime may happen when the system time is changed
lastSampleTime = sampleTime;
lastCumulativeCpuTime = cumulativeCpuTime;
return cpuUsage;
}
// When lastSampleTime is sufficiently old, update cpuUsage.
// Also take a sample of the current time and cumulative CPU time for the
// use of the next calculation.
if (sampleTime > lastSampleTime + minimumTimeInterval) {
cpuUsage =
((cumulativeCpuTime.subtract(lastCumulativeCpuTime)).floatValue())
* 100F / ((float) (sampleTime - lastSampleTime));
lastSampleTime = sampleTime;
lastCumulativeCpuTime = cumulativeCpuTime;
}
return cpuUsage;
}
代码示例来源:origin: org.apache.commons/commons-math3
/**
* <p>
* Gets the fraction as a {@code float}. This calculates the fraction as
* the numerator divided by denominator.
* </p>
*
* @return the fraction as a {@code float}.
* @see java.lang.Number#floatValue()
*/
@Override
public float floatValue() {
float result = numerator.floatValue() / denominator.floatValue();
if (Double.isNaN(result)) {
// Numerator and/or denominator must be out of range:
// Calculate how far to shift them to put them in range.
int shift = FastMath.max(numerator.bitLength(),
denominator.bitLength()) - FastMath.getExponent(Float.MAX_VALUE);
result = numerator.shiftRight(shift).floatValue() /
denominator.shiftRight(shift).floatValue();
}
return result;
}
代码示例来源:origin: ethereum/ethereumj
public static String toFriendlyString(BigInteger value) {
if (value.compareTo(ETHER.value()) == 1 || value.compareTo(ETHER.value()) == 0) {
return Float.toString(value.divide(ETHER.value()).floatValue()) + " ETHER";
}
else if(value.compareTo(FINNEY.value()) == 1 || value.compareTo(FINNEY.value()) == 0) {
return Float.toString(value.divide(FINNEY.value()).floatValue()) + " FINNEY";
}
else if(value.compareTo(SZABO.value()) == 1 || value.compareTo(SZABO.value()) == 0) {
return Float.toString(value.divide(SZABO.value()).floatValue()) + " SZABO";
}
else
return Float.toString(value.divide(WEI.value()).floatValue()) + " WEI";
}
}
代码示例来源:origin: hibernate/hibernate-orm
return (X) Float.valueOf( value.floatValue() );
代码示例来源:origin: plutext/docx4j
@Override
public void setXslFO(Element foElement) {
if (((HpsMeasure)this.getObject())!=null ) {
float pts = ((HpsMeasure)this.getObject()).getVal().floatValue()/2 ;
foElement.setAttribute(FO_NAME, pts + "pt" );
} else {
//
}
}
代码示例来源:origin: plutext/docx4j
@Override
public String getCssProperty() {
if (((HpsMeasure)this.getObject())!=null ) {
float pts = ((HpsMeasure)this.getObject()).getVal().floatValue()/2 ;
return composeCss(CSS_NAME, pts + "pt" );
} else {
return CSS_NULL;
}
}
代码示例来源:origin: google/guava
public void testFloatValue() {
for (int value : TEST_INTS) {
UnsignedInteger unsignedValue = UnsignedInteger.fromIntBits(value);
assertEquals(unsignedValue.bigIntegerValue().floatValue(), unsignedValue.floatValue());
}
}
代码示例来源:origin: google/guava
public void testFloatValue() {
for (long value : TEST_LONGS) {
UnsignedLong unsignedValue = UnsignedLong.fromLongBits(value);
assertEquals(unsignedValue.bigIntegerValue().floatValue(), unsignedValue.floatValue());
}
}
代码示例来源:origin: org.apache.xmlbeans/xmlbeans
protected void set_BigInteger(BigInteger v) { set_float(v.floatValue()); }
代码示例来源:origin: davidmoten/rxjava-jdbc
return ((BigInteger) o).doubleValue();
} else if (o instanceof BigInteger && cls.isAssignableFrom(Float.class)) {
return ((BigInteger) o).floatValue();
} else if (o instanceof BigInteger && cls.isAssignableFrom(Short.class)) {
return ((BigInteger) o).shortValue();
代码示例来源:origin: com.phloc/phloc-commons-jdk5
@Override
public float floatValue ()
{
return m_aValue.floatValue ();
}
代码示例来源:origin: boonproject/boon
@Override
public float floatValue() {
return value.floatValue();
}
代码示例来源:origin: net.sourceforge.owlapi/org.semanticweb.hermit
@Override
public float floatValue() {
return m_numerator.divide(m_denominator).floatValue();
}
@Override
代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core
@Override
public Float getValue( CTRPr pr, XWPFStylesDocument document )
{
return ( pr != null && pr.isSetSz() ) ? pr.getSz().getVal().divide( new BigInteger( "2" ) ).floatValue() : null;
}
代码示例来源:origin: fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.core-gae
@Override
public Float getValue( CTParaRPr pr, XWPFStylesDocument document )
{
return ( pr != null && pr.isSetSz() ) ? pr.getSz().getVal().divide( new BigInteger( "2" ) ).floatValue() : null;
}
}
代码示例来源:origin: org.armedbear.lisp/abcl
@Override
public float floatValue()
{
float f = value.floatValue();
if (Float.isInfinite(f))
error(new TypeError("The value " + princToString() +
" is too large to be converted to a single float."));
return f;
}
代码示例来源:origin: leangen/graphql-spqr
@Override
public Object parseLiteral(Object input) {
if (input instanceof IntValue) {
return new FloatNode(((IntValue) input).getValue().floatValue());
} if (input instanceof FloatValue) {
return new FloatNode(((FloatValue) input).getValue().floatValue());
} else {
throw new CoercingParseLiteralException(errorMessage(input, IntValue.class, FloatValue.class));
}
}
});
内容来源于网络,如有侵权,请联系作者删除!