Skip to content

Floating point precision not preserved when converting floats #329

@daniel-shuy

Description

@daniel-shuy

Indriya retains floating point precision when converting doubles, but not floats.
eg.

System.out.println(Quantities.getQuantity(3.524, Units.GRAM).to(Units.KILOGRAM).getValue());

prints 0.003524, but

System.out.println(Quantities.getQuantity(3.524f, Units.GRAM).to(Units.KILOGRAM).getValue());

prints 0.0035239999294281006.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions