+ 2

Why are the math.log10(x)and math.log(x,10) results different?

I'm trying to print 20 log 5 value...so, I have to consider base too...Now I got a confusion that how to use? can anyone?

8th Aug 2017, 12:25 PM
Girish Tulabandu
Girish Tulabandu - avatar
5 Respostas
0
#@ GIRISH TULABANDU here is a EXPLAINATION CODE.. READ ALL COMMENTS TO GET THE WHOLE IDEA. MATCH all input codes with output. https://code.sololearn.com/cNpymcJAJ2GY/?ref=app
8th Aug 2017, 2:55 PM
sayan chandra
sayan chandra - avatar
+ 5
Most likely they are a bit different implementations resulting in floating-point precision problems. math.log10(1000) = 3.0 math.log(1000, 10)= 2.99999999996 Both are *equal*, just not floating-point equal :)
8th Aug 2017, 1:00 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
math.log(20, 5)
8th Aug 2017, 1:16 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
can you tell me How to print 20log5? 20*math.log10(5)? Is this correct?
8th Aug 2017, 1:03 PM
Girish Tulabandu
Girish Tulabandu - avatar
- 1
there is 4 log modules... 1. log(value , base) 2. log10(value) 3. log2(value) 4. log1p(value) 1 is general...default base is 'e' 2 is fixed base 10 3 is fixed base 2 4 is fixed bade 'e' but doing logarith of (1+value)-----p denotes plus
8th Aug 2017, 3:00 PM
sayan chandra
sayan chandra - avatar