[erlang-questions] Mod function that returns quotient remainder?

Rick Pettit <>
Thu Sep 7 06:32:37 CEST 2006

On Wed, Sep 06, 2006 at 09:08:35PM -0700, fbg111 wrote:
> Hello, is there a 'mod' that returns the remainder of a quotient?  eg, 
>     mod(5/2) = 1?  

5 rem 2.

> I know you can find out if there is a remainder by 
>     if trunc(Y / 2) * 2 == Y
> but is there a way to return the actual remainder?  Thanks,

Out of curiousity, how did you find out about trunc/1? FYI, a 5 minute google
search could have gotten you an answer (re: rem) much faster than posting to
the list (don't get me wrong, I don't mind helping when I can :-).


More information about the erlang-questions mailing list