Annotations for "Complex.Divide Method (System.Numerics)" topic.Thu, 26 Nov 2015 00:34:30 Z
http://msdn.microsoft.com/en-us/library/ee259538(v=vs.100).aspx#CommunityContent
bige1030We can't avoid all numerical nastiness...But yet I see an opportunity for improvement. c^2 + d^2 will result in possibly needless overflow if c and d are big. A numerical analyst would observe:
c^2 + d^2 = max(c,d)^2 * (1 + (min(c,d)/max(c,d))^2)
When c and d are very small, this computation should gracefully round toward 0. When c and d are big, though, and say max(c,d)^2 doesn't overflow, we simply multiply that maximum by a number no greater than 2.
Same story for computing the magnitude |z| of z = c+di, but I'll detail how I wTue, 02 Aug 2011 14:22:31 -0700