Division in Python unintended output

11 Views Asked by At

Working on a problem that uses a ratio of two parameters. I noticed some weird behavior with the division operator / with values < 1e-1 that have a multiple of three. For example

0.075 / 0.025 0.15 / 0.05 gives the output of 2.9999999999999996. I can't use this resultant in my solution as I have a check to ensure the ratio is a whole number. These parameters should work and confused about why this is the output.

Whereas something like 0.9 / 0.3 gives the correct output.

0

There are 0 best solutions below