Nov 3, 2013 at 3:55pm UTC
Such a number exceeds FP precision. Why do you need such a huge number with so many significant digits?
Nov 3, 2013 at 4:00pm UTC
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 Nov 3, 2013 at 4:00pm UTC
Nov 3, 2013 at 4:22pm UTC
Think of it like you would a bit shift register and just parse it inside of a custom struct.
Nov 3, 2013 at 4:38pm UTC
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.