navinsubramani / LabVIEW-Script-Language

Developing a platform to develop scripts, compile and execute it in the LabVIEW development or run time environment
MIT License
8 stars 2 forks source link

Arithmetic operation not working correctly #25

Open pranay001 opened 5 years ago

pranay001 commented 5 years ago

variable = 1 - 2 - 6 print(variable)

for the above function we are getting the result as +5, but it has to be -7.

navinsubramani commented 5 years ago

Yes, this a bug and we will not handle now. Let this be in the backlog. We can use the brackets to make the function work properly. The reason for the issue is the arithmetic operation happens from the right to left so (2-6) is done first and then 1-(-4) is done next. We can avoid this by using (1-2)-6