How do I calculate the log of a number using bc?

前端 未结 8 672
说谎
说谎 2020-12-28 11:35

This is the first time I am using bc. I want to calculate the log (base 10) of a number. How do I this?

相关标签:
8条回答
  • 2020-12-28 12:38

    Python can come in handy for this as,

    log3=$(python -c  'import math; print math.log(3)')
    

    Hope that helps!

    0 讨论(0)
  • 2020-12-28 12:42

    If you start bc with the -l switch, then there's a function l() that calculates the natural log of its argument.

    0 讨论(0)
提交回复
热议问题