@alanz Good catch! Changed to
A rational consists of an optional
-
, followed by one or more digits0
-9
, followed by a/
, followed by one or more digits0
-9
.
I also realized the canonical representation of floats is ambiguous, it would allow both 0.1E0
and 0.01E1
. (Hopefully) fixed by changing to
Floats must be encoded such that there is a
0
left of the decimal point, a nonzero digit after the decimal point, and the exponent must always be included.
Equivalently, it could mandate to always use the lowest possible exponent (still with a single 0
left of the decimal point), but the other formulations seems easier to understand to me.
I just found a canonical float encoding in the XSD spec, which might be better than rolling my own.
Also, simply printing and reading floats is apparently rather complicated.
I fear I'll have to read the full IEEE 754 standard and at least those papers, if I want to make sdn a real thing.