Weird behavior of sqrt() function

Revision en1, by euler1, 2019-09-20 08:49:18

I participated in a recent contest, wherein I submitted this solution for the Multiplication table problem.

My solution passed the pretests but failed on a TC in system testing. In the failed TC, I was printing the square root of a perfect square and it was printed as 1e9 instead of 1000000000.

The square root function was not printing in scientific notation for smaller numbers, but it did for sqrt(1e18) i.e. 1e9. Does anyone know why this happened?

Tags sqrt

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English euler1 2019-09-20 08:49:18 600 Initial revision (published)