当前位置:首页 » 编程语言 » log10函数C语言

log10函数C语言

发布时间: 2023-08-11 17:48:18

① C语言中log函数怎么使用

先引用
#include <math.h>

假设要计算log3(9)的值,因为C语言的logx是以e为底的相当于lnx,如果以其他数作为对数的底,必须写成
float i
i=log(9)/log(3);

② C语言中log函数怎么使用呢

1、C语言中,有两个log函数,分别为log10和log函数,具体用法如下:
2、函数名: log10
功 能: 对数函数log,以10为底
用 法: double log10(double x);
程序示例:
#include <math.h>
#include <stdio.h>int main(void)
{
double result;
double x = 800.6872;
result = log10(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}
3、函数名: log
功 能: 对数函数log,以e(2.71828)为底
用 法: double log(double x);
程序示例:
#include <math.h>
#include <stdio.h>int main(void)
{
double result;
double x = 800.6872;
result = log(x);
printf("The common log of %lf is %lf\n", x, result);
return 0;
}

热点内容
sql网校 发布:2025-03-20 06:16:42 浏览:278
安卓手机图标排列为什么会混乱 发布:2025-03-20 06:16:05 浏览:760
手机pin初始密码是多少 发布:2025-03-20 06:15:59 浏览:897
javaif常量变量 发布:2025-03-20 06:15:57 浏览:343
iis安装sql 发布:2025-03-20 06:05:31 浏览:148
制作自解压安装 发布:2025-03-20 05:41:49 浏览:304
华为连接电视密码是多少 发布:2025-03-20 05:31:11 浏览:493
算法第五版 发布:2025-03-20 05:17:57 浏览:730
湖南台访问 发布:2025-03-20 05:10:32 浏览:38
脚本和秒抢 发布:2025-03-20 05:06:29 浏览:592