[erlang-questions] changes in native functions for the next otp release.

Angel clist@REDACTED
Sat Jan 23 11:01:30 CET 2010

On Viernes, 22 de Enero de 2010 02:09:52 Richard O'Keefe escribió:
> On Jan 22, 2010, at 1:40 AM, Angel wrote:
> > Hi
> >
> > Some months ago, i discovered that square root of bignums is not
> > implemented
> > in erlang.
> ?
> 1> math:sqrt(1 bsl 801).
> 3.65185e+120
> math:sqrt is just as much implemented for bignums as it is for fixnums.
> Or do you mean "the greatest integer X such that X**2 <= Y",
> the "integer square root"?  I didn't think Erlang had that for fixnums
> either.
i mean sqrt for bignums was broken. 

25-08-2009 "bignum sqrt broken in erlang?"

See my message on that ocasión:

Iet 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-

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

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

3> R1=R0+1.

4> M=R1*R1.

5> M -N > 0.

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


this was on R13B1 i think (have to re-test on current versión) is still 

Im probing some supeesecrete variations of "fermat little's theorem" on RSA 
numbers clearly is a problem if native math:sqrt still broken and port 
latencies (serialitation and parsing) of my actual code begin to annoy me. 

So it is worth a NIF?

Thanks in advance, Angel

More information about the erlang-questions mailing list