modf 函数 介绍

来源:互联网 发布:软件授权码绑定 编辑:程序博客网 时间:2024/04/30 19:55
函数名:modf
功 能: 把数分为整数和小数
 
举例说明:
 
 
#include <math.h> #include <stdio.h> int main(void) { double fraction, integer; double number = 100000.567; fraction = modf(number, &integer); printf("The whole and fractional parts of %lf are %lf and %lf\n", number, integer, fraction); return 0; }

结果是:
The whole and fractional parts of 100000.567000 are 100000.000000 and 0.567000

怎么样,明白了吧
原创粉丝点击