Kevan Hashemi wrote:
My second use of round() is in drawing lines. But in this case, it is easy to implement an incremental rounding function that adds or subtracts one from an integer as its real-valued cousin rises or falls.
Sounds quite like the standard Bresenham algorithm which works completely with integers.
Gale wrote:
Now, getting to the relatively large GPC difference with a:=round(a). After looking at the differences in generated code between the compilers (assembly code and algorithms implemented), I think the main difference is that GPC supports rounding to 64 bit integers and CW Pascal only supports rounding to 32 bit integers.
BTW, if you can rebuild GPC, you can check if this is the main issue if you replace `long_long_integer_type_node' by `integer_type_node' in p/predef.c after `p_Round'. This won't be a real solution since we don't want to give up on 64 bit `Round' in general, but it would help determine the influence.
Frank