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

📄 round.h

📁 Digital Notebook Source Code v1.1.0 [
💻 H
字号:
/* +++Date last modified: 05-Jul-1997 *//*** rounding macros by Dave Knapp, Thad Smith, Jon Strayer, & Bob Stout*/#ifndef ROUND__H#define ROUND__H#include <math.h>#if defined(__cplusplus) && __cplusplus/*** Safe C++ inline versions*//* round to integer */inline int iround(double x){      return (int)floor(x + 0.5);}
inline long lround(double x)
{
      return (long)floor(x + 0.5);
}
/* round number n to d decimal points */inline double fround(double n, unsigned d){      return floor(n * pow(10., d) + .5) / pow(10., d);}#else/*** NOTE: These C macro versions are unsafe since arguments are referenced**       more than once.****       Avoid using these with expression arguments to be safe.*//*** round to integer*/#define round(x) floor((x) + 0.5)/*** round number n to d decimal points*/#define fround(n,d) (floor((n)*pow(10.,(d))+.5)/pow(10.,(d)))#endif#endif /* ROUND__H */

⌨️ 快捷键说明

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