Project

Profile

Help

Feature #4823

closed

Decimal Precision

Added by Svante Schubert about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2020-11-12
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10, 9.9
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

I am doing some evaluation if XSLT can be used for testing accuracy on EU e-invoices (EN16931). My simple stylesheet does no longer compile when I update to the latest Saxon version. Both input & XSLT attached and a quick Maven running environment zipped.

In addition, likely an own feature request, I desire the best decimal-based floating-point precision Java can offer for enhancing the existing EU e-invoice Schematron reference implementation - https://github.com/ConnectingEurope/eInvoicing-EN16931. But this parameter I found in 10.3 concerns me a bit: https://github.com/svanteschubert/Saxon-HE/blob/main/src/main/java/net/sf/saxon/value/BigDecimalValue.java#L30 (don't worry, just a temporary fork to show & tell and to be able to debug).

The problem in detail: <xsl:value-of select="($quantity * ($priceAmount div $baseQuantity))" /> results into 333333333.333333333 <xsl:value-of select="($quantity * $priceAmount div $baseQuantity)" /> results into 333333333.333333333333333333

I am desiring https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/MathContext.html#DECIMAL128 Would it be possible to provide higher precision by parameter?

Best regards, Svante


Files

xslt-decimal.zip (21.2 KB) xslt-decimal.zip Svante Schubert, 2020-11-12 10:38
PEPPOL-EN16931-UBL-V2.xslt (11.7 KB) PEPPOL-EN16931-UBL-V2.xslt Svante Schubert, 2020-11-12 10:39
Sample121-new.xml (9.19 KB) Sample121-new.xml Svante Schubert, 2020-11-12 10:39
2020-11-16_17-17-25.png (18.5 KB) 2020-11-16_17-17-25.png IEEE 754 - Parameters defining basic format floating-point numbers Svante Schubert, 2020-11-16 17:18

Please register to edit this issue

Also available in: Atom PDF