From: David Masover Date: 2009-11-19T02:23:32+09:00 Subject: Re: Exact (LISP-ish) calculations in Ruby? On Wednesday 18 November 2009 08:35:36 am Aldric Giacomoni wrote: > Has anyone written a gem for exact calculations? The kind one would find > on a LISP REPL, or when using your average HP scientific calculator? > > >> 3 / 4 > > => 3/4 This much is available through the Rational object: irb(main):001:0> Rational 3,4 => (3/4) irb(main):002:0> Rational(3) / 4 => (3/4) irb(main):003:0> Rational(3) / 4 / 12 => (1/16) I'm not sure about the rest of it, though it makes me wish I'd used Lisp for a recent project. I pretty much had to invent a symbolic equation manipulation class -- though, to be fair, I didn't look that hard for an existing one.