Skip to content

Error in Unit.removeMultiplier #82

@mephenor

Description

@mephenor

method does not work correctly for multiplier < 1.0

            Unit u = new Unit(0.3, 0, Unit.Kind.SECOND, 1.0, 2, 4);

    System.out.println("Before Mult.: " + u.getMultiplier());
    System.out.println("Before Scale: " + u.getScale());

    u.removeMultiplier();

    System.out.println("After Mult.: " + u.getMultiplier());
    System.out.println("After Scale: " + u.getScale());

gives the following output:

Before Mult.: 0.3
Before Scale: 0
After Mult.: 1.0
After Scale: -1

"Math.round(exp) - exp" is negative this case. should be replaced by "Math.abs(Math.round(exp) - exp)"

Reported by: cthoens

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions