LHNCBC / ucum-lhc

LHC implementation of UCUM validation and conversion services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unexpected results from conversion of unit expression

incansvl opened this issue · comments

Note- these results were taken from the interactive demo available at https://ucum.nlm.nih.gov/ucum-lhc/demo.html.

Note: Test value deliberately chosen to be challenging/confusing for UCUM but the syntax is correct I believe.

Item Operation Input Output (Result) Comment
1 Convert to L-1.s-1 (78.2).(mmol/L)/s 9.394533251999998e+22 L-1.s-1 The string "78.2" here is interpreted by UCUM as 78 x 2, so this expression should evaluate to 156.mmol/L/s . How the numerical value ends up beginning with a 9 and with an exponent of 10^22 is hard to understand

I think the output is correct in this case. The destination units do not contain "mmol", so your result gets multiplied by a conversion factor of 6.022e+23 * 1e-3.

Very good point, i'd forgotten the impact of UCUM not including Moles as a base unit in this case (although I gather the two different NIH implementations actually differ in this respect?).

Thanks for the quick reply.

Yes, the API version would probably not permit the conversion because it has mol as a base unit.