Decimal Numbers in Formulas Question

Decimal Numbers in Formulas Question

by Wendy Harper -
Number of replies: 2

I can not figure out why this question works sometimes and other times it marks the answer wrong.   Are there any bugs with decimal answers?
Thank you


https://moodle.org/pluginfile.php/134/mod_forum/post/1691226/questions-MSII-LB-Operations%20with%20Money-20210314-2017.xml
Average of ratings: -
In reply to Wendy Harper

Re: Decimal Numbers in Formulas Question

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Hello Wendy,

It is due to the way computers work. For example, 10 ¢ is equal to $ 0.10 but computers use binary numbers and the binary representation of 0.1 is 0.000110011001100... which only gives an approximation of decimal 0.1.

Even if you expect the answer to be $ 0.10, the computer will check against a value of $ 0.0999755859375. In other words, the computer cannot check an "exact" value of $ 0.10.

It might seem a bit silly at first, but this is how computers work. All you have to do is set the "Grading criterion", in the question settings, to "Relative error < 0.001". Then everything should work fine.
In reply to Dominique Bauer

Re: Decimal Numbers in Formulas Question

by Wendy Harper -
Thank you,
I remember reading about this. I am so grateful I asked. It was driving my students and I crazy!! Thank you!