Comment

Comment by RossBencina

x and y are integers represented as floating point

  > d = trunc(x/y);     // floor works for unsigned
  >
  > // NOTE: if only want 'd' and it's being converted to an
  > // integer then the truncate or floor operation is
  > // free in the float to integer conversion.
Please show me how to portably truncate or floor a floating point value to an int in C for "free".
parent RossBencina 2 months ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton