I took those too screenshots, when i was debugging using MS Visual studio.
I'm not sure about the first one. but the second one shows some very strange output numbers. compare the input and output results with the one that are computed with the sine object. I dunno how the debugger worked out those numbers :)
is this ok?
Nothing wrong in shot one, 3.4 is evidently not possible to represent absolutely in floating point representation. What Every Computer Scientist Should Know About Floating-Point Arithmetic
Quote:Original post by antareus
Nothing wrong in shot one, 3.4 is evidently not possible to represent absolutely in floating point representation. What Every Computer Scientist Should Know About Floating-Point Arithmetic
And what about the second one :)
how can it happen that the output is wrong?
Ahh I see what you're getting at... ok so where/how is o_output and o_input defined? are they in a union?
just to confirm:
you are expecting o_output[0] to be 0.0 (but you are seeing 0.778...)
you are expecting o_output[1] to be 0.997... (but you are seeing 0.0)
just to confirm:
you are expecting o_output[0] to be 0.0 (but you are seeing 0.778...)
you are expecting o_output[1] to be 0.997... (but you are seeing 0.0)
Quote:Original post by superdeveloper
Ahh I see what you're getting at... ok so where/how is o_output and o_input defined? are they in a union?
just to confirm:
you are expecting o_output[0] to be 0.0 (but you are seeing 0.778...)
you are expecting o_output[1] to be 0.997... (but you are seeing 0.0)
double *o_input and double *o_output
Am I right in assuming here that o_ouput[0] and o_output[1] are initialized with a non-bogus value before this computation?
On the top of my head:
a) did you included (or better: ) at the beginning of your cpp file?
b) are you sure you didn't create another sin() function (maybe a member function of your Sin class) which behaves diferently than the original one?
Regards,
a) did you included (or better: ) at the beginning of your cpp file?
b) are you sure you didn't create another sin() function (maybe a member function of your Sin class) which behaves diferently than the original one?
Regards,
^^ was me.
Corrected first point:
a) did you included <math.h> (or better: <cmath>) at the beginning of your cpp file?
Better with these...
Sorry [ashamed]
Corrected first point:
a) did you included <math.h> (or better: <cmath>) at the beginning of your cpp file?
Better with these...
Sorry [ashamed]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement