[seqfan] Re: Function name for truncate-towards-zero integer divide?

Richard Mathar mathar at strw.leidenuniv.nl
Thu Mar 17 15:13:37 CET 2011


> Date: Thu, 17 Mar 2011 07:04:04 -0700 (PDT)
> From: Ron Hardin
> Subject: [seqfan] Function name for truncate-towards-zero integer divide?
> 
> What's the preferred name for the standard computer integer divide?  (that 
> truncates towards zero)
> 
> integerpart() ?

In all mathematical libraries that I know it is
trunc()

Whereas
floor() is rounding to integer towards -infinity; the value is different
 from trunc() if the argument is negative.
ceil() is rounding to integer towards +infinity,
round() is rounding to integer with undefined behaviour if half-way
 between two integers.



More information about the SeqFan mailing list