1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-23 20:05:32 +02:00

(ice-9 format): Fix scaling floats with leading zeros

This commit is contained in:
Timothy Sample 2021-10-19 02:50:51 +02:00 committed by Daniel Llorens
parent 98dff7a75e
commit c85724bd0a
2 changed files with 9 additions and 3 deletions

View file

@ -121,7 +121,13 @@
;; in guile prior to 1.6.9 and 1.8.1, leading zeros were incorrectly
;; stripped, moving the decimal point and giving "25.0" here
(pass-if "string 02.5"
(string=? "2.5" (format #f "~f" "02.5"))))
(string=? "2.5" (format #f "~f" "02.5")))
(pass-if "scale with few leading zeros"
(string=? "1.23" (format #f "~,,3f" "0.00123")))
(pass-if "scale with many leading zeros"
(string=? "0.0123" (format #f "~,,1f" "0.00123"))))
;;;
;;; ~h