XML technologies / XML Schema / Data type reference / xs:float

(Excerpt from “XML Schema” by Eric van der Vlist)

IEEE 32-bit floating-point numbers

Derived from: xs:anySimpleType

Primitive type: xs:float

Known subtypes: none

Facets: xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace

Definition

<xs:simpleType name="float" id="float">
    <xs:restriction base="xs:anySimpleType">
        <xs:whiteSpace value="collapse" fixed="true"/>
    </xs:restriction>
</xs:simpleType>

Description

The value space of xs:double consists of IEEE single-precision floating-point numbers, 32-bit float. The lexical space uses decimal format with optional exponential notation. Mapping the lexical space, powers of ten, to the value space, powers of two, is approximate and uses the nearest value.

This data type distinguishes positive 0 from negative -0 and includes special values -INF, negative infinity, INF, positive infinity, and NaN, Not a Number.

The lexical spaces of xs:float and xs:double are identical; only the precision of mapping into the value space differs.

Restrictions

The decimal separator is always a period (.), and no thousands separator is allowed.

Example

Valid values include: "123.456", "+1234.456", "-1.2344e56", "-.45E-6", "INF", "-INF" or "NaN".

The following values would be invalid: "1234.4E 56" (spaces are forbidden), "1E+2.5" (the decimal exponent must be an integer), "+INF" (positive infinity takes no sign) or "NAN" (special values are case-sensitive).

   

 

 

 

back to top