C 库函数 - modf()
C 语言教程
· 2019-02-23 09:26:51
描述
C 库函数 double modf(double x, double *integer) 返回值为小数部分(小数点后的部分),并设置 integer 为整数部分。
声明
下面是 modf() 函数的声明。
double modf(double x, double *integer)
参数
- x -- 浮点值。
- integer -- 指向一个对象的指针,该对象存储了整数部分。
返回值
该函数返回 x 的小数部分,符号与 x 相同。
实例
下面的实例演示了 modf() 函数的用法。
#include<stdio.h>
#include<math.h>
int main ()
{
double x, fractpart, intpart;
x = 8.123456;
fractpart = modf(x, &intpart);
printf("整数部分 = %lf\n", intpart);
printf("小数部分 = %lf \n", fractpart);
return(0);
}
让我们编译并运行上面的程序,这将产生以下结果:
整数部分 = 8.000000 小数部分 = 0.123456
点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html
Writing Windows VxDs and Device Drivers, Second Edition
Karen Hazzah / CMP / 1996-01-12 / USD 54.95
Software developer and author Karen Hazzah expands her original treatise on device drivers in the second edition of "Writing Windows VxDs and Device Drivers." The book and companion disk include the a......一起来看看 《Writing Windows VxDs and Device Drivers, Second Edition》 这本书的介绍吧!