Sid P.
August 11th, 2008, 04:05 PM
Hello,
I have two functions. The output of the first is input to the second. The both return double type numbers.
From within function one, I print out output of function one and the output of function two.
In main, I call function one, and using its output, then call function two. Again, I print out the two numbers.
In both cases the output of the first function appears to 6 decimal places only. The two numbers are identical for the digits presented. However, outputs of the second function are different.
This leads me to suspect the following: the output of the first function is truncated before being saved by the double created in main. So, the input to the second function is different in the two cases and because of this, the outputs of the second function was different.
Is this so? Or are there other possibilities for the outputs of the second function being different?
Also, if it is a matter of truncation, is there a way to ensure that all the digits of double type are used?
Thanks
Sid.
I have two functions. The output of the first is input to the second. The both return double type numbers.
From within function one, I print out output of function one and the output of function two.
In main, I call function one, and using its output, then call function two. Again, I print out the two numbers.
In both cases the output of the first function appears to 6 decimal places only. The two numbers are identical for the digits presented. However, outputs of the second function are different.
This leads me to suspect the following: the output of the first function is truncated before being saved by the double created in main. So, the input to the second function is different in the two cases and because of this, the outputs of the second function was different.
Is this so? Or are there other possibilities for the outputs of the second function being different?
Also, if it is a matter of truncation, is there a way to ensure that all the digits of double type are used?
Thanks
Sid.