Bug #2765
closedsaxon:decimal-divide fails if the arguments are integers
0%
Description
The extension function saxon:decimal-divide fails if the arguments are xs:integer instances. (The signature requires xs:decimal, and xs:integer should be substitutable for xs:decimal).
Updated by Michael Kay almost 8 years ago
Fixed on the 9.8 branch by re-implementing saxon:decimal-divide as a SystemFunction in the VendorFunctionSetPE
Updated by Michael Kay almost 8 years ago
- Category set to Saxon extensions
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch 9.7, 9.8 added
- Fix Committed on Branch 9.7, 9.8 added
Fixed on the 9.7 branch by widening the signature to accept any numeric operands. This isn't quite what the spec says, but at least any call that conforms to the specified interface will now work correctly.
Updated by Michael Kay almost 8 years ago
- Status changed from Resolved to In Progress
Reopening this. I don't think it's adequate to fix this by changing the implementation of saxon:decimal-divide. It's broken because the underlying mechanism is broken, and we should fix that. When a method is declared to expect ZeroOrOne, then calling it with an integer should work.
The ideal fix would be align the Java class hierarchy more closely with the XPath type hierarchy: rename the current DecimalValue as BigDecimalValue, and have IntegerValue and BigDecimalValue both be subclasses of an abstract class DecimalValue. That change feels too disruptive for a 9.7 patch, though it might be worth considering for 9.8.
For 9.7 the best approach seems to be that the PJConverter classes ToOne, ToOneOrMore, ToZeroOrOne, and ToZeroOrMore should convert any IntegerValue instances in the input sequence to DecimalValue instances. The tricky thing is how to achieve this without imposing a cost on all uses of these converters.
Updated by Michael Kay almost 8 years ago
- Status changed from In Progress to Resolved
- Fix Committed on Branch 9.6 added
- Fix Committed on Branch deleted (
9.7, 9.8)
For 9.7 I have fixed this by ensuring that the PJConverter classes ToZeroOrOne, etc, convert IntegerValue values to DecimalValue when that is the required type.
For 9.8 I have changed the Java class hierarchy to reflect the XDM type hierarchy more closely. The old DecimalValue is renamed BigDecimalValue, and a new DecimalValue is introduced as an abstract class with BigDecimalValue and IntegerValue as subclasses.
Updated by Michael Kay almost 8 years ago
- Fix Committed on Branch 9.7, 9.8 added
- Fix Committed on Branch deleted (
9.6)
Updated by Michael Kay almost 8 years ago
- Status changed from Resolved to In Progress
Re-opened; the patch causes a crash in XSLT3 test evaluate-008.
Updated by Michael Kay almost 8 years ago
- Status changed from In Progress to Closed
Revisions to patch for 9.7 committed.
Updated by O'Neil Delpratt almost 7 years ago
- Fix Committed on Branch trunk added
- Fix Committed on Branch deleted (
9.8)
Please register to edit this issue