DECIMAL-NUMBER
This is one of the hypothetical Common Lisp Utilities. (See also Decimals and wu-decimal.)

TRT = implement General Decimal Arithmetic spec

temporary hack ...

(use-package "SPLIT-SEQUENCE") (defun constituentp (char &optional (rt *readtable*)) #+cmu19 (lisp::constituentp char rt)) (defun read-string-while (test &optional (stream *standard-input*) (eof-value nil) (recursive-p nil)) (coerce (loop as x = (peek-char nil stream nil eof-value recursive-p) while (and (not (equal x eof-value)) (funcall test x)) collect (read-char stream nil eof-value recursive-p)) 'string)) (defun decimal-reader (s c n) (declare (ignore c n)) (parse-decimal (read-string-while #'constituentp s nil t))) (defun parse-decimal (str) (let* ((parts (split-sequence #\. str)) (a (car parts)) (b (cadr parts)) (a1 (parse-integer a)) (b1 (or (parse-integer (or b "0") :junk-allowed t) 0))) (+ a1 (/ b1 (expt 10 (length b)))))) (defun use-decimal () (set-dispatch-macro-character #\# #\D #'decimal-reader *readtable*))