Wrong output given by pow(3, 38) function in C++

Revision en2, by cheapcoder, 2019-10-27 16:39:30

The pow function in CPP gives output 1350851717672992000 for input pow(3, 38), but the correct output is 1350851717672992080 i.e. output differs by 89. So what is the issue?

Didn't find any solution on the net!! c++ version 7.4.0

pow(3, 38) ==> Correct output is 1350851717672992089, but the function gives output 1350851717672992000 which differs by 89.

Edit- Using the powl function worked! Thank you, everyone!!!

Tags #c++, #pow()

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English cheapcoder 2019-10-27 16:39:30 64
en1 English cheapcoder 2019-10-27 15:47:18 408 Initial revision (published)