orc-lang / orc

Orc programming language implementation
https://orc.csres.utexas.edu/
BSD 3-Clause "New" or "Revised" License
41 stars 3 forks source link

Overflow handling for exponentiation throws an unreasonable exception in some cases #105

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Run the following snippets. They all produce different overflow handling one of 
them seems wrong to me.

1000 ** 1000 ** 1000 --> java.lang.ArithmeticException: Exponent out of range
1000.0 ** 1000.0 ** 1000.0 --> Infinity or NaN depending on JVM version I think

1000.0 ** 1000 ** 1000 --> java.lang.NumberFormatException
1000.0 ** 1000.0 ** 1000.1 --> java.lang.NumberFormatException

This last two seem to be wrong. I am fairly certain this is due to the fact 
that BigDecimal does not support infinity or NaN and non-integral so the ORC 
implementation hacks it by converting to Double for fractional powers so an NaN 
can be generated and then result in an error next time it interacts with a 
BigDecimal.

Fixing this problem specifically is kind of a stop gap because Bug #18 is a 
super set of this problem. However a quick fix to make it throw a more 
reasonable exception seems like it would be useful.

Original issue reported on code.google.com by arthur.peters on 4 Sep 2012 at 9:23

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r3137.

Original comment by jthywissen on 16 Dec 2012 at 11:59

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r3138.

Original comment by jthywissen on 17 Dec 2012 at 12:35