c3d / db48x

RPL runtime for the DM42 calculator, in the spirit of HP48/49/50
http://48calc.org
GNU Lesser General Public License v3.0
113 stars 13 forks source link

Two definitions of Ohm (was `UBASE` is broken) #1224

Closed c3d closed 1 month ago

c3d commented 1 month ago

Computing 1/sqrt(epsilon0.mu0) gives the correct unit, but UBASE after that gives something totally nonsensical.

c3d commented 1 month ago

The result is actually correct, but runs into a problem with unit definition change introduced in commit 4c75e9c8. The problem is that there are two unicode characters that can be used for Ohm: Ω (Unicode 937, Greek Capital Letter Ohmega) and (Unicode 8486, Ohm Sign).

Initially, the choice was made to use 8486, since this is dedicated to this particular unit. However, when Jean Wilson submitted his equations, they failed with Inconsistent units errors, because he had used the "regular" capital Omega. I reasoned at the time that not using a dedicated character was consistent with what happens with other units. For example, we don't use a special A for Ampere.

Unfortunately, there was a leftover (U8436) in the definition of alternate spelling ohm, and it turns out that ohm itself was used in the definition of H (Henry), which is used in the unit for μ0 (H/m). So now we had two units that were spelled the same way, and 1_H UBASE would give 1_Ω*s, which did not match the "Ohm" in the definition of F.

So UBASE itself works fine, it's the unit definitions that had a problem.