mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
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:
@@ -1191,12 +1191,18 @@ comprint(COMPLEX *c)
|
||||
qtmp = c->imag[0];
|
||||
if (qiszero(&qtmp))
|
||||
return;
|
||||
if (conf->complex_space) {
|
||||
math_chr(' ');
|
||||
}
|
||||
if (!qiszero(c->real) && !qisneg(&qtmp))
|
||||
math_chr('+');
|
||||
if (qisneg(&qtmp)) {
|
||||
math_chr('-');
|
||||
qtmp.num.sign = 0;
|
||||
}
|
||||
if (conf->complex_space) {
|
||||
math_chr(' ');
|
||||
}
|
||||
qprintnum(&qtmp, MODE_DEFAULT, conf->outdigits);
|
||||
math_chr('i');
|
||||
}
|
||||
|
Reference in New Issue
Block a user