d_mod.c
来自「在Linxu程序设计当中」· C语言 代码 · 共 47 行
C
47 行
#include "f2c.h"#ifdef KR_headers#ifdef IEEE_dremdouble drem();#elsedouble floor();#endifdouble d_mod(x,y) doublereal *x, *y;#else#ifdef IEEE_dremdouble drem(double, double);#else#undef abs#include "math.h"#ifdef __cplusplusextern "C" {#endif#endifdouble d_mod(doublereal *x, doublereal *y)#endif{#ifdef IEEE_drem double xa, ya, z; if ((ya = *y) < 0.) ya = -ya; z = drem(xa = *x, ya); if (xa > 0) { if (z < 0) z += ya; } else if (z > 0) z -= ya; return z;#else double quotient; if( (quotient = *x / *y) >= 0) quotient = floor(quotient); else quotient = -floor(-quotient); return(*x - (*y) * quotient );#endif}#ifdef __cplusplus}#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?