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
90 stars 11 forks source link

Units do not append correctly to variables in algebraic entry #1004

Open mahi2003 opened 4 months ago

mahi2003 commented 4 months ago

It appears that in algebraic entry, units from the UNIT menu append only properly to numbers — not variables:

'() 2 → ✔️ '2_m³ ' '() X → :x: 'X 1_m³ * ' (this would be valid in RPN entry, but not in algebraic entry)

This is a bit annoying when trying to make an equation with units, like in the EQN menu.

c3d commented 4 months ago

There are two issues here:

1/ Inserting the wrong thing in an expression

2/ Parsing it without reporting a syntax error.

The parsing of 'X 1_s' generates an object that actually contains the sequence of two objects. This shows as 1_ms on the screen, but when evaluated, we end up with x on the stack and a complaint that we can't multiply, too few arguments.