S?bastien Bourdeauducq wrote: > This can certainly be improved with a float-to-int that rounds to > the nearest integer instead of flooring?
You mean instead of using A-B*floor(A/B) for A % B, use A-B*round(A/B) ? That'll cause other surprises. E.g., 3 % 4 would become 3-4*round(3/4) = -1 > By the way... there are Verilog simulators, so you do not need to > resynthesize, boot, run telnet etc. every time :) Heh, no need to synthesize for a mere round() ;-) round(X) = floor(X+0.5) Oh, and another math compatibility question: when the MilkDrop manual says "Convert to int", does it mean - round to next lower integer, e.g., floor(X), - round to nearest integer, e.g., round(X), or - round to the next integer towards zero, e.g., trunc(X) ? C's conversion from floating to integer is of the trunc() type. Example: Value floor round trunc 1.2 1 1 1 1.6 1 2 1 -1.2 -2 -1 -1 -1.6 -2 -2 -1 - Werner _______________________________________________ http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org IRC: #milkymist@Freenode
