1

I am trying to print the exact exponentiation of a floating number but i failed to print the digits of the exponentiation after 5 decimal digits. What should be done in order to get rest of the digits?

Example: 1.0100 ^ 12 = 1.126825030131969720661201 But i only managed to print 1.12863 by using simple pow() function. Can anyone help if i need to use strings or something else and how?

while(cin >> r >> n)
{
    long double ans = pow(r, n);
    cout << ans << endl;
}
BlackBeard
  • 31
  • 4

0 Answers0