Float.rar

  • PUDN用户
    了解作者
  • Unix_Linux
    开发工具
  • 3KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2014-06-23 10:18
    上传日期
The wrapper for the primitive type float.
Float.rar
  • Float.c
    15.8KB
内容介绍
package java.lang; /** * The wrapper for the primitive type {@code float}. * * @see java.lang.Number * @since 1.0 */ public final class Float extends Number implements Comparable<Float> { static final int EXPONENT_BIAS = 127; static final int EXPONENT_BITS = 9; static final int MANTISSA_BITS = 23; static final int NON_MANTISSA_BITS = 9; static final int SIGN_MASK = 0x80000000; static final int EXPONENT_MASK = 0x7f800000; static final int MANTISSA_MASK = 0x007fffff; private static final long serialVersionUID = -2671257302660747028L; /** * The value which the receiver represents. */ private final float value; /** * Constant for the maximum {@code float} value, (2 - 2<sup>-23</sup>) * 2<sup>127</sup>. */ public static final float MAX_VALUE = 3.40282346638528860e+38f; /** * Constant for the minimum {@code float} value, 2<sup>-149</sup>. */ public static final float MIN_VALUE = 1.40129846432481707e-45f; /** * Constant for the Not-a-Number (NaN) value of the {@code float} type. */ public static final float NaN = 0.0f / 0.0f; /** * Constant for the positive infinity value of the {@code float} type. */ public static final float POSITIVE_INFINITY = 1.0f / 0.0f; /** * Constant for the negative infinity value of the {@code float} type. */ public static final float NEGATIVE_INFINITY = -1.0f / 0.0f; /** * Constant for the smallest positive normal value of the {@code float} type. * * @since 1.6 */ public static final float MIN_NORMAL = 1.1754943508222875E-38f; /** * Maximum exponent that a finite value of the {@code float} type may have. * Equal to {@code Math.getExponent(Float.MAX_VALUE)}. * * @since 1.6 */ public static final int MAX_EXPONENT = 127; /** * Minimum exponent that a normal value of the {@code float} type may have. * Equal to {@code Math.getExponent(Float.MIN_NORMAL)}. * * @since 1.6 */ public static final int MIN_EXPONENT = -126; /** * The {@link Class} object that represents the primitive type {@code * float}. * * @since 1.1 */ @SuppressWarnings("unchecked") public static final Class<Float> TYPE = (Class<Float>) float[].class.getComponentType(); // Note: This can't be set to "float.class", since *that* is // defined to be "java.lang.Float.TYPE"; /** * Constant for the number of bits needed to represent a {@code float} in * two's complement form. * * @since 1.5 */ public static final int SIZE = 32; /** * Constructs a new {@code Float} with the specified primitive float value. * * @param value * the primitive float value to store in the new instance. */ public Float(float value) { this.value = value; } /** * Constructs a new {@code Float} with the specified primitive double value. * * @param value * the primitive double value to store in the new instance. */ public Float(double value) { this.value = (float) value; } /** * Constructs a new {@code Float} from the specified string. * * @param string * the string representation of a float value. * @throws NumberFormatException * if {@code string} can not be decoded into a float value. * @see #parseFloat(String) */ public Float(String string) throws NumberFormatException { this(parseFloat(string)); } /** * Compares this object to the specified float object to determine their * relative order. There are two special cases: * <ul> * <li>{@code Float.NaN} is equal to {@code Float.NaN} and it is greater * than any other float value, including {@code Float.POSITIVE_INFINITY};</li> * <li>+0.0f is greater than -0.0f</li> * </ul> * * @param object * the float object to compare this object to. * @return a negative value if the value of this float is less than the * value of {@code object}; 0 if the value of this float and the * value of {@code object} are equal; a positive value if the value * of this float is greater than the value of {@code object}. * @see java.lang.Comparable * @since 1.2 */ public int compareTo(Float object) { return compare(value, object.value); } @Override public byte byteValue() { return (byte) value; } @Override public double doubleValue() { return value; } /** * Tests this double for equality with {@code object}. * To be equal, {@code object} must be an instance of {@code Float} and * {@code floatToIntBits} must give the same value for both objects. * * <p>Note that, unlike {@code ==}, {@code -0.0} and {@code +0.0} compare * unequal, and {@code NaN}s compare equal by this method. * * @param object * the object to compare this float with. * @return {@code true} if the specified object is equal to this * {@code Float}; {@code false} otherwise. */ @Override public boolean equals(Object object) { return (object == this) || (object instanceof Float) && (floatToIntBits(this.value) == floatToIntBits(((Float) object).value)); } /** * Converts the specified float value to a binary representation conforming * to the IEEE 754 floating-point single precision bit layout. All * <em>Not-a-Number (NaN)</em> values are converted to a single NaN * representation ({@code 0x7fc00000}). * * @param value * the float value to convert. * @return the IEEE 754 floating-point single precision representation of * {@code value}. * @see #floatToRawIntBits(float) * @see #intBitsToFloat(int) */ public static native int floatToIntBits(float value); /** * Converts the specified float value to a binary representation conforming * to the IEEE 754 floating-point single precision bit layout. * <em>Not-a-Number (NaN)</em> values are preserved. * * @param value * the float value to convert. * @return the IEEE 754 floating-point single precision representation of * {@code value}. * @see #floatToIntBits(float) * @see #intBitsToFloat(int) */ public static native int floatToRawIntBits(float value); /** * Gets the primitive value of this float. * * @return this object's primitive value. */ @Override public float floatValue() { return value; } @Override public int hashCode() { return floatToIntBits(value); } /** * Converts the specified IEEE 754 floating-point single precision bit * pattern to a Java float value. * * @param bits * the IEEE 754 floating-point single precision representation of * a float value. * @return the float value converted from {@code bits}. * @see #floatToIntBits(float) * @see #floatToRawIntBits(float) */ public static native float intBitsToFloat(int bits); @Override public int intValue() { return (int) value; } /** * Indicates whether this object represents an infinite value. * * @return {@code true} if the value of this float is positive or negative * infinity; {@code false} otherwise. */ public boolean isInfinite() { return isInfinite(value); } /** * Indicates whether the specified float represents an infinite value. * * @param f * the float to check. * @return {@code true} if the value of {@code f} is positive or negative *
评论
    相关推荐
    • float.zip
      解析出二进制文件的内容,以float的形式输出到文本文件中。
    • float.rar
      float转成16进制的小工具,可以查看float数据在计算机内存中的表达方式!
    • Float.rar
      浮点开方算法中的恢复余数开放算法的源代码,不含激励文件
    • FloatValue.rar
      This class represents a partially evaluated float value.
    • Float.rar
      NULL 博文链接:https://2528.iteye.com/blog/792158
    • node-float:与Float Scheduler的API进行交互的Node模块
      var float = new Float({token: "my-float-api-token", user_agent: "My App <contact>"}); 构造Float对象时,您必须传递token和user_agent 。 您从(管理员)的Float仪表板获取令牌。 用户代理字符串用于Float来...
    • float32array:验证值是否为 Float32Array
      Float32Array 验证值是否为 。 安装 $ npm install validate.io-float32array 要在浏览器中使用,请使用 。 用法 var isFloat32Array = require ( 'validate.io-float32array' ) ; isFloat32Array( 值 ) 验证值...
    • Hex to Float converter
      在同一32位存储单元中, 32位二进制解释为整数或 IEEE754浮点数的输出结果. 希望对理解存储信息 和处理有用.
    • LitJsonExt 支持 float类型
      使用litjson发现解析时不支持float数据类型,所以新增一个float类型扩展的修改版本!
    • qpopper2.53.tar.Z
      pop3 server