[erlang-questions] Flooring integer division in Erlang?
Igor Ribeiro Sucupira
igorrs@REDACTED
Sat Apr 26 19:37:01 CEST 2008
Are you just in need of some (any) high-level implementation? Or
you're after some really efficient operator?
Igor.
On Sat, Apr 26, 2008 at 12:49 PM, Dimitry Golubovsky
<golubovsky@REDACTED> wrote:
> Hi,
>
> Is there any Erlang library around that contains an integer division
> function that rounds negative quotient down (towards negative
> infunity, flooring division)?
>
> I am trying to implement Haskell-style division which for
>
> (-5) `div` (3) yields -2
>
> while Erlang's (-5) div (3) yields -1
>
> Thanks.
>
> PS The Erlang specification (rather old, of 1999
> http://www.erlang.org/download/erl_spec47.ps.gz), mentions on page 15
> that at some moment, operations // and mod were added, which round to
> negative infinity (as oposite to div and rem). Were these ever
> implemented?
>
> --
> Dimitry Golubovsky
>
> Anywhere on the Web
More information about the erlang-questions
mailing list