Closed babubabu closed 3 years ago
Note: kilo(m²)
is not the same as (kilo(m))²
... with above code you are doing the former
For convenience you'd need to define your own product unit say SQUARE_KILO_METRE
.
So I'd say this is not an issue.
You're completly right. Thanks for your fast help!
Please close that issue.
Is that a point for some docs or a example test?
import javax.measure.MetricPrefix;
import javax.measure.Unit;
import javax.measure.quantity.Area;
import tech.units.indriya.unit.ProductUnit;
import tech.units.indriya.unit.Units;
...
Unit<Area> SQUARE_KILO_METRE =
new ProductUnit<>(
MetricPrefix.KILO(Units.METRE).multiply(MetricPrefix.KILO(Units.METRE)))
.asType(Area.class);
Thanks a lot. I missed the last asType()
Hi,
if I run a conversion from m² to km², I would expect the value to be multiplied with 10^-6, but its just multiplied with 10^-3
So if I ran:
Quantities.getQuantity(1000, Units.SQUARE_METRE).to(MetricPrefix.KILO(Units.SQUARE_METRE))
I would expect a Quantity like this:Quantities.getQuantity(0.001, MetricPrefix.KILO(Units.SQUARE_METRE))
what I currently get is:Quantities.getQuantity(1, MetricPrefix.KILO(Units.SQUARE_METRE))
Used Version: 2.1.1If you need more inforamations, please let me know.