Negative numbers in sqrt() in C++

Правка en2, от kira_lite, 2024-05-11 07:28:10

I observed a very strange behaviour in one of the recent problems of the sqrt() function, where a negative number was passed on to sqrt() function and it worked properly in one way but not the other. I have 2 submissions- one which gives an AC while the other shows Memory out of bounds, which it should have thrown ideally.

The only difference b/w the 2 submissions is that i am having a long long value to subtract from in the AC submission, but i dont see much difference because of it. If someone can provide a brief of why its happening, it'll be a great lesson !

Thanks in advance

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский kira_lite 2024-05-11 07:28:10 10
en1 Английский kira_lite 2024-05-11 07:27:16 798 Initial revision (published)