epam / epam/parso

Zeroes being erroneously stripped by DataWriterUtil.java changing value

Open
#91 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
79
Forks
42
PR merge metrics
No merged PRs in 30d

Description

I am using

<dependency>

<groupId>com.epam</groupId>
<artifactId>parso</artifactId>
<version>2.0.14</version>
</dependency>

in my pom.xml

On line 232 of com.epam.parso.DataWriterUtil.java it seems numbers like 2.09186791907914E10 are having the zero stripped from the exponent becoming 2.09186791907914E1

The code doing this seems to be:

    private static String trimZerosFromEnd(String string) {

return string.contains(".") ? string.replaceAll("0*$", "").replaceAll("\\.$", "") : string;
}

which I believe should read

    private static String trimZerosFromEnd(String string) {

return string.contains(".") && (! string.contains("E")) ? string.replaceAll("0*$", "").replaceAll("\\.$", "") : string;
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.