求救 关于 mod 的正确使用!!!

jsg 2001-06-29 09:35:08
...全文
78 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
SSTS 2001-06-30
  • 打赏
  • 举报
回复
?????????
竟然不成功!
SSTS 2001-06-30
  • 打赏
  • 举报
回复
CTRL+U
Chxis 2001-06-29
  • 打赏
  • 举报
回复
haha,我也赞成undo
smartboyme 2001-06-29
  • 打赏
  • 举报
回复
还是错
double x = -10.0,y=3.0, z;

灌水灌多了。

CSDN怎么没有Undo啊!
我想undo一下!
smartboyme 2001-06-29
  • 打赏
  • 举报
回复
错了,
应该是:
double x = 3.0, y = -10.0, z;
我真是太粗心了!

msdn也有错啊!

Chxis 2001-06-29
  • 打赏
  • 举报
回复
z=fmod(x,y)
x对y取模,并付给z,

to smartboyme(小东):
double w = -10.0, x = 3.0, y = 0.0, z;

z = fmod( x, y );

but y==0.0 ?????
z will be 0 ,
smartboyme 2001-06-29
  • 打赏
  • 举报
回复
我猜是吧!
fmod
Calculates the floating-point remainder.

double fmod( double x, double y );

Function Required Header Compatibility
fmod <math.h> ANSI, Win 95, Win NT


For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version


Return Value

fmod returns the floating-point remainder of x / y. If the value of y is 0.0, fmod returns a quiet NaN. For information about representation of a quiet NaN by the printf family, see printf.

Parameters

x, y

Floating-point values

Remarks

The fmod function calculates the floating-point remainder f of x / y such that x = i * y + f, where i is an integer, f has the same sign as x, and the absolute value of f is less than the absolute value of y.

Example

/* FMOD.C: This program displays a
* floating-point remainder.
*/

#include <math.h>
#include <stdio.h>

void main( void )
{
double w = -10.0, x = 3.0, y = 0.0, z;

z = fmod( x, y );
printf( "The remainder of %.2f / %.2f is %f\n", w, x, z );
printf( "The remainder of %.2f / %.2f is %f\n", x, y, z );

}


Output

The remainder of -10.00 / 3.00 is -1.000000

Chxis 2001-06-29
  • 打赏
  • 举报
回复
是fmod吗?

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧