Percentage Discount: Number variable/Numeric Entry has 3 decimal places
I've created a game which allows the user to work out the discount of items.
£19.99 with a 70% discount.
The student would enter the answers and then I check and see if they are correct.
I've got variables and triggers to work out the percentage discount and then I check this with the students answers in two NumericEntries.
This is what the user will type and want I would expect to be correct.
Discount = 70% of £19.99 = 13.99
Price with discount = 19.99 - 13.99 = 6
All types of text round numbers to 2 decimal places, so when I write to the screen it looks correct. However when I compare it, I'm getting an incorrect message.
I wrote the calculations to a NumericEntry to see what is going on and I found that the number variables are returning this:
Discount = 70% of £19.99 = 13.993
Price with discount = 19.99 - 13.99 = 5.997
Therefore when I do a numerical comparison, 13.993 does not equal 13.99 hence the error message.
Why do numeric values have 3 decimal places and text have 2? I can't compare them numerically, but I can't convert them to text.
Can anyone help with this, it's driving me mad.