10

Different output of log function in C++20 and C++17

 3 years ago
source link: http://codeforces.com/blog/entry/98173
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

By un_known27, history, 106 minutes ago,

Hello Coders!

I was doing this question High School: Become Human. I had to calculate x^y and y^x and take log on both sides...x(logy) and y(logx). When I submitted my solution, it got WA on TC3...where the TC was n=6 and m=6. The answer should be '=,' but the compiler showed '<'...Code in C++17 WA on 3. So why does 6(log6) != 6(log6), according to C++17, when I submitted the code for checking the value of 6log6 in this TC. It surprised me coz now the answer was showing '='... Code in C++17 for checking. But it got failed due to the value of n1 and m1 displayed. When I tried to submit the first code using C++20, it got accepted. AC on C++20.

I tried using Long double also, but it was of no use. https://codeforces.com/contest/987/submission/140238196

Can you somehow tell me why log and C++17, C++20 behave in this strange manner and give weird output? I don't know why people are downvoting this, but if someone has the answer, do answer this. Thanks in Advance!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK