Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't alter EXPONENT when SIGNIFICAND is 0

  • Loading branch information...
commit 598de8685d6a020788cc67aa9d9f26bff3e2b16b 1 parent d1b7c88
@rpav rpav authored committed
Showing with 3 additions and 1 deletion.
  1. +3 −1 ieee-floats.lisp
View
4 ieee-floats.lisp
@@ -77,7 +77,9 @@ point numbers anymore, but also keywords."
(values 1 0 ,max-exponent))))
(t
(multiple-value-bind (significand exponent sign) (decode-float float)
- (let ((exponent (+ (1- exponent) ,exponent-offset))
+ (let ((exponent (if (= 0 significand)
+ exponent
+ (+ (1- exponent) ,exponent-offset)))
(sign (if (= sign 1.0) 0 1)))
(unless (< exponent ,(expt 2 exponent-bits))
(error "Floating point overflow when encoding ~A." float))
Please sign in to comment.
Something went wrong with that request. Please try again.