Struct threshold
{
long value;
int exponent;
}t1,t2;

t1.value = 2;
t1.exponent =3;

t2.value = 3;
t2.exponent =4;

The first structure (t1) is 2 x 10^3
The second structure (t2) is 3 x 10^4

I want to get the result after division of the two structures.
The Reault should be a 32 bit value.
How can i achieve this?

Thanks a ton in advance.

Calculate the value of t1 and t2 then divide them.

Your post has all the information you need.

Thanks for reply!!

but the problem is if t1 is (2 x 10^80 ) and t2 is 2 x 10^9.


so how will i calculate.. becuase there is no data type that can store value big as t1's (2x 10^80).

Well, if

The Reault should be a 32 bit value.

then you're out of luck, because, as you say, those numbers could not fit into a 32-bit integer.

On the other hand, if you want one of your structures as the result . . .

If the bases are the same, the calculation is simple: X^Y * X^Z is the same as X^(Y+Z). If they're not, well, you'd have to convert one of the bases to be the same as the other one. I don't feel like figuring out the math behind it . . . have you tried it?

thanks for the reply!! thanks a lot!!

actually during programing i figured out.. that

my t1 can be anything ..and my t2 will be (2^31-1).. in exponential form it becomes 10^9.3
(rounded to 10^9)
so i need to divide the t1/t2

example t1 is 2x10^23 t2 is 10^9

answer will be 2x10^14..

challenge is will i be able to conrtain the result in 4 bytes..

This article has been dead for over six months. Start a new discussion instead.