From 085bc7cb13213a21c5397e49457e16b580123766 Mon Sep 17 00:00:00 2001 From: Charles Turner Date: Thu, 4 Feb 2021 23:31:30 +0000 Subject: [PATCH] Make ~R cardinal counting more consistent (format #t "~R" 100) returns "hundred", whereas other Lisps tend to return "one hundred". It's arguable that both are in some sense correct (since this is not an area heavily specified anywhere), but it's not good that we're inconsistent, since we also return (format #t "~R" 1000) as "one thousand". Reported by Sudarshan S Chawathe. --- gnu/kawa/format/EnglishIntegerFormat.java | 2 +- testsuite/formatst.scm | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gnu/kawa/format/EnglishIntegerFormat.java b/gnu/kawa/format/EnglishIntegerFormat.java index 16f72e8c7..16b246199 100644 --- a/gnu/kawa/format/EnglishIntegerFormat.java +++ b/gnu/kawa/format/EnglishIntegerFormat.java @@ -78,7 +78,7 @@ public class EnglishIntegerFormat extends java.text.NumberFormat { int num100s = num / 100; num = num % 100; - if (num100s > 1) + if (num100s >= 1) { sbuf.append(ones[num100s]); sbuf.append(' '); diff --git a/testsuite/formatst.scm b/testsuite/formatst.scm index 055d03767..35a4ad23e 100644 --- a/testsuite/formatst.scm +++ b/testsuite/formatst.scm @@ -28,7 +28,7 @@ ; (newline) ; (format:abort))) -(test-begin "format" 454) +(test-begin "format" 455) (define-syntax test (syntax-rules () ((test format-args out-str) @@ -155,6 +155,7 @@ (test '("~r" 4) "four") (test '("~r" 10) "ten") (test '("~r" 19) "nineteen") +(test '("~r" 101) "one hundred one") (test '("~r" 1984) "one thousand, nine hundred eighty-four") (test '("~:r" -1984) "minus one thousand, nine hundred eighty-fourth") -- 2.27.0