parnoldx / nasc

Do maths like a normal person
http://parnoldx.github.io/nasc/
GNU General Public License v3.0
560 stars 37 forks source link

Percentage not working correctly #58

Closed danigamba closed 7 years ago

danigamba commented 7 years ago

When i try to sum or subtract a percentage it just sum the zero dotted value to the first number. As an example, if i do 100 - 30% = 99.7 instead of 70 as i was expecting I'm using the 0.4.3 version.

parnoldx commented 7 years ago

Actually it is working correctly in a mathematical sense. The issue is that the context (base value) of the 30 % is not 100. So your equation means 100 - (30% * 1) = 100 - 0,3 = 99,7

I know that some calculators handle this special case. The calculator lib that I use (libqalculate) does not. So either libqualculate will handle this or I NaSC must add some special case handling, which I will not do because this will introduce propably a lot of issues in other math parts. Sorry and thanks for the report.

danigamba commented 7 years ago

Okok, thanks for the explanation