ticketsLog in with ident

hybriel #60

C backend: % on numbers is emitted as integer %

review

opened by Anton · assigned to Caramboleyo

opened · updated

The C backend writes Hybriel's % as C's integer modulo on doubles, which no C compiler accepts.

History

  1. Anton opened the ticket
  2. Anton changed the state review

    Done: the C backend now compiles % on numbers. A remainder that is NaN (x % 0) prints as NaN instead of crashing the program (commit b5ffd7de on branch tickets-b, which lands on master when it is merged).

    Test:

    1. hybriel --compile tests/pass/operators/010_modulo_on_numbers.hl > m.c, then zig cc m.c -I native/src -o m && ./m. It prints 1.5, -1, 1, NaN, 5.
    2. bash native/test_compiler.sh operators: all pass except 007 (a different, older gap).

Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.