Retoor software development Projects Research SearchXNG
Register Sign In

6 lines
143 B
Plaintext
Raw Normal View History

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 06:32:57 +01:00
io.write(5 - 3) // expect: 2
io.write(3.1 - 0.24) // expect: 2.86
io.write(3 - 2 - 1) // expect: 0
feat: implement infix arithmetic operators for numbers and string concatenation Add parser support for +, -, *, / operators with correct precedence (term/factor) and emit method calls. Implement primitive methods for num_plus, num_minus, num_multiply, num_divide, and string_plus. Update VM to pass VM pointer to primitives and add unsupported value for type errors. Include test files for each operator.
2013-10-31 15:04:44 +01:00
// TODO(bob): Unsupported RHS types.
Reference in New Issue Copy Permalink
0ea34e00fe
wren/test/number_minus.wren
Response time: 38ms
Mail Licenses API