Add config("complex_space") to control spaces around + or - in complex values

Added config("fraction_space", boolean) to help/config, along with
a few few minor text improvements.  Updated cal/regress to test
config("tilde_space").

Added config("complex_space", boolean).  The "complex_space" controls
whether or not a space (' ') is printed before and after the + or -
in complex values.

By default, config("complex_space") is false.

For example, with the default, config("complex_space", 0):

    ; asin(2)
	    1.57079632679489661923-1.31695789692481670863i

With config("complex_space", 1):

    ; asin(2)
	    1.57079632679489661923 - 1.31695789692481670863i

NOTE: Use of config("complex_space", 1) can break printing and scanning
      of fractional values via "%r".

NOTE: Use of config("complex_space", 1) can break printing and scanning
      of complex values via "%c".

Added config("complex_space", boolean) to help/config, along with
a few few minor text improvements.  Updated cal/regress to test
config("complex_space").
This commit is contained in:
Landon Curt Noll
2022-12-04 00:53:15 -08:00
parent 348f3ed427
commit f4f19f21dc
5 changed files with 101 additions and 34 deletions

View File

@@ -96,6 +96,7 @@
#define CONFIG_HZ 46
#define CONFIG_TILDE_SPACE 47
#define CONFIG_FRACTION_SPACE 48
#define CONFIG_COMPLEX_SPACE 49
/*
@@ -125,7 +126,7 @@ struct config {
int outmode2; /* current secondary output mode */
LEN outdigits; /* current output digits for float or exp */
NUMBER *epsilon; /* default error for real functions */
long epsilonprec; /* epsilon binary precision (tied to epsilon) */
long epsilonprec; /* epsilon binary precision (tied to epsilon) */
FLAG traceflags; /* tracing flags */
LEN maxprint; /* number of elements to print */
LEN mul2; /* size of number to use multiply algorithm 2 */
@@ -134,6 +135,8 @@ struct config {
LEN redc2; /* size of modulus to use REDC algorithm 2 */
BOOL tilde_ok; /* OK to print a tilde on approximations */
BOOL tilde_space; /* print space after tilde on approximations */
BOOL fraction_space; /* TRUE => print spaces around / in fractions */
BOOL complex_space; /* TRUE => print spaces around + or - in complex values */
BOOL tab_ok; /* OK to print tab before numeric values */
LEN quomod; /* quomod() default rounding mode */
LEN quo; /* quotient // default rounding mode */
@@ -168,7 +171,6 @@ struct config {
int baseb; /* base for calculations */
BOOL redecl_warn; /* TRUE => warn of redeclaring variables */
BOOL dupvar_warn; /* TRUE => warn of var name collisions */
BOOL fraction_space; /* TRUE => print spaces around / in fractions */
};
typedef struct config CONFIG;