On Wed, May 18, 2016 at 04:28:13PM -0700, Walter Bright via Digitalmars-d wrote: > On 5/18/2016 4:17 PM, Joseph Rushton Wakeling wrote: > > On Wednesday, 18 May 2016 at 23:09:28 UTC, Walter Bright wrote: > > > Now try the square root of 2. Or pi, e, etc. The irrational > > > numbers are, by definition, not representable as a ratio. > > > > Continued fraction? :-) > > Somehow I don't think gcc is using Mathematica for constant folding.
http://apt.cs.manchester.ac.uk/ftp/pub/apt/papers/drl_ieee01.pdf Side-note: continued fractions of quadratic irrationals (a + b*sqrt(c)) are periodic, so it's possible to do exact arithmetic with them using only finite storage. T -- All problems are easy in retrospect.
