Closed UchidaMizuki closed 4 months ago
The behavior of %% provided by Ops.units() is different from that of base %%. Is this a expected behavior?
%%
Ops.units()
units::set_units(3, m) %% units::set_units(4, m) #> -1 [m] units::set_units(3 %% 4, m) #> 3 [m]
Created on 2024-02-21 with reprex v2.1.0
This behavior seems to be caused by rounding in the following code. Shouldn't we use floor() instead of round() here? https://github.com/r-quantities/units/blob/928e883c07d29ed6382a483945dc4787ab9ede0f/R/arith.R#L103-L110
floor()
round()
The behavior of
%%
provided byOps.units()
is different from that of base%%
. Is this a expected behavior?Created on 2024-02-21 with reprex v2.1.0
This behavior seems to be caused by rounding in the following code. Shouldn't we use
floor()
instead ofround()
here? https://github.com/r-quantities/units/blob/928e883c07d29ed6382a483945dc4787ab9ede0f/R/arith.R#L103-L110