zoukankan      html  css  js  c++  java
  • math。h中的log函数的应用

    以10为底的log函数:

    形式为 double  log10(double  x)

    以e为底的log函数(即 ln)double log (double x)

    如何表达log 以a为底b的对数:

    用换底公式:可以表达为:log(a)/log(b)

    #include<iostream>
    #include<cmath>
    using namespace std;
    int main()
    {
    	double a=3.456;
    	cout<<log(a)<<endl;//log 以e 为底,3.456的对数;
    	cout<<log10(a)<<endl;//log 以10为底,3.456的对数;
    	double b = 3.456;
    	cout<<log(a)/log(b)<<endl; //log 以a为底,b的对数; 
    	return 0;
    }


  • 相关阅读:
    04.
    24
    39
    46
    72.
    21.
    logout: not found”
    Username is not in the sudoers file. This incident will be reported
    激活函数
    排序算法
  • 原文地址:https://www.cnblogs.com/NYNU-ACM/p/4248797.html
Copyright © 2011-2022 走看看