From 7c6723db88bd0adf81f4e94e89567b3fa06751ed Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sat, 3 Dec 2022 14:02:49 -0800 Subject: [PATCH] Change tilde_space to be 0 by default --- CHANGES | 13 +++++++------ cal/regress.cal | 20 ++++++++++---------- config.c | 2 +- help/config | 5 +++-- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/CHANGES b/CHANGES index 4d8c7a2..ab4cc27 100644 --- a/CHANGES +++ b/CHANGES @@ -25,17 +25,18 @@ The following are the changes from calc version 2.14.2.0 to date: Added config("tilde_space", boolean). The "tilde_space" controls whether or not a space (' ') is printed after leading tilde ('~'). - By default, config("tilde_space") is true, which is a change - from past behavior. For example, now: + By default, config("tilde_space") is false. - ; 1/3 - ~ 0.33333333333333333333 - - With config("tilde_space", 0): + For example, with the default, config("tilde_space", 0): ; 1/3 ~0.33333333333333333333 + With config("tilde_space", 1): + + ; 1/3 + ~ 0.33333333333333333333 + To disable "tilde_space", use config("tilde_space", 0) on the command line and/or use config("tilde_space", 0),; in your ~/.calcrc. Thanks goes to for this suggestion. diff --git a/cal/regress.cal b/cal/regress.cal index 212b9d0..9e1edb5 100644 --- a/cal/regress.cal +++ b/cal/regress.cal @@ -2033,8 +2033,8 @@ define test_mode() '1685: str(0xffffffff) == \"4.294967295e9\"'); vrfy(str(3e9) == "3e9", \ '1686: str(3e9) == \"3e9\"'); - vrfy(str(1/3) == "~ 3.33333333333333333333e-1", \ - '1687: str(1/3) == \"~ 3.33333333333333333333e-1\"'); + vrfy(str(1/3) == "~3.33333333333333333333e-1", \ + '1687: str(1/3) == \"~3.33333333333333333333e-1\"'); vrfy(str(2e8) == "2e8", \ '1688: str(2e8) == \"2e8"'); vrfy(str(200e6) == "2e8", \ @@ -2054,8 +2054,8 @@ define test_mode() '1695: str(0xffffffff) == \"4.294967295e9\"'); vrfy(str(3e9) == "3e9", \ '1696: str(3e9) == \"3e9\"'); - vrfy(str(1/3) == "~ 333.33333333333333333333e-3", \ - '1697: str(1/3) == \"~ 333.33333333333333333333e-3\"'); + vrfy(str(1/3) == "~333.33333333333333333333e-3", \ + '1697: str(1/3) == \"~333.33333333333333333333e-3\"'); vrfy(str(2e8) == "200e6", \ '1698: str(2e8) == \"200e6"'); vrfy(str(200e6) == "200e6", \ @@ -2075,8 +2075,8 @@ define test_mode() '1705: str(0xffffffff) == \"4294967295\"'); vrfy(str(3e9) == "3000000000", \ '1706: str(3e9) == \"3000000000\"'); - vrfy(str(1/3) == "~ 0", \ - '1707: str(1/3) == \"~ 0\"'); + vrfy(str(1/3) == "~0", \ + '1707: str(1/3) == \"~0\"'); vrfy(str(2e8) == "200000000", \ '1708: str(2e8) == \"200000000"'); vrfy(str(200e6) == "200000000", \ @@ -2096,8 +2096,8 @@ define test_mode() '1715: str(0xffffffff) == \"4294967295\"'); vrfy(str(3e9) == "3000000000", \ '1716: str(3e9) == \"3000000000\"'); - vrfy(str(1/3) == "~ 0.33333333333333333333", \ - '1717: str(1/3) == \"~ 0.33333333333333333333"'); + vrfy(str(1/3) == "~0.33333333333333333333", \ + '1717: str(1/3) == \"~0.33333333333333333333"'); vrfy(str(2e8) == "200000000", \ '1718: str(2e8) == \"200000000"'); vrfy(str(200e6) == "200000000", \ @@ -2151,8 +2151,8 @@ define test_mode() vrfy(base2() == -10, '1745: base2() == -10'); vrfy(str(23209) == "23209 /* 23209 */", '1746: str(23209) == "23209 /* 23209 */"'); - vrfy(str(3/2) == "1.5 /* ~ 2 */", - '1747: str(3/2) == "1.5 /* ~ 2 */"'); + vrfy(str(3/2) == "1.5 /* ~2 */", + '1747: str(3/2) == "1.5 /* ~2 */"'); vrfy(base2(1000) == -10, '1748: base2(1000) == -1000'); vrfy(base2() == 1000, '1749: base2() == 1000'); diff --git a/config.c b/config.c index 01e93d3..573ebf9 100644 --- a/config.c +++ b/config.c @@ -213,7 +213,7 @@ CONFIG newstd = { /* new non-backward compatible configuration */ POW_ALG2, /* size of modulus to use REDC for powers */ REDC_ALG2, /* size of modulus to use REDC algorithm 2 */ TRUE, /* OK to print a tilde on approximations */ - TRUE, /* OK to print a space after tilde on approximations */ + FALSE, /* OK to print a space after tilde on approximations */ TRUE, /* OK to print tab before numeric values */ 0, /* quomod() default rounding mode */ 2, /* quotient // default rounding mode */ diff --git a/help/config b/help/config index a1d069e..b38660f 100644 --- a/help/config +++ b/help/config @@ -135,7 +135,7 @@ DESCRIPTION config("display", 50); 50 digits of output epsilon(epsilon() / 8); 3 bits more accuracy config("tilde", 0) disable roundoff tilde printing - config("tilde_space", 0) disable printing space after roundoff tilde + config("tilde_space", 1) enable printing space after roundoff tilde config("tab", "off") disable leading tab printing =-= @@ -382,7 +382,7 @@ DESCRIPTION printed after leading tilde ('~'). See config("tilde") above. If config("tilde") is false, then config("tilde_space") has no effect. - The initial "tilde_space" value is 1. + The initial "tilde_space" value is 0. =-= @@ -924,6 +924,7 @@ EXAMPLE pow2 40 redc2 50 tilde 1 + tilde_space 0 tab 1 quomod 0 quo 2