You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2019/02/07 18:38:46 UTC

[GitHub] jadams-tresys commented on a change in pull request #179: Return xs:decimal when dividing xs:long

jadams-tresys commented on a change in pull request #179: Return xs:decimal when dividing xs:long
URL: https://github.com/apache/incubator-daffodil/pull/179#discussion_r254815348
 
 

 ##########
 File path: daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/NumericOps.scala
 ##########
 @@ -174,13 +174,7 @@ case object TimesLong extends NumericOp {
   def operate(v1: JNumber, v2: JNumber): JNumber = { asLong(v1) * asLong(v2) }
 }
 case object DivLong extends NumericOp {
-  def operate(v1: JNumber, v2: JNumber): JNumber = {
-    val v2l = asLong(v2)
-    if (v2l == 0) {
-      throw new ArithmeticException("/ by zero")
-    }
-    asDouble(v1) / v2l
-  }
+  def operate(v1: JNumber, v2: JNumber): JBigDecimal = { DivDecimal.operate(v1, v2) }
 
 Review comment:
   I threw in a quick print statement the code path does get hit still, so I think this function and the others are still necessary.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services