feat: implement floating-point number literal parsing and arithmetic operations

Add support for floating-point number literals in the parser by detecting decimal points with trailing digits in `readNumber()`, and switch the compiler's `number()` function from `strtol` to `strtod` for proper double conversion. Update the `num_abs` primitive to use `fabs()` instead of manual negation. Extend test coverage across arithmetic, comparison, equality, modulus, and string conversion tests with floating-point cases, and add a new test for decimal point at end-of-file error detection.
This commit is contained in:
Bob Nystrom
2013-11-10 05:32:57 +00:00
parent c430056f70
commit 0ea34e00fe
14 changed files with 64 additions and 33 deletions
+1
View File
@@ -15,3 +15,4 @@ io.write(2 >= 2) // expect: true
io.write(2 >= 1) // expect: true
// TODO(bob): Wrong type for RHS.
// TODO(bob): Comparing zero and negative zero.