小编00r*_*rhn的帖子

pow和powf有什么区别

我尝试解决数学问题,输出灵敏度有点不同,如0.07.然后我比较pow()powf()在我的代码中看到这种敏感性.代码如下:

int main()
{

    int terms, sign=-1;
    double x, operation=0.0;

    printf("Please enter the number of terms : ");
    scanf_s("%d", &terms);

    while (terms <= 0)
    {
        printf("Please re-enter the number of terms :");
        scanf_s("%d", &terms);
    }

    printf("Please enter a value for x :");
    scanf_s("%lf", &x);

    for (int i = 1; i <= terms; i++)
    {
    sign = sign * (-1);
    operation = operation + sign * powf(x + i / 10.0, (2 * i) - 1) / …
Run Code Online (Sandbox Code Playgroud)

c floating-accuracy

0
推荐指数
1
解决办法
526
查看次数

标签 统计

c ×1

floating-accuracy ×1