[M3devel] integer division rounding?

Tony Hosking hosking at cs.purdue.edu
Sun Jan 17 17:05:44 CET 2010


What do Pascal and Modula-2 and Oberon do?  M3 is in the same family...

On 17 Jan 2010, at 04:36, Jay K wrote:

> Modula-3 apparently specifies integer division as rounding down.
> http://www.modula3.com/cm3/doc/reference/arithmetic.html
> 
> C used to leave it unspecified. So it could be fast.
> Fortran rounded to zero.
> C's ldiv function rounds to zero.
> C now rounds to zero with C99.
>   The rationale was that nobody using Fortran seemed to mind.
> Java apparently rounds toward zero.
> C# apparently rounds toward zero.
> 
> 
> I'm assuming we are stuck being different here?
> 
>  - Jay
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100117/5d8ecb47/attachment-0002.html>


More information about the M3devel mailing list