$floor (-4/3) yields -1 instead of -2

A related but not the same (mod) function:


module m;
  
  initial begin
    $display ("FL: 4/3 %0d", $floor(4/3));
    $display ("FL: -4/3 %f", $floor(-4/3));
  end
endmodule

Tools give me -1, whereas C/PY/Matlab give -2. As per LRM:

Table 20-4—SystemVerilog to C real math function cross-listing

It should match C’s floor. What am I missing please?

Thanks

Force Verilog to treat the function input as a “real” by using 4.0:


$display ("FL: -4/3 %f", $floor(-4.0/3));

This gives me:

FL: -4/3 -2.000000

In reply to gsulliva:

Argh…that type-casting miss, thanks for pointing it out.

Thanks