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

热点内容
计算法框图 发布:2025-07-11 10:08:32 浏览:548
电容触摸安卓一体机市场前景如何 发布:2025-07-11 10:08:27 浏览:839
c程序的编译单位是 发布:2025-07-11 10:07:42 浏览:900
怎么看网站的服务器 发布:2025-07-11 10:03:16 浏览:603
红米手机wlan输入密码在哪里 发布:2025-07-11 10:02:32 浏览:432
懒人学编程 发布:2025-07-11 09:44:58 浏览:333
android命令行签名 发布:2025-07-11 09:44:15 浏览:881
应用密码怎么取消密码 发布:2025-07-11 09:28:33 浏览:797
pythonubuntumysql 发布:2025-07-11 09:23:47 浏览:531
硬盘属于外部存储器吗 发布:2025-07-11 09:09:39 浏览:936