FLOAT

single-precision 32-bit IEEE 754 floating point. The range of its values is beyond the scope of this discussion, but is specified in the Floating-Point Types, Formats, and Values section of the Java Language Specification.

LITERAL NOTATION: A FLOAT numeric can be expressed in decimal or scientific notation. The values may be preceded by a minus sign and must be followed by the letter ‘f’ or ‘F’:

decimal: 2.0 -4.44f
scientific: 2.4E-24F 3e2f

Converting to FLOAT

1
2
FLOAT(numeric_expr)
FLOAT(string_expr)
  1. converts a numeric expression to FLOAT value
  2. converts a string expression to FLOAT value

Expressions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
2f > 1          // => TRUE
2f < 1          // => FALSE
2f = 2          // => TRUE
2f >= 1         // => FALSE
2f <= 3         // => TRUE
2f + 1          // => 3.0
1f - 1          // => 0.0
2f * 2          // => 4.0
2f / 2          // => 1.0
5f % 2          // => 1.0
1f & 0f         // => 0
1f | 0f         // => 1
1f ^ 1f         // => 0
1f << 1d        // => 2
1f >> 1d        // => 0
1f >>> 1d       // => 0
~ 1f            // => -2
BIT_COUNT(1f)   // => 1

Parsing doubles

1
2
    FLOAT:fieldname
    CFLOAT:fieldname

See also

FLOAT, CFLOAT