normanj-bitquill commented on code in PR #3862:
URL: https://github.com/apache/calcite/pull/3862#discussion_r1683431943


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -3053,6 +3053,17 @@ public static double acos(double b0) {
     return Math.acos(b0);
   }
 
+  // ACOSD
+  /** SQL <code>ACOSD</code> operator applied to BigDecimal values. */
+  public static double acosd(BigDecimal b0) {
+    return Math.toDegrees(Math.acos(b0.doubleValue()));

Review Comment:
   I have reworked the logic for these functions to try to better match the 
behaviour of the radian versions. The summary is:
   ACOSD - returns NaN if the value is NaN or outside of -1..1
   ASIND - returns NaN if the value is NaN or outside of -1..1
   ATAND - returns NaN if the value is NaN or greater than `Double.MAX_VALUE`
   COSD - returns NaN if the value is NaN or greater than `Double.MAX_VALUE`
   SIND - returns NaN if the value is NaN or greater than `Double.MAX_VALUE`
   TAND - returns NaN if the value is NaN or greater than `Double.MAX_VALUE`
   
   When converting a `BigDecimal` value to a double, if it is larger than 
`Double.MAX_VALUE` then it becomes `Double.Infinity` and will be handled in the 
cases above.



-- 
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]

Reply via email to