Precision issues in sqrt() function of C++

Правка en1, от nik1996, 2019-01-15 18:09:09

Hi all,

Recently I was solving problem Sad Powers. In the editorial of the problem it is mentioned that sqrt() function of c++ has some precision issues. On using the function in my problem on some value gives me wromg answer. After looking others solution I observed that some have used additional checks. e.g. If square root of value x is required then many solutions have checked for both x and x-1/x+1. I could not understand why that additional check is required.

Can anybody please tell why this additional check is required or what are the issues with sqrt() function?

Thanks!!

Теги c++, c++ 11, c++ 14, sqrt

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский nik1996 2019-01-15 18:10:43 7 (published)
en1 Английский nik1996 2019-01-15 18:09:09 685 Initial revision (saved to drafts)