Oct-02-2017, 02:16 AM
I am writing a function using the greedy algorithm and with this algorithm the dollars must be converted to cents.
One of the values is 1.15, however in idle;
when I multiply by 100 the output is 114.99999999999999 instead of 115 which messes up the math
Is there another way to convert the dollars to cents?
One of the values is 1.15, however in idle;
1.15*100 114.99999999999999
when I multiply by 100 the output is 114.99999999999999 instead of 115 which messes up the math
Is there another way to convert the dollars to cents?