r-quantities / units

Measurement units for R
https://r-quantities.github.io/units
175 stars 28 forks source link

Integer powers above 1 #264

Closed ekatko1 closed 3 years ago

ekatko1 commented 3 years ago

Thanks again for the great package! Are there any plans to allow non-integer exponents greater than 1?

> set_units(5, m^2)^(3/2)
Error in Ops.units(set_units(5, m^2), (3/2)) : 
  currently you can only take integer powers of units above 1
Enchufa2 commented 3 years ago

Good point. We'll look into this.

ekatko1 commented 3 years ago

@Enchufa2 Thanks for the fix!

A related issue is for setting numbers that actually have non-integer units. e.g.:

> set_units(1, cm^(3/2))
Error: currently you can only take integer powers of units above 1
Did you try to supply a value in a context where a bare expression was expected?

Should I open a new issue for this? Thanks! Egor

Enchufa2 commented 3 years ago

No, that is actually intended: non-integer exponents have no physical meaning and are not supported by UDUNITS-2, so units won't support them either.