Skip to content

Commit b0d5acc

Browse files
committed
FP: Accept uppercase scientific notation
The floating-point parser only recognized lowercase e for scientific notation.
1 parent 035da02 commit b0d5acc

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

scripts/cli_smoke_tests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ printf '1' > "$TMP_DIR/one_real.txt"
1919
printf '{1,2}\n' > "$TMP_DIR/list_with_newline.txt"
2020
"$CLI" -i "$TMP_DIR/list_with_newline.txt" -j readable -o "$TMP_DIR/list_with_newline.8xl" -k varfile -t RealList -n L1
2121

22+
printf '{1E2}\n' > "$TMP_DIR/list_with_uppercase_exp.txt"
23+
"$CLI" -i "$TMP_DIR/list_with_uppercase_exp.txt" -j readable -o "$TMP_DIR/list_with_uppercase_exp.8xl" -k varfile -t RealList -n L1
24+
2225
printf '[[1,2][3,4]]\n' > "$TMP_DIR/matrix_with_newline.txt"
2326
"$CLI" -i "$TMP_DIR/matrix_with_newline.txt" -j readable -o "$TMP_DIR/matrix_with_newline.8xm" -k varfile -t Matrix -n A

src/TypeHandlers/STH_FP.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ namespace tivars::TypeHandlers
7676
}
7777
index = (dataByteCount << 1) + 1;
7878
}
79-
} else if (c == 'e') {
79+
} else if (c == 'e' || c == 'E') {
8080
const bool sign = parseSign(i, e);
8181
int offset = 0;
8282
do {

tests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,8 @@ End)";
14541454
assert(testRealList.getReadableContent() == content);
14551455
testRealList.setContentFromString("{1,2}\n");
14561456
assert(testRealList.getReadableContent() == "{1,2}");
1457+
testRealList.setContentFromString("{1E2,3}");
1458+
assert(testRealList.getReadableContent() == "{100,3}");
14571459
}
14581460

14591461
{

0 commit comments

Comments
 (0)