Skip to content

Rounding issue in unit conversion #22

@WillemRomijn-werk

Description

@WillemRomijn-werk

Describe the bug
The scale is not set correctly when converting between units. This causes rounding errors in some cases.

To Reproduce

val energyInKwh = 3.75 * kiloWattHour
val energyInJoule1 = energyInKwh `as` joule
val energyInJoule2 = 13500000 * joule

energyInJoule1 shouldBe energyInJoule2 // green
energyInKwh shouldBe energyInJoule1 // green
energyInKwh shouldBe energyInJoule2 // red

Expected behavior
The 3rd assertion should be green as well

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