Skip to content

Zeroes being erroneously stripped by DataWriterUtil.java changing value #91

Open
@benclarktd

Description

@benclarktd

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;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions