Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/build/pkgs/ecl/patches/infloop.patch
8820 views
1
--- a/src/lsp/format.lsp
2
+++ b/src/lsp/format.lsp
3
@@ -196,6 +196,20 @@
4
;; Note that we have to compute the exponential _every_ _time_ in the loop
5
;; because multiplying just by 10.0l0 every time would lead to a greater
6
;; loss of precission.
7
+ (let ((ex (round (* exponent #.(log 2l0 10)))))
8
+ (declare (fixnum ex))
9
+ (if (minusp ex)
10
+ (loop for y of-type long-float
11
+ = (* x (the long-float (expt 10.0l0 (- ex))))
12
+ while (<= y 0.1l0)
13
+ do (decf ex)
14
+ finally (return (values y (the fixnum (+ delta ex)))))
15
+ (loop for y of-type long-float
16
+ = (/ x (the long-float (expt 10.0l0 ex)))
17
+ while (> y 1.0l0)
18
+ do (incf ex)
19
+ finally (return (values y (the fixnum (+ delta ex)))))))
20
+ #+(or)
21
(loop with ex of-type fixnum
22
= (round (* exponent #.(log 2l0 10)))
23
for y of-type long-float
24
25