You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Stéphane LARSON (JIRA)" <ji...@apache.org> on 2016/11/23 14:10:58 UTC
[jira] [Commented] (GROOVY-2675) BigDecimalMath.MAX_DIVISION_SCALE
is hard-coded to 10 digits
[ https://issues.apache.org/jira/browse/GROOVY-2675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15690198#comment-15690198 ]
Stéphane LARSON commented on GROOVY-2675:
-----------------------------------------
As I'm using Groovy as a scientific calculation langage, data loss beyond 10 digits (after the period ) is really annoying.
Considering that this problem is old and no parameterizable solution seems on his way, could it be possible to upgrade this limit far beyond 10 ?
For comparison Excel round at his 15th digit and the windows Calc.exe at 32 digit ... 10 is, on my opinion, far *too weak* (even Excel is better, lol).
It could be done easily in the class org.codehaus.groovy.runtime.typehandling.BigDecimalMath with a simple replacement :
public static final int DIVISION_EXTRA_PRECISION = 10;
by
public static final int DIVISION_EXTRA_PRECISION = 32;
and
public static final int DIVISION_MIN_SCALE = 10;
by
public static final int DIVISION_MIN_SCALE = 32;
> BigDecimalMath.MAX_DIVISION_SCALE is hard-coded to 10 digits
> ------------------------------------------------------------
>
> Key: GROOVY-2675
> URL: https://issues.apache.org/jira/browse/GROOVY-2675
> Project: Groovy
> Issue Type: Improvement
> Components: groovy-jdk
> Affects Versions: 1.5.4
> Reporter: Steve Hanmann
>
> The "scale" for BigDecimal division is hard-coded to 10 (BigDecimalMath.MAX_DIVISION_SCALE), which is fewer than the roughly equivalent 16-17 digits for double (64-bit) division. It seems like the default scale should be at least as accurate as double division. Also it is probably desirable for this setting to be configurable in some way, maybe more than one. Maybe a global Java system property setting, and then some form of context related override (per-thread, per-script, etc.).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)