long double a1, a2, a3;
a1 = 20;
a2 = 77;
a3 = pow(20, 77)
It couoldn't calculate the a3 out...
So, what can I do?? should I use powl?
or using others?
thx a lot......
long double a1, a2, a3;
a1 = 20;
a2 = 77;
a3 = pow(20, 77)
It couoldn't calculate the a3 out...
So, what can I do?? should I use powl?
or using others?
thx a lot......
To use the pow() function you must use include the math.h header.
I know... but the result is too big to calculate.....
You need to implement a datastructure for huge numbers and define operations on it.
Sorry... would you mind telling me more...Originally posted by Shiro
You need to implement a datastructure for huge numbers and define operations on it.
coz... I don't understand.... sorry.....
C doesn't have a standard type in which you can store huge numbers. For example the numbers used in cryptography or the search for prime-numbers.
So if you want to develop applications which need to work with such huge numbers, you need to create a datastructure which can contain the numbers. Since it is your own datastructure, you need to define functions to work with the datastructure by yourself.
In some other thread some time ago one also asked about how to use large numbers. Then, I guess it was Zahid, someone came with the idea of using strings.
The number
12398739487329873498795872938749837492837959283749 87987293487983494827349872962934954353865827364832 768
cannot be stored in a standard type. But you could use a string to store this number, a linked list would also be a solution. A string can be dynamically allocated an resized. So you can at runtime change the size of the required memory.
Then you need to write some functions to perform operations with the numbers. Multiplication, adding, substraction, division and perhaps some more advanced things like power, square root or whatever.
Hi!
Did you wan to compute this modulo some value?
for multiplication the following equivalence holds:
(a*b*c)%d = (((a*b)%d)*c)%d
i.e., you can use the modulo operator after each multiplication...
Hope this is to-the-point.
alex