Class NonFiniteDoubles
Live-verified. The words are matched CASE-INSENSITIVELY and a sign may lead them, with one measured
asymmetry: in a DOCUMENT, +NaN is read and -NaN is not.
★ A CAST DOES NOT SHARE THAT ASYMMETRY. Live answers NaN for '-nan'::FLOAT, so the two
readers are deliberately different — parse(java.lang.String) is the document's and parseForCast(java.lang.String) is
the cast's — where a single reader would have to refuse a value one of the two accepts.
Their ORDER is not IEEE. Snowflake gives NaN a place in the total order rather than leaving it
incomparable: it EQUALS ITSELF and sorts ABOVE every other value, so
ORDER BY ends -Infinity, 1, Infinity, NaN. That is exactly what
Double.compare(double, double) does, which is why comparison routes through it rather than
through the == a primitive double would use.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisNonFinite(Number value) Whether this is a non-finite DOUBLE.static DoubleThe double a non-finite word stands for, or null where the text is not one.static DoubleparseForCast(String raw) The same words asparse(java.lang.String), read the way a CAST reads them — where a NEGATIVE NaN is ACCEPTED.
-
Method Details
-
parse
The double a non-finite word stands for, or null where the text is not one. -
parseForCast
The same words asparse(java.lang.String), read the way a CAST reads them — where a NEGATIVE NaN is ACCEPTED.★ THE SIGN RULE IS NOT ONE RULE. In a JSON DOCUMENT it is asymmetric and measured:
+NaNparses and-NaNis refused. A CAST does not follow that — live answers NaN for'-nan'::FLOATas readily as for'+nan'— so the two readers have to differ, and applying the document's rule to the cast refused a value live accepts.- Parameters:
raw- the text being cast- Returns:
- the double it stands for, or null where the text is not a non-finite word
-
isNonFinite
Whether this is a non-finite DOUBLE. A BigDecimal too large to fit a double does NOT count — it is an exact number that merely overflows on conversion, and it keeps its exact comparison.
-