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

fbg111 <>
Thu Sep 7 06:58:33 CEST 2006

I came across it in the getting started guide, and saw that trunc was used in
a way I've used mod before in other languages, so I wanted to try replacing
it with mod.  I tried searching the Erlang documentation (I always do b/f
posting such questions), but it's not clear what to search for.  It's not in
the math module, and you have to know the spelling to find it in the
glossary and index.  But you're right, next time I'll Google it first. 


Rick Pettit wrote:
> 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 :-).
> -Rick
> _______________________________________________
> erlang-questions mailing list
> http://www.erlang.org/mailman/listinfo/erlang-questions

View this message in context: http://www.nabble.com/Mod-function-that-returns-quotient-remainder--tf2231023.html#a6184239
Sent from the Erlang Questions forum at Nabble.com.

More information about the erlang-questions mailing list