Now, as well as not giving completely the wrong answer for most
larger-than-fixnum double floats, we additionally don't try to perform
arithmetic on NIL for larger-than-fixnum single-floats.
(cond
((> fractional-bits 0.5bits) (1+ shifted))
((< fractional-bits 0.5bits) shifted)
- (t (if (oddp shifted) (1+ shifted) shifted)))))
- ))
+ (t (if (oddp shifted) (1+ shifted) shifted))))
+ shifted)))
(if (minusp number)
(- rounded)
rounded)))))))
(assert (= (round 1073741823.3d0) 1073741823))
(assert (= (round 1073741823.5d0) 1073741824))
(assert (= (round 1073741823.7d0) 1073741824)))
+
+(with-test (:name :round-single-to-bignum)
+ (assert (= (round 1e14) 100000000376832))
+ (assert (= (round 1e19) 9999999980506447872)))