[CM] cm/supercollider working

andersvi@extern.uio.no andersvi@extern.uio.no
Fri, 06 May 2005 11:24:14 +0200


Hey.  Eager to get the sc-connection running on our linuxes here.

0] (LISP-IMPLEMENTATION-TYPE)
"CMU Common Lisp"
0] (LISP-IMPLEMENTATION-VERSION)
"CMUCL CVS snapshot 2004-05"

First trap, after translating utils.scm to utils.lisp, the
compilation breaks when trying to do the function
#'u8vector->float:

(define (u8vector->float vec)
  (let ((i (u8vector->uint vec)))
    (if (zero? i)
      0.0
      (let ((val (* (if (zero? (ash i -31)) 1.0 -1.0) 
                    (expt 2 (- (logand (ash i -23) #xff) 127)) 
                    (logior #x800000 (logand i #x7fffff)) 
                    (expt 2 -23))))
        ;; scheme is not required to coerce 1*1.0 to a float if
        ;; it can prove the result is exact.
        (if (exact? val) (exact->inexact val) val)))))

Heres the lisp-version of this function:

(defun u8vector->float (vec)
  (let ((i (u8vector->uint vec)))
    (if (zerop i)
        0.0
        (let ((val
               (* (if (zerop (ash i -31)) 1.0 -1.0)
                  (expt 2 (- (logand (ash i -23) 255) 127))
                  (logior 8388608 (logand i 8388607))
                  (expt 2 -23))))
          (if (integerp val) (exact->inexact val) val)))))


And heres the error coming out:

0] Too large to be represented as a SINGLE-FLOAT:
  340282366920938463463374607431768211456
Error flushed ...