Regarding log function in C+

Revision en4, by apnakaamkar, 2021-07-28 16:15:18

Can anyone tell me why I am getting different values of lhs and rhs? I expected them to produce similar results.

double lhs=y*log10(x);
double rhs=x*log10(y);

**

double lhs=log10(x);
double rhs=log10(y);
lhs*=y;
rhs*=x;

I am getting wrong answers for x=6,y=6 while submitting on codeforces but I am getting correct on VSCode.

Tags #c++, #cpp, #competitive programming, #logic

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English apnakaamkar 2021-07-28 16:15:18 35 Tiny change: 'nd rhs? I am getting different results but I expecte' -> 'nd rhs? I expecte'
en3 English apnakaamkar 2021-07-28 16:14:45 50
en2 English apnakaamkar 2021-07-28 16:13:44 36
en1 English apnakaamkar 2021-07-28 16:13:18 507 Initial revision (published)