On 5 Jan 2011, at 12:20am, Igor Tandetnik wrote: > On 1/4/2011 7:11 PM, Simon Slavin wrote: >> >> >> I bet I'm not the only one here old enough to remember FORTRAN and ALGOL >> implementations with a 'RATIONAL' math type. It stored a numerator and >> denominator for each number, and had absolutely no trouble with evaluating >> >> 1/4 + 1/6 + 1/12 + 1/3 >> >> precisely and accurately. > > Did it use arbitrary precision integer library? By asking it to > evaluate, say, 1/2 + 1/3 + 1/4 + ... + 1/n, I can easily force the > library to deal with numbers on the order of n!, which of course will > quickly overflow any fixed-size registers.
Back then I was programming on a PDP11, so both numerator and denominator were probably 72 bits long. The routines always stored fractions in normalised form, so ... <spreadsheet> ... you could multiply the first 18 prime numbers together, up to 59, before it ran into problems. In practise, of course, this almost never happened. 25 years later I note that python has 'numbers.Rational' with the nom and denom as integers. But I don't know how big an integer can be. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users