Python Forum
method float.as_integer_ratio() always ...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
method float.as_integer_ratio() always ...
#5
my point is that both 245850922/78256779 and 884279719003555/281474976710656 give an accurate value of Pi, as precise as double type (53 bit mantissa on x86) can hold. the 2nd one is what float.as_integer_ratio() returns, but the 1st ratio is a better one because it is the smallest that can give a ratio that good. apparent float.as_integer_ratio() just uses power of two scaling. 281474976710656 == 2**48. it probably just scales the float value up until it is a whole number without any fractional part and includes the corresponding power of 2 in the tuple.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: method float.as_integer_ratio() always ... - by Skaperen - Jul-02-2019, 08:24 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020