| | |
divide big numbers
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: May 2008
Posts: 35
Reputation:
Solved Threads: 0
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.
Could anyone of you help me?
Thanks in advanced!
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.
C++ Syntax (Toggle Plain Text)
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!
Perhaps this:
cpp Syntax (Toggle Plain Text)
#include<iostream> int main () { unsigned long long u40=16825420246llu; unsigned long long u20=3171426llu; unsigned long long prod=u20*u20; double kx; kx=double(u40)/prod; std::cout<< "u40: "<<u40<<" u20: "<< u20 <<" Prod: "<<prod<<" kx: "<<kx; std::cin.get() ; return 0 ; }
Last edited by Prabakar; Aug 5th, 2008 at 11:37 am.
![]() |
Similar Threads
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- take two value from one array (C++)
- Factorial of any length (C++)
- How to average a series of integers? (Assembly)
- How do Imodify my random number generator? (C++)
Other Threads in the C++ Forum
- Previous Thread: How to access a private variable
- Next Thread: LinkedLists problem
Views: 1441 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api array arrays based beginner binary bmp c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete deploy dll download dynamic dynamiccharacterarray encryption error file format forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library lines linker list loop looping loops map math matrix memory newbie news number output pointer problem program programming project python random read recursion recursive reference return rpg search simple sort spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






