hybriel
C backend: % on numbers is emitted as integer %
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
Anton opened the ticket 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:
hybriel --compile tests/pass/operators/010_modulo_on_numbers.hl > m.c, thenzig cc m.c -I native/src -o m && ./m. It prints1.5,-1,1,NaN,5.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.