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 the trigonometric identity // cos(a+b) equals cos(a)*cos(b) - sin(a)*sin(b) //
int main(){
  ...
» double a, b, cos_a_plus_b, error; » a=0.707;//! Random values » b=0.1234; » cos_a_plus_b=cos(a)*cos(b)-sin(a)*sin(b); » error=cos_a_plus_b-cos(a+b); » printf("I calculate cos(%g) to be %g\n", a+b, cos_a_plus_b); » printf("with an error of %g\n", error); » return 0;
}

Data

a (double)   b (double)
128   136
4.24399158e-312
  
-2.01528465e+267
cos_a_plus_b (double)   error (double)
144   152
-8.38876602e+266
  
4.93925743e-270

Memory

main()

128
129
130
131
132
133
134
135
a = 4.24399158e-312
136
137
138
139
140
141
142
143
b = -2.01528465e+267
144
145
146
147
148
149
150
151
cos_a_plus_b = -8.38876602e+266
152
153
154
155
156
157
158
159
error = 4.93925743e-270

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

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

I calculate cos(0.8304) to be 0.674581
with an error of -1.11022e-16
                                                                                                                                                                                                                                                                       

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