We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I am not to entirely sure but i did find this explanation online as far as the difference between the two:
Float stores an approximate value and decimal stores an exact value. In summary, exact values like money should use decimal, and approximate values like scientific measurements should use float.
So i'm assuming that the fact that the numbers we were working with were monetary, they needed to be more exact which could only have been provided by the use of decimal data types.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Blunder
You are viewing a single comment's thread. Return to all comments →
I am not to entirely sure but i did find this explanation online as far as the difference between the two:
Float stores an approximate value and decimal stores an exact value. In summary, exact values like money should use decimal, and approximate values like scientific measurements should use float.
So i'm assuming that the fact that the numbers we were working with were monetary, they needed to be more exact which could only have been provided by the use of decimal data types.