Regarding log function in C+

Правка en2, от apnakaamkar, 2021-07-28 16:13:44

Can anyone tell me the difference between the two lines below? I am getting different results but 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.

Теги #c++, #cpp, #competitive programming, #logic

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский 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 Английский apnakaamkar 2021-07-28 16:14:45 50
en2 Английский apnakaamkar 2021-07-28 16:13:44 36
en1 Английский apnakaamkar 2021-07-28 16:13:18 507 Initial revision (published)