- (let* ((bits (ash bits -1))
- (len (integer-length bits)))
- (cond ((> len digits)
- (aver (= len (the fixnum (1+ digits))))
- (scale-float (floatit (ash bits -1)) (1+ scale)))
- (t
- (scale-float (floatit bits) scale)))))
- (floatit (bits)
- (let ((sign (if plusp 0 1)))
- (case format
- (single-float
- (single-from-bits sign sb!vm:single-float-bias bits))
- (double-float
- (double-from-bits sign sb!vm:double-float-bias bits))
- #!+long-float
- (long-float
- (long-from-bits sign sb!vm:long-float-bias bits))))))
- (loop
- (multiple-value-bind (fraction-and-guard rem)
- (truncate shifted-num den)
- (let ((extra (- (integer-length fraction-and-guard) digits)))
- (declare (fixnum extra))
- (cond ((/= extra 1)
- (aver (> extra 1)))
- ((oddp fraction-and-guard)
- (return
- (if (zerop rem)
- (float-and-scale
- (if (zerop (logand fraction-and-guard 2))
- fraction-and-guard
- (1+ fraction-and-guard)))
- (float-and-scale (1+ fraction-and-guard)))))
- (t
- (return (float-and-scale fraction-and-guard)))))
- (setq shifted-num (ash shifted-num -1))
- (incf scale)))))))
+ (let* ((bits (ash bits -1))
+ (len (integer-length bits)))
+ (cond ((> len digits)
+ (aver (= len (the fixnum (1+ digits))))
+ (scale-float (floatit (ash bits -1)) (1+ scale)))
+ (t
+ (scale-float (floatit bits) scale)))))
+ (floatit (bits)
+ (let ((sign (if plusp 0 1)))
+ (case format
+ (single-float
+ (single-from-bits sign sb!vm:single-float-bias bits))
+ (double-float
+ (double-from-bits sign sb!vm:double-float-bias bits))
+ #!+long-float
+ (long-float
+ (long-from-bits sign sb!vm:long-float-bias bits))))))
+ (loop
+ (multiple-value-bind (fraction-and-guard rem)
+ (truncate shifted-num den)
+ (let ((extra (- (integer-length fraction-and-guard) digits)))
+ (declare (fixnum extra))
+ (cond ((/= extra 1)
+ (aver (> extra 1)))
+ ((oddp fraction-and-guard)
+ (return
+ (if (zerop rem)
+ (float-and-scale
+ (if (zerop (logand fraction-and-guard 2))
+ fraction-and-guard
+ (1+ fraction-and-guard)))
+ (float-and-scale (1+ fraction-and-guard)))))
+ (t
+ (return (float-and-scale fraction-and-guard)))))
+ (setq shifted-num (ash shifted-num -1))
+ (incf scale)))))))