1 (declare (special $floatformat floatmax floatmin floatsmall
2 floatbig floatbigbig float-enote
))
5 (defmvar $floatformat t
)
12 (defmvar floatbigbig
1)
13 (defmvar floatsmall
3)
14 (defmvar float-enote
2)
16 (putprop 'makestring1
(get 'makestring
'subr
) 'subr
)
18 (defun makestring (form)
19 (cond ((and $floatformat
(floatp form
)) (nicefloat form
))
20 ((makestring1 form
))))
22 (defun nicefloat (flt)
23 (cond ((= flt
0.0) (list 48.
46.
48.
))
24 ((< flt
0.0) (cons 45.
(niceflt (abs flt
))))
25 ((niceflt (abs flt
)))))
31 (fac (cond ((< aflt
1.0) 1e1
) (1e-1)))
32 (inc (cond ((< aflt
1.0) -
1) (1))))
33 ((and (< simflt
1e1
) (not (< simflt
1.0)))
34 (floatcheck (exploden simflt
) i
))
35 (setq simflt
(* simflt fac
))
38 (defun floatcheck (repres pwr
)
39 (declare (fixnum pwr
))
41 ((or (> pwr
(1- floatmax
)) (< pwr floatmin
))
44 (append (fracgen (cddr repres
) float-enote nil
)
45 (cons 69.
(cond ((> pwr
0)
46 (cons 43 (exploden pwr
)))
47 ((exploden pwr
))))))))
52 (cond ((equal frac
'(48.
)) frac
)
53 ((append (fraczeros (1- (abs pwr
)))
55 (fracgen (delete 46. repres
) floatsmall nil
)))
57 (floatnone (cddr repres
)
59 (cond ((< pwr
3.
) floatbig
)
64 (cond ((zerop n
) nil
) ((cons 48.
(fraczeros (1- n
))))))
66 (defun floatnone (repres pwr floatfrac
)
67 (declare (fixnum pwr floatfrac
))
68 (cond ((zerop pwr
) (cons 46.
(fracgen repres floatfrac nil
)))
69 ((cons (cond (repres (car repres
)) (48.
))
70 (floatnone (cdr repres
) (1- pwr
) floatfrac
)))))
72 (defun felimin (revrep)
73 (cond ((null revrep
) (ncons 48.
))
74 ((= (car revrep
) 48.
) (felimin (cdr revrep
)))
77 (defun fracgen (repres floatfrac result
)
78 (declare (fixnum floatfrac
))
79 (cond ((null repres
) (felimin result
))
80 ((zerop floatfrac
) (felimin result
))
81 ((fracgen (cdr repres
)
83 (cons (car repres
) result
)))))