Fixes #93. Previously, "1 -1" was lexed as two number tokens: a positive literal and a negative literal. This caused problems when it came to parsing. Now the '-' and the second number are separate tokens. Note this is a breaking change, since `-16.sqrt` is now parsed as `-(16.sqrt)`, as opposed to `(-16).sqrt`. There is a small bit of overhead to doing it this way, but it might be possible to optimize that out in the compiler at some point in the future.
7 lines
227 B
Plaintext
7 lines
227 B
Plaintext
IO.print(123.abs) // expect: 123
|
|
IO.print((-123).abs) // expect: 123
|
|
IO.print(0.abs) // expect: 0
|
|
IO.print((-0).abs) // expect: 0
|
|
IO.print((-0.12).abs) // expect: 0.12
|
|
IO.print(12.34.abs) // expect: 12.34
|