FIXValue { public double asFloat() { boolean negative = false; int i = offset; if (bytes[i] == '-') { negative = true; i++; } long significand = 0; byte b = 0; while (i < offset + length) { b = bytes[i++]; if (b < '0' || b > '9') break; significand = 10 * significand + b - '0'; } if (b != '.' && i < offset + length) notFloat(); int exponent = 0; while (i < offset + length) { b = bytes[i++]; if (b < '0' || b > '9') notFloat(); significand = 10 * significand + b - '0'; exponent++; } double x = significand / POWERS_OF_TEN[exponent]; return negative ? -x : +x; } FIXValue(int capacity); byte byteAt(int index); int length(); boolean contentEquals(byte x); boolean contentEquals(byte[] x); boolean contentEquals(char x); boolean contentEquals(CharSequence x); void copyTo(byte[] bytes); void reset(); void set(FIXValue value); boolean asBoolean(); void setBoolean(boolean x); char asChar(); void setChar(char x); long asInt(); void setInt(long x); double asFloat(); void setFloat(double x, int decimals); String asString(); void asString(Appendable x); void asString(StringBuilder x); void setString(CharSequence x); void asDate(MutableDateTime x); void setDate(ReadableDateTime x); void asTimeOnly(MutableDateTime x); void setTimeOnly(ReadableDateTime x, boolean millis); void asTimestamp(MutableDateTime x); void setTimestamp(ReadableDateTime x, boolean millis); @Deprecated long asCheckSum(); void setCheckSum(long x); boolean get(ByteBuffer buffer); void put(ByteBuffer buffer); @Override String toString(); void toString(StringBuilder builder);  }
@Test public void asFloat() throws FIXValueOverflowException { get("12.50\u0001"); assertEquals(12.50, value.asFloat(), 0.01); }