当前位置:首页 » 编程语言 » 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;
}

热点内容
java返回this 发布:2025-10-20 08:28:16 浏览:564
制作脚本网站 发布:2025-10-20 08:17:34 浏览:853
python中的init方法 发布:2025-10-20 08:17:33 浏览:554
图案密码什么意思 发布:2025-10-20 08:16:56 浏览:732
怎么清理微信视频缓存 发布:2025-10-20 08:12:37 浏览:655
c语言编译器怎么看执行过程 发布:2025-10-20 08:00:32 浏览:973
邮箱如何填写发信服务器 发布:2025-10-20 07:45:27 浏览:226
shell脚本入门案例 发布:2025-10-20 07:44:45 浏览:85
怎么上传照片浏览上传 发布:2025-10-20 07:44:03 浏览:775
python股票数据获取 发布:2025-10-20 07:39:44 浏览:681