Skip to content
EMPS intranet

Back to top
Hi!   Hi!           Start main()

Try stepping through the code


  Value and type of last evaluated expression: Address of array element: Address of array elementx:  (none)

Your browser does not support the canvas element which will make some the features unavailable.

If you are using Internet Explorer within the University of Exeter try going to the Settings menu (probably the gear shape at the top right of this page), selecting "Compatibility View settings", unchecking "Display intranet sites in Compatibility View" and reloading this page.

Code

 Header...
// // Demonstrate complex arithmetic and the complex square root. //
int main(){
  ...
» double complex x, y, sqrtx; » x=1.2+3.4*I; » y=-13.7*x+5.6*x*x-12.7*I; » sqrtx=csqrt(x); » printf("x is %g %+g * I\n", creal(x), cimag(x)); » printf("y is %g %+g * I\n", creal(y), cimag(y)); » printf("sqrt(x) is %g %+g * I\n", creal(sqrtx), cimag(sqrtx)); » return 0;
}

Data

x (double complex)
128 136
2.18847e-314
-6.88932e+266
y (double complex)
144 152
4.24399e-312
-2.04753e+267
sqrtx (double complex)
160 168
-8.54999e+266
4.94619e-270

Where two numbers are shown the first is the real part, the second the imaginary.

Memory

main()

128
129
130
131
132
133
134
135
x(r) = 2.18847e-314
136
137
138
139
140
141
142
143
x(i) = -6.88932e+266
144
145
146
147
148
149
150
151
y(r) = 4.24399e-312
152
153
154
155
156
157
158
159
y(i) = -2.04753e+267
160
161
162
163
164
165
166
167
sqrtx(r) = -8.54999e+266
168
169
170
171
172
173
174
175
sqrtx(i) = 4.94619e-270

NB: the actual memory address of each variable is the
address shown plus 4292014888 (0xFFD2F328).

Show Advanced options

.
Show output (Before looking at the output, work out what you think it put should be and see if you are right.)

Output

x is  1.2 +3.4 * I
y is  -73.112 -13.584 * I
sqrt(x) is 1.55009 +1.09671 * I
                                                                                                                                                                                                                                                                       

Validate   Link-check © Copyright & disclaimer Share
Back to top