I am trying to multiply two decimals but Python 3 does not seem to respect the fact the numbers are decimals.
The basic code I have is:
val1 = 0.00141643059490085
val2 = 0.00623423464234545
Res = val1 * val2
print(str(Res))
The result I am getting is 8.830360683208854e-06 which obviously is not correct.
It appears to be stripping the decimal and zeros and just multiplying the remaining number.
>Solution :
8.830360683208854e-06
Do you know what does it mean? It’s just scientific notation.
You can read it as the following.
8.830360683208854multiplied by10elevated to an exponent of-6
So the result of the sum is correct, but you may want to format the float in a different way, in this case I suggest to read this post.