TDI-31476: Serious precision loss in standard routine and undue rounding
effect https://jira.talendforge.org/browse/TDI-31476
This commit is contained in:
@@ -108,6 +108,11 @@ public class Numeric {
|
||||
*
|
||||
*/
|
||||
public static Float convertImpliedDecimalFormat(String format, String toConvert) {
|
||||
BigDecimal decimal = Numeric.convertString2BigDecimal(format,toConvert);
|
||||
return new Float(decimal.doubleValue());
|
||||
}
|
||||
|
||||
public static BigDecimal convertString2BigDecimal(String format, String toConvert) {
|
||||
long decimalPlace = 1;
|
||||
int indexOf = format.indexOf('V');
|
||||
if (indexOf > -1) {
|
||||
@@ -123,6 +128,6 @@ public class Numeric {
|
||||
}
|
||||
BigDecimal decimal = new BigDecimal(toConvert);
|
||||
decimal = decimal.divide(new BigDecimal(decimalPlace));
|
||||
return new Float(decimal.doubleValue());
|
||||
return decimal;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user