[erlang-questions] casting float to integer
jm
jeffm@REDACTED
Sat May 12 02:44:06 CEST 2007
Nitin Verma wrote:
> Hi All,
>
> I am looking for a function/BIF that can help me.
>
> Problem: I need a float number's floored integer. That is if:
> A = f(5/2), then A = 2 and
> A = f(1000/501), then A = 1
>
> I found 'round/1' but it just rounds-off .
>
You seem to be having the same problem I was with integer arithmetic. I
can't seem to find the manual entry for div so here's an example:
$ erl
Erlang (BEAM) emulator version 5.4.8 [source] [hipe]
Eshell V5.4.8 (abort with ^G)
1> 1000 div 501.
1
2> 5 div 2.
2
Jeff.
More information about the erlang-questions
mailing list