当前位置: C语言 -- 标准库 -- <math.h> -- remquof

remquof函数


概要:
#include <math.h>
float remquof(float x, float y, int *quo);

描述:

该函数计算与函数remainderf相同的余数。参数quo指向对象中存储的值与表达式x/y具有相同的符号,并且该值和表达式x/y的整数商对模2n同余,其中n是实现定义的大于或者等于3的整数。

如果参数y0,存储在参数quo指向对象中的值是不确定的;并且是发生域错误,还是返回0,将由实现定义。


参数:
float x

参数为一个float类型的浮点数。

float y

参数为一个float类型的浮点数。

int *quo

参数为一个指向int类型对象的指针。


返回值:

函数返回(x REM y)


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
/*函数remquof范例*/

#include <math.h>
#include <stdio.h>

int main(void)
{
    float x, y;
    int a, b;

    x = remquof(6.5f,3.0f,&a);
    printf("The remainder:%f\n", x);
    printf("The quotient:%d\n", a);

    y = remquof(8.5f, 3.0f, &b);
    printf("The remainder:%f\n", y);
    printf("The quotient:%d\n", b);

    return 0;
}

输出:

The remainder:0.500000

The quotient:2

The remainder:-0.500000

The quotient:3


相关内容:
remquo double类型的计算余数函数。
remquol long double类型的计算余数函数。