Divide big numbers
-
hello,
I have get through this problem, I want to divide these numbers but the result calculated by c++ is not right. I am quite sure it is due to the type of the variables but I don't know how to solve it.
unsigned long long u40=16825420246; unsigned long long u20=3171426; unsigned long long prod=u20*u20; double kx; //I have also proved with float but the problem still remains kx=u40/prod;
Could anyone of you help me?
Thanks in advanced!
-
&rea schrieb:
hello,
I have get through this problem, I want to divide these numbers but the result calculated by c++ is not right. I am quite sure it is due to the type of the variables but I don't know how to solve it.
unsigned long long u40=16825420246; unsigned long long u20=3171426; unsigned long long prod=u20*u20; double kx; //I have also proved with float but the problem still remains kx=u40/prod;
Could anyone of you help me?
Thanks in advanced!maybe
kx = (double)u40/prod;
helps
-
you are right!!
Thank you so much!