From: Colin P. A. <co...@co...> - 2006-12-31 14:00:29
|
I came across what initially looked like a very strange bug, but is easily explained by arithmetic overflow: Given a DT_DATE_TIME_DURATION with the following components: year: 0 month: 0 day: 1234567890 hour: 1234567890 minute: 1234567890 second: 1234567890 millisecond: 125 Then millisecond_count returns a value of 45919373 instead of the true figure of 450435271316490125. Obviously, the example is very contrived (it comes from the W3C XSLT test suite), but it makes me wonder if anything can be done about this. There is no post-condition violation against millisecond_count, as the post-condition calculation suffers the same fate as the body. This particular example could be solved by changing the result type to INTEGER_64, but that doesn't change the principle - that the result is only meaningfull if no arithmetic overflow occurs. Is there a way to detect this? -- Colin Adams Preston Lancashire |