⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s_floor.c

📁 KPIT GNU Tools is a set of GNU development tools for Renesas microcontrollers.
💻 C
字号:
/* @(#)z_floor.c 1.0 98/08/13 *//*FUNCTION<<floor>>, <<floorf>>, <<ceil>>, <<ceilf>>---floor and ceilingINDEX        floorINDEX        floorfINDEX        ceilINDEX        ceilfANSI_SYNOPSIS        #include <math.h>        double floor(double <[x]>);        float floorf(float <[x]>);        double ceil(double <[x]>);        float ceilf(float <[x]>);TRAD_SYNOPSIS        #include <math.h>        double floor(<[x]>)        double <[x]>;        float floorf(<[x]>)        float <[x]>;        double ceil(<[x]>)        double <[x]>;        float ceilf(<[x]>)        float <[x]>;DESCRIPTION<<floor>> and <<floorf>> find@tex$\lfloor x \rfloor$,@end texthe nearest integer less than or equal to <[x]>.<<ceil>> and <<ceilf>> find@tex$\lceil x\rceil$,@end texthe nearest integer greater than or equal to <[x]>.RETURNS<<floor>> and <<ceil>> return the integer result as a double.<<floorf>> and <<ceilf>> return the integer result as a float.PORTABILITY<<floor>> and <<ceil>> are ANSI.<<floorf>> and <<ceilf>> are extensions.*//***************************************************************** * floor  * * Input: *   x  - floating point value * * Output: *   Smallest integer less than x. * * Description: *   This routine returns the smallest integer less than x. * *****************************************************************/#include "fdlibm.h"#include "zmath.h"#ifndef _DOUBLE_IS_32BITSdouble _DEFUN (floor, (double),              double x){  double f, y;  if (x > -1.0 && x < 1.0)    return (x >= 0 ? 0 : -1.0);  y = modf (x, &f);  if (y == 0.0)    return (x);  return (x >= 0 ? f : f - 1.0);}#endif /* _DOUBLE_IS_32BITS */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -