0

I am working with as_integer_ratio and i have fixed numerator as 1 so far (0.1666666666).as_integer_ratio() returns (6016809102166983, 36028797018963968) but 1/6 is also return 0.1666666666 how can i get 1,6 as fractions?

  • 1
    This is not a realistic expectation, due to how to floating point numbers work. If you want to work with simple fractions, you should use the `fractions.Fraction` class from the standard library. – Karl Knechtel Jul 28 '21 at 09:42
  • Could you please provide a "test-run" with input / output, so it is possible to understand what the desired behavior should be like? Just as a formatted code block / shell output if this is a cmd line app? – C. Sederqvist Jul 28 '21 at 09:47

0 Answers0