Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Continued Fractions

Name: Anonymous 2007-09-03 14:57 ID:Yg9/l8CK

(defun continued-fraction (real)
  (multiple-value-bind (integer-part fractional-part)
      (floor (rationalize real))
    (cons integer-part (if (zerop fractional-part)
               nil
               (continued-fraction (/ 1 fractional-part))))))

What does /prog/ think? Am I shooting myself in the foot by just throwing rationalize in there and hoping it works out?

Name: Anonymous 2007-09-03 16:48 ID:Yg9/l8CK

>>28
4chan.org can be posted on by anybody, so anything written there MUST be right!

Face it, you don't know shit about Lisp (&aux, zerop), English (coefficient, WTF), or LIFE.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List