Long value print

Hi there.
I have a simple problem. I know You solve it easily.. :p
How can I print this type of floating number?
I dont need straight cout. I need this value as a result of some calculation.

548815620517731830194541.899025343415715973535967221869852721
Such a number exceeds FP precision. Why do you need such a huge number with so many significant digits?
This is actually an online judge problem.
I'm trying to write a function which returns exponent value.
The above number is a result of this-
95.123^12

Last edited on
Think of it like you would a bit shift register and just parse it inside of a custom struct.
You'll need to use a bignum implementation.

95123**12 =
548815620517731830194541899025343415715973535967221869852721

Remember how you handle decimal places in multiplication problems, so 3 places * 12 = 36 places, giving you

548815620517731830194541.899025343415715973535967221869852721

So to print it, print all but the last n-places of the digits, then a decimal point, then the remaining digits.

Remember, this number is so big, we are talking a bignum -- an integer -- that we are treating as if it were a floating point value.

Going the other way (playing with differences) doesn't help much with precision, so I can't suggest that. Unless I'm missing something really obvious.

Hope this helps.
Topic archived. No new replies allowed.