LHNCBC / ucum-lhc

LHC implementation of UCUM validation and conversion services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parentheses not evaluated when exponent in denominator

christmueller opened this issue · comments

When using the Validator on https://ucum.nlm.nih.gov/ucum-lhc/demo.html we get the following issue:
According to the provided Unit Expression Syntax Rules it should hold that:
"Parentheses may be used to override normal left-to-right evaluation of an expreession. For example kg/m.s2 divides kg by m and multiplies the result by s2. kg/(m.s2) divides kg by the result of multiplying m by s2." which aligns perfectly with 2.2 §10 "nested terms" from the ucum-specification (https://ucum.org/ucum.html).

Unfortunately i find that a

      kg/(m.s2) evaluates correctly to (kilogram/[meter*[second - time2]]), 
      kg/(s2.m) evaluates to               (kilogram/[second - time2]*meter)

, which seems to be something different. We encountered the problem when validating

      dyn.s/cm5/m2 <=> dyn.s/(cm5.m2).

I thought, that maybe exponents need to be put in parenthesis too, but that did not help either:

      kg/((s2).m) evaluates to             (kilogram/[second - time2]*meter)

This error seems to be only in the generated text description of the expression. For instance, on the Converter tab at https://ucum.nlm.nih.gov/ucum-lhc/demo.html, 1 kg/(s2.m) correctly converts to 0.01 kg/(s2.cm). I agree the description is incorrect and should be fixed.

This is now fixed.