Closed dlill closed 2 years ago
Thanks for the report. There's a special path for dealing with this kind of thing that we set up recently, and it seems there are some bugs with prefixes. I'll look into it.
One observation: all.equal
must be used in these comparisons, instead of identical
, because taking the exp of the log is necessarily going to lose some precision in some cases. For example:
x <- units::set_units(1000, "m", mode = "standard")
identical(x, exp(log(x)))
#> [1] FALSE
all.equal(x, exp(log(x)))
#> [1] TRUE
x
#> 1000 [m]
exp(log(x))
#> 1000 [m]
Thanks for this amazing package! When a unit has a prefix,
exp(log(x))
either throws an error (if the prefix modifies to values less than 1) or silently returns wrong values (when the prefix modifies to values greater than 1):Errors
Wrong values