mihaibudiu commented on code in PR #3663:
URL: https://github.com/apache/calcite/pull/3663#discussion_r1473680350
##########
core/src/main/java/org/apache/calcite/util/Util.java:
##########
@@ -544,6 +544,21 @@ public static void println(
pw.println();
}
+ /**
+ * Formats a double value to a String ensuring that the output
+ * is in scientific notation if the value is not "special".
+ * (Special values include infinities and NaN.)
+ */
+ public static String toScientificNotation(Double d) {
Review Comment:
Unfortunately there is no bijection. This conversion is lossy in both
directions, from String to Double and from Double to String. This method is not
100% adequate for generating SQL, but it is adequate for e.g., displaying
plans.
However, the lossy conversion problem already exists in Calcite and is not
specific to DOUBLE values: see
https://issues.apache.org/jira/browse/CALCITE-5987. I have discussed in a
message on the dev list about how this separate issue can be tackled.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]