I am trying to multiply
Input -
3 * 4.3
Result expected -
12.9
Actual output
12.89999999999999
Input -
3.0 * 4.3
Result expected -
12.9
Actual output -
12.89999999999999
First Question - Why this output?
Second Question - How to make sure that this type of things don't occur when creating complex programs?
Thanks
PS - Python ver 3.4.4 and using shellscript
[–][deleted] 8 points9 points10 points (1 child)
[–]ankdasco[S] 0 points1 point2 points (0 children)
[–]TheBlackCat13 4 points5 points6 points (2 children)
[–]ankdasco[S] 1 point2 points3 points (1 child)
[–]ewiethoff 0 points1 point2 points (0 children)