Closed rhardih closed 6 years ago
One thing that might be a bug though, is that when ut_get_unit_by_name
returns NULL, ut_get_status
still returns UT_SUCCESS, indicating that the "name doesn't map to a unit of system". Is that expected?
I've tried with the alternate spelling kilometre as well, but yielding the same outcome.
kilometer
isn't the name of a unit: meter
is. Similarly for kilogram
and gram
.
Instead of using ut_get_unit_by_name()
to parse unit strings, use ut_parse()
.
Ah, my mistake. Thanks for clearing that up!
Out of curiosity, how come kilogram
does return a valid unit, when only gram
should?
I misspoke. Because it's a base unit, kilogram
is the name of a unit (even though it has a prefix). The same isn't true for kilometer
.
Duly noted. Thanks again.
In the documentation, it says:
I can't seem to figure out something as simple as conversion from kilometer to meter. I get a NULL ut_type * return when asking for kilometer, although I can prefix kilo to e.g. gram and get a valid type, so I'm assuming the prefixes have loaded correctly. Color me confused.
Please see this example:
Which produces the following output:
I'm assuming this is not a bug, so what am I doing wrong?