bignum sqrt broken in erlang?

Angel Alvarez clist@REDACTED
Tue Aug 25 15:11:03 CEST 2009


Hi

let ab=N  
let M=(a+1)(b+1); 

M=ab+a+b+1  that is N +a +b +1  so M  > N

Ok but in erlang...

Erlang R13B01 (erts-5.7.2) [source] [rq:1] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.7.2  (abort with ^G)
1> N=71641520761751435455133616475667090434063332228247871795429.
71641520761751435455133616475667090434063332228247871795429

2> R0=trunc(math:sqrt(N)).
267659337146589062070609641472

3> R1=R0+1.
267659337146589062070609641473

4> M=R1*R1.
71641520761751431352030800763682813030352458120945601609729

5> M -N > 0.
false

where is the problem? That's erlang or the gmp library?

/Angel







-- 
Agua para todo? No, Agua para Todos.
->>-----------------------------------------------
    Clist UAH a.k.a Angel
---------------------------------[www.uah.es]-<<--

DSpace me recuerda a Ice Age, el bichito que se apega a su castaña y trata de llevarla a todos lados.


More information about the erlang-questions mailing list