Skip to content

Rounding in units #2

Description

@philrosenberg

There is rounding when evaluating PoweredUnits whick have needsScaling set to true, so the following code fails the static assert in the current unit test code
constexpr physical positive(5.0); constexpr physical negative(-5.0); static_assert(positive * negative == sci::Physical<sci::PoweredUnit<UNIT,2>, double>(-25.0), "Test of multiplying Physicals (and equivalence of powered and multiplied units) failed");

This comes from converting to the baseEncoding then back again.

I feel there is probably a better way to organise the code, perhaps with a constexpr if to check equivalence of encoding that will ensure this rounding is removed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions