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

Angel clist@REDACTED
Mon Jan 25 20:12:13 CET 2010


On Lunes, 25 de Enero de 2010 07:33:27 Richard O'Keefe escribió:
> Didn't we have exactly this conversation several months ago?
> At the time I said that it is straightforward to write an
> integer square root function, and by that I meant >> in Erlang <<,
> no port programs needed.
> 

Thanks again!! Richard you are right:

It happens that i missed your message and continue so eventually
a forgot "the floating point" issue with sqrt. (just the port program also 
served me to touch more erlang aspects).

The case was i tought that there were no point on fighting against GMP library
on the erlang side so it kept me happy for the last months...

In fact the aproach i took on "fermat factoring" is not cleary interesting but 
a sort of erlang joy. Also i never did more that a sqrt() for a semiprime P 
because i move on the line b^2-a^2=N using a simple math:

	let B1 the square of b
	let B2 the square of (b+1)

	Now we can see that B2=B1+(2*b1+1)

So for a Semiprime P we start on the first square above the square root of P 
and move on without checking squareness for the big term. Clearly dont deserve 
any consideration...
 
you know! "supersecrete" was a warning !!


/Angel



-- 
Most people know C is not so high level....
                ...Everybody else just got assembler overdose
 


More information about the erlang-questions mailing list