float data type

The xs:float data type is patterned after the IEEE single-precision 32-bit floating point type. Derived from data type xdt:anyAtomicType.

The basic value space of xs:float consists of values that range from -3.4028234663852886e+38 to -1.1754943508222875e-38 and from +1.1754943508222875e-38 to +3.4028234663852886e+38. The value space of xs:float also includes the following special values: positive infinity, negative infinity, positive zero, negative zero, and not-a-number (NaN).

The lexical form of xs:float is a mantissa followed, optionally, by the character E or e, followed by an exponent. The exponent must be an integer. The mantissa must be a decimal number. The representations for the exponent and the mantissa must follow the lexical rules for xs:integer and xs:decimal. If the E or e and the exponent that follows are omitted, an exponent value of 0 is assumed.

Lexical forms for zero can take a positive or negative sign. The following literals are valid examples of this data type: -1E4, 1267.43233E12, 12.78e-2, 12 , -0, and 0.

The special values positive infinity, negative infinity, and not-a-number have the lexical forms INF, -INF and NaN, respectively. The lexical form for positive infinity cannot take a positive sign.

Tip: There is no literal for the special values INF, -INF and NaN. Construct the values INF, -INF, and NaN from strings by using the xs:float type constructor. For example: xs:float("INF").