Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to extend units breaks to the left #40

Closed
hughjonesd opened this issue Sep 5, 2022 · 3 comments
Closed

Fails to extend units breaks to the left #40

hughjonesd opened this issue Sep 5, 2022 · 3 comments

Comments

@hughjonesd
Copy link
Owner

x <- set_units(1:10, cm)
br <- set_units(2:4, `in`)
chop(x, br)
Error in `santoku_cast_common()`:
! Can't convert from `..2` <double> to <integer> due to loss of precision.
• Locations: 1, 2, 3

This doesn't seem to always happen:

x <- set_units(1:10 * 10, cm)
br <- set_units(1:3, ft)
chop(x, br)
# works
@hughjonesd
Copy link
Owner Author

The underlying bug, if it is a bug, is r-quantities/units#324.

@hughjonesd
Copy link
Owner Author

A workaround is:

x <- set_units(as.double(1:10), cm)
br <- set_units(2:4, `in`)
chop(x, br)

@hughjonesd
Copy link
Owner Author

Fixed in units 0.8.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant