C 库函数 - floor()
C 语言教程
· 2019-02-23 10:43:23
描述
C 库函数 double floor(double x) 返回小于或等于 x 的最大的整数值。
声明
下面是 floor() 函数的声明。
double floor(double x)
参数
- x -- 浮点值。
返回值
该函数返回不大于 x 的最大整数值。
实例
下面的实例演示了 floor() 函数的用法。
#include <stdio.h>
#include <math.h>
int main ()
{
float val1, val2, val3, val4;
val1 = 1.6;
val2 = 1.2;
val3 = 2.8;
val4 = 2.3;
printf("Value1 = %.1lf\n", floor(val1));
printf("Value2 = %.1lf\n", floor(val2));
printf("Value3 = %.1lf\n", floor(val3));
printf("Value4 = %.1lf\n", floor(val4));
return(0);
}
让我们编译并运行上面的程序,这将产生以下结果:
Value1 = 1.0 Value2 = 1.0 Value3 = 2.0 Value4 = 2.0
点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html
ANSI Common Lisp
Paul Graham / Prentice Hall / 1995-11-12 / USD 116.40
For use as a core text supplement in any course covering common LISP such as Artificial Intelligence or Concepts of Programming Languages. Teaching students new and more powerful ways of thinking abo......一起来看看 《ANSI Common Lisp》 这本书的介绍吧!