Commit Graph

3 Commits

Author SHA1 Message Date
Bob Nystrom
0ea34e00fe 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.
2013-11-10 05:32:57 +00:00
Bob Nystrom
6aa4d4d041 fix: re-enable number and string toString tests after equality operator implementation
Remove the `// skip: == not implemented yet` comments from both `test/number_to_string.wren` and `test/string_to_string.wren` test files, allowing the previously skipped equality comparison tests to execute and validate the now-functional `==` operator.
2013-11-06 04:38:16 +00:00
Bob Nystrom
ffc04e97f7 feat: add toString method for numbers and strings with AS_NUM/AS_STRING macros
Introduce num_toString primitive that converts numeric values to string representation via sprintf with "%g" format, and add AS_NUM and AS_STRING accessor macros to vm.h for cleaner type extraction. Refactor existing numeric and string primitives to use these macros instead of direct struct member access. Include test files for number_toString and string_toString with basic equality checks (skipped due to unimplemented == operator).
2013-11-02 06:27:28 +00:00