aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/qalculate_helper.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/qalculate_helper.cpp b/src/qalculate_helper.cpp
index dd16626..c997a95 100644
--- a/src/qalculate_helper.cpp
+++ b/src/qalculate_helper.cpp
@@ -128,7 +128,7 @@ static MathResult evaluate_all(Calculator &calc, const vector<string> &expressio
128} 128}
129 129
130static bool has_unknown(const MathStructure &ms) { 130static bool has_unknown(const MathStructure &ms) {
131 if(ms.size() == 0) 131 if (ms.size() == 0)
132 return ms.isUnknown(); 132 return ms.isUnknown();
133 else 133 else
134 return has_unknown(ms[0]); 134 return has_unknown(ms[0]);
@@ -138,7 +138,6 @@ static void replace_booleans(Calculator &calc, MathResult &result) {
138 bool inputBoolean = result.input.isLogicalAnd() || result.input.isLogicalNot() || result.input.isLogicalOr() 138 bool inputBoolean = result.input.isLogicalAnd() || result.input.isLogicalNot() || result.input.isLogicalOr()
139 || result.input.isLogicalXor() || result.input.isComparison(); 139 || result.input.isLogicalXor() || result.input.isComparison();
140 140
141
142 bool outputBoolean = !has_unknown(result.output); 141 bool outputBoolean = !has_unknown(result.output);
143 142
144 if (inputBoolean && outputBoolean && result.output.representsBoolean()) { 143 if (inputBoolean && outputBoolean && result.output.representsBoolean()) {
@@ -160,7 +159,7 @@ static void print_result(Calculator &calc, MathResult result_struct, const Print
160 if (!result_struct.output.isComparison()) // comparisons (eg. "x = 1") already have a comparison sign 159 if (!result_struct.output.isComparison()) // comparisons (eg. "x = 1") already have a comparison sign
161 result = (result_struct.output.isApproximate() ? "≈ " : "= ") + result; 160 result = (result_struct.output.isApproximate() ? "≈ " : "= ") + result;
162 161
163 if (!mode_set(mode, MODE_NOCOLOR)) 162 if (!mode_set(mode, MODE_NOCOLOR) && ends_with(result, "\033[0m"))
164 result.erase(result.length() - 4); 163 result.erase(result.length() - 4);
165 164
166 putchar(TYPE_RESULT); 165 putchar(TYPE_RESULT);
@@ -183,20 +182,16 @@ static PrintOptions get_printoptions(int base) {
183 po.number_fraction_format = FRACTION_DECIMAL; 182 po.number_fraction_format = FRACTION_DECIMAL;
184 po.interval_display = INTERVAL_DISPLAY_PLUSMINUS; 183 po.interval_display = INTERVAL_DISPLAY_PLUSMINUS;
185 po.use_unicode_signs = true; 184 po.use_unicode_signs = true;
186 //po.min_decimals = MIN_DECIMALS;
187 po.time_zone = TIME_ZONE_UTC; 185 po.time_zone = TIME_ZONE_UTC;
188 po.abbreviate_names = true; 186 po.abbreviate_names = true;
189 po.spell_out_logical_operators = true; 187 po.spell_out_logical_operators = true;
190 po.allow_non_usable = true; 188 po.allow_non_usable = true;
191 po.show_ending_zeroes = false; 189 po.show_ending_zeroes = false;
192 //po.preserve_precision = true;
193 //po.restrict_to_parent_precision = false;
194 return po; 190 return po;
195} 191}
196 192
197static void load_calculator(Calculator &calc) { 193static void load_calculator(Calculator &calc) {
198 do_defang_calculator(calc); 194 do_defang_calculator(calc);
199// calc->setExchangeRatesWarningEnabled(false);
200 calc.loadExchangeRates(); 195 calc.loadExchangeRates();
201 calc.loadGlobalDefinitions(); 196 calc.loadGlobalDefinitions();
202 197