X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ffloat.lisp;h=bb60ed5607e0852d07f090a95f279b75c9847d26;hb=80304981972c91c1b3f3fca75f36dacf1fecf307;hp=ffd5f5b4ed7098925d849f04f313e82effeeb9ca;hpb=6e56c996a816d0c20f19a3fbf61a7c86b104178c;p=sbcl.git diff --git a/src/code/float.lisp b/src/code/float.lisp index ffd5f5b..bb60ed5 100644 --- a/src/code/float.lisp +++ b/src/code/float.lisp @@ -120,8 +120,8 @@ ;;; We don't want to do these DEFCONSTANTs at cross-compilation time, ;;; because the cross-compilation host might not support floating -;;; point infinities. Putting them inside a LET remove -;;; top-level-formness, so that any EVAL-WHEN trickiness in the +;;; point infinities. Putting them inside a LET removes +;;; toplevel-formness, so that any EVAL-WHEN trickiness in the ;;; DEFCONSTANT forms is suppressed. (let () (defconstant single-float-positive-infinity @@ -255,7 +255,7 @@ #!-sb-fluid (declaim (maybe-inline float-precision)) (defun float-precision (f) #!+sb-doc - "Returns a non-negative number of significant digits in its float argument. + "Return a non-negative number of significant digits in its float argument. Will be less than FLOAT-DIGITS if denormalized or zero." (macrolet ((frob (digits bias decode) `(cond ((zerop f) 0) @@ -280,7 +280,7 @@ (defun float-sign (float1 &optional (float2 (float 1 float1))) #!+sb-doc - "Returns a floating-point number that has the same sign as + "Return a floating-point number that has the same sign as float1 and, if float2 is given, has the same absolute value as float2." (declare (float float1 float2)) @@ -474,7 +474,7 @@ ;;; Dispatch to the correct type-specific i-d-f function. (defun integer-decode-float (x) #!+sb-doc - "Returns three values: + "Return three values: 1) an integer representation of the significand. 2) the exponent for the power of 2 that the significand must be multiplied by to get the actual value. This differs from the DECODE-FLOAT exponent @@ -599,7 +599,7 @@ ;;; Dispatch to the appropriate type-specific function. (defun decode-float (f) #!+sb-doc - "Returns three values: + "Return three values: 1) a floating-point number representing the significand. This is always between 0.5 (inclusive) and 1.0 (exclusive). 2) an integer representing the exponent. @@ -721,7 +721,7 @@ ;;; Dispatch to the correct type-specific scale-float function. (defun scale-float (f ex) #!+sb-doc - "Returns the value (* f (expt (float 2 f) ex)), but with no unnecessary loss + "Return the value (* f (expt (float 2 f) ex)), but with no unnecessary loss of precision or overflow." (number-dispatch ((f float)) ((single-float) @@ -864,19 +864,19 @@ uninterruptibly frob the rounding modes & do ieee round-to-integer. (exp (ldb sb!vm:double-float-exponent-byte hi-bits)) (frac (logior (ldb sb!vm:double-float-significand-byte hi-bits) sb!vm:double-float-hidden-bit)) - (shift (- exp (- sb!vm:double-float-digits sb!vm:word-bits) + (shift (- exp (- sb!vm:double-float-digits sb!vm:n-word-bits) sb!vm:double-float-bias))) (when (> exp sb!vm:double-float-normal-exponent-max) (error 'floating-point-invalid-operation :operator 'truncate :operands (list x))) - (if (<= shift (- sb!vm:word-bits sb!vm:double-float-digits)) + (if (<= shift (- sb!vm:n-word-bits sb!vm:double-float-digits)) 0 (let* ((res-hi (ash frac shift)) (res (if (plusp shift) (logior res-hi (the fixnum (ash (double-float-low-bits x) - (- shift sb!vm:word-bits)))) + (- shift sb!vm:n-word-bits)))) res-hi))) (declare (type (unsigned-byte 31) res-hi res)) (if (minusp hi-bits)