[pure-lang-svn] SF.net SVN: pure-lang:[535] pure/trunk/lib/math.pure
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-08-18 23:38:28
|
Revision: 535 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=535&view=rev Author: agraef Date: 2008-08-18 23:38:38 +0000 (Mon, 18 Aug 2008) Log Message: ----------- Better complex sqrt definition, suggested by Eddie Rucker. Modified Paths: -------------- pure/trunk/lib/math.pure Modified: pure/trunk/lib/math.pure =================================================================== --- pure/trunk/lib/math.pure 2008-08-18 23:01:53 UTC (rev 534) +++ pure/trunk/lib/math.pure 2008-08-18 23:38:38 UTC (rev 535) @@ -185,8 +185,8 @@ /* Complex sqrt. */ -sqrt (x+:y) = sqrt r * (cos t +: sin t) - when r = sqrt (x*x+y*y); t = atan2 y x/2 end; +sqrt (x+:y) = sqrt ((r+x)/2) +: sqrt ((r-x)/2) + when r = sqrt (x*x+y*y) end; sqrt (r<:t) = sqrt r <: t/2; // Complex square roots of negative reals. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |