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 ...
#9
looks like an increasing precision. but it missed some in the middle. i put my list on my web site since it is so big. the code that did this used ints based on 32769 digits of Pi. the original Pike code is there, too. my very first Python code was a translation of this Pike code, but i can't find it, right now. the 1864 ratios in that list were calculated in around 87 milliseconds of CPU on an i7 at 2.5 GHz under Pike 8.0. the Python version is slower because Python ints are slower than Pike ints. i'll look for that code so i can time it and put it online.

http://ipal.net/pi.ratios
http://ipal.net/intfrac.pike

calculating both ratios in the 54 bit mantissa of type double on x86, results in exactly the same value. doing it in the 65 bit mantissa of type long double on x86 may well have different results. have not tested that but a somewhat larger ratio can produce the maximum precision possible in long double. i tested this in C many years ago. on an IBM S/370 it can be much different. double has a 56 bit mantissa (less exponent range) and long double has twice that ... 112 bit mantissa (and uses 16 bytes of space). my first fractal code was done in S/370 assembler. since then i have used libgmp in C to do extremely deep Mandelbrot sets.
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-04-2019, 06:34 AM

Forum Jump:

User Panel Messages

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