Complex bakeoff - example 4
Harry H. Cheng
uunet!dragon.engr.ucdavis.edu!chengh
Fri Oct 13 02:44:23 PDT 1995
> Complex bakeoff - example 4 10/13/95 10:02 AM
>
> In "Augmenting a Programming Language with Complex Arithmetic" (NCEG/91-039),
> W. Kahan and I presented two examples illustrating how the sign of zero
> can be used to distinguish the two sides of a branch cut to simplify the
> conceptualization and coding for problems involving branch cuts. Bakeoff
> example 3 covered the first of these examples. This bakeoff example 4 covers
> the second one. In both examples, a simple, straightforward program solves
> the
> problem, but the program depends on consistent treatment of the sign of zero.
>
> For both examples, the paper contains a plot showing the bad affects on the
> program of treating -0 like +0. This example better suggests the potential
> challenge of debugging and fixing such a program failure.
>
> For comparison purposes, how might one code this example for a system
> which does not support the sign of zero?
> Does the code become more
> complicated
> or less efficient? What is the effort to devise the workaround? See Harry H.
> Cheng's
> "Handling of Complex Numbers in the C^H Programming Language" (X3J11.1/93-020)
>
> for a detailed analysis of this example.
Your program can run in an implementation of complex system
with the sign of zero being ignored without any problem.
The round-off error from pi will eat your sign of zero.
Jim, I am just wondering what will be your next example. :-)
>
> Example 4
...
> const double pi = 4 * atan(1.0);
> const double dtheta = pi / (2 * M); // Angle between radial lines
...
> z = g(n * drho * exp(I * m * dtheta));
Harry Cheng
UC Davis
<PRE>
More information about the Numeric-interest
mailing list