Skip to content

Commit 143899c

Browse files
committed
fix fatal scientific float error
1 parent 42a42f9 commit 143899c

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

sevaluator_result.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ char *sevaluator_result_get_str(FullResult *result, size_t digits, bool sci_flt)
514514
if (temp_result.result_type == R_INT) {
515515
temp = mpz_get_str(NULL, 10, temp_result.result.v_int);
516516
return temp;
517-
} else if (result->result_type == R_RAT) {
517+
} else if (temp_result.result_type == R_RAT) {
518518
temp = mpq_get_str(NULL, 10, temp_result.result.v_rat);
519519

520520
int flag = 0;

test.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
int test(const char *expr, HistoryList *list) {
66
char *output;
7-
int error = sevaluator_calc(expr, &output, list, 5, false);
7+
int error = sevaluator_calc(expr, &output, list, 5, true);
88
if (error) {
99
printf("\"%s\" => error\n", expr);
1010
return 1;
@@ -31,6 +31,7 @@ int main() {
3131
test("10 * 3", hist_list);
3232
test("10 - 3", hist_list);
3333
test("10 / 3", hist_list);
34+
test("12/33", hist_list);
3435

3536
test("1.0e-3", hist_list);
3637
test("1E+3", hist_list);

0 commit comments

Comments
 (0)