stevedlawrence 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_r254754214
 
 

 ##########
 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:
   Is this code path even possible now? I would guess that with the change 
above the convergedArgType in NumericExpression must be one of Decimal, Float, 
or Double so the case like ``("div", Long)`` and other related int types 
wouldn't even be possible. So DivLong and IDivLong would never be used. I would 
htink only DivDecimal, DivDouble, and DivFloat need to exist?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to