[erlang-questions] casting float to integer
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:
Erlang (BEAM) emulator version 5.4.8 [source] [hipe]
Eshell V5.4.8 (abort with ^G)
1> 1000 div 501.
2> 5 div 2.
More information about the erlang-questions