Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make sqrt return the *principal* square root in accordance with the spec
  • Loading branch information
sorear committed Sep 1, 2011
1 parent 252c6a5 commit d3b0031
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/Builtins.cs
Expand Up @@ -1164,7 +1164,6 @@ class SubstrLValue: Variable {
if (r1 == NR_COMPLEX) {
Complex v1 = PromoteToComplex(r1, n1);
double angle = Math.Atan2(v1.im, v1.re) / 2;
if (angle < 0) angle += Math.PI;
double mag = Math.Sqrt(Math.Sqrt(v1.im*v1.im + v1.re*v1.re));
return MakeComplex(mag * Math.Cos(angle), mag * Math.Sin(angle));
} else {
Expand Down

0 comments on commit d3b0031

Please sign in to comment.