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

`Inconsistent units error` converting `lb` to `kg` or `g` #1227

Closed nickapos closed 1 week ago

nickapos commented 1 month ago

Today I realised that when I try to convert lb to kg I get inconsistent units error IMG_0839 Version is 0.8

c3d commented 1 month ago

It's weird. It works for me, and works for the on-line version. Could you please share:

  1. The state file
  2. The units.csv file

Is it possible that you have some customization in units.csv?

nickapos commented 1 month ago

units.csv Demo.zip

i think I added some entries in the cycle section, nothing else. Please let me know if you need anything else.

c3d commented 1 month ago

With your file, I have the same problem. So now I can investigate.

There is another problem too: in the Quick menu, if I hit Next I get tons of garbage. Well, not exactly garbage, more precisely units from the builtin Length units.

c3d commented 3 weeks ago

Fixed one of the issues (garbage in Quick menu), but other problems remain.

The issue seems to derive from this change in the units.csv file:

@@ -21,6 +21,9 @@
 "in",           "mm"
 "mm",           "cm"
 "cm",           "in"
+"ft",           "m"
+"lb",           "kg"
+"oz",           "g"
 "USD",          "EUR"
 "EUR",          "CHF"
 "CHF",          "USD"
c3d commented 3 weeks ago

The problem was that the =Cycle section of units.csv was incorrectly used for the definition of lb, leading to an invalid definition that caused the problem. This will be fixed by skipping the =Cycle section while looking for unit definitions.