Hello,
from my point of view the rounding in the function _formatDecimal is not compatible to the FacturX Specs. Specs says that round happens to the next value (Chapter 7.1.8 Rundungsregeln bei Berechnungen):
Für positive Zahlen: Aufrunden auf den nächsthöheren Wert. Beispiel: 13,455 auf zwei Nachkomma-stellen aufgerundet ergibt 13,46.
In the code is the default Rounding used, which ist ToEven and not AwayFromZero.
Hello, from my point of view the rounding in the function _formatDecimal is not compatible to the FacturX Specs. Specs says that round happens to the next value (Chapter 7.1.8 Rundungsregeln bei Berechnungen):
Für positive Zahlen: Aufrunden auf den nächsthöheren Wert. Beispiel: 13,455 auf zwei Nachkomma-stellen aufgerundet ergibt 13,46.
In the code is the default Rounding used, which ist ToEven and not AwayFromZero.
return Math.Round(value.Value, numDecimals).ToString($"F{numDecimals}", CultureInfo.InvariantCulture);
From the .Net Documentation (https://learn.microsoft.com/en-us/dotnet/api/system.math.round?view=net-8.0#system-math-round(system-decimal-system-int32)): This method uses the default rounding convention of MidpointRounding.ToEven.
Should there be an AwayFromZero in the function?
Regards, Chris