Skip to content

Arithmetic ops with offset units (e.g. temperature) should issue a warning #253

@jkeuskamp

Description

@jkeuskamp

I have encountered an issue when multiplying one temperature unit with another:

library(units)
a= set_units(20, celsius)
b=set_units(a, fahrenheit)
c=set_units(a, K)
d=set_units(2, J/K)
e=set_units(1, J/K)

I would expect that multiplying a,b, or c with d would render equal results.

Instead I find:

d * a = 296.9278 [J] 313.15 [J]
d * b = 552.3 [J] 330.9278 [J]
d * c = 296.9278 [J] 586.3 [J]

interestingly, results are correct when setting the relation to 1:

e=set_units(1, J/K)
e * a = 276.15 [J] 313.15 [J]
e * b = 276.15 [J] 313.15 [J]
e * c = 276.15 [J] 313.15 [J]

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