LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help me fix my calculator

Hi, I recently made a calculator. It works perfectly as far as I'm aware. (it's called Calculator Logic.vi and it's attached below).
My teacher saw it and asked me to add parentheses.
So I started working on a component that breaks down any expression into a number of "parenthesized expressions", and solves every one of them individually. This component is a key step in adding parentheses functionality to my calculator.

Now the problem is: The calculator solves the parenthesized expressions incorrectly! It solves the first one correctly, and then it's clear it keeps past values in memory and they mess up the next calculations! I couldn't find the source of it.
I know it's probably a little complicated to fix, but you guys got a better chance at it than I do.

Download All
0 Kudos
Message 1 of 11
(3,891 Views)

There are missing subVIs. From the symptoms, one of your missing subVIs probably has uninitialized shift registers or feedback nodes.

 

LabVIEW includes formula parsing VIs and the code can be inspected. Maybe it can give you some ideas.

0 Kudos
Message 2 of 11
(3,865 Views)

On a side note, your while loop seems overly complicated. This does exactly the same thing:

 

ParseParenthesized.png

 

(Of course this is not quite bulletproof because it does not deal correctly with mismatched or stacked parenthesis).

 

 

 

0 Kudos
Message 3 of 11
(3,856 Views)

You could even use a conditional tunnel for even less code:

 

ParseParenthesizedConditional.png

0 Kudos
Message 4 of 11
(3,843 Views)

Okay thanks for the cleanup but I still can't solve my problem.
You said there were missing VIs so I uploaded all of them.

0 Kudos
Message 5 of 11
(3,838 Views)