LoginSignup
0
2

More than 5 years have passed since last update.

C言語とC#で剰余演算対比

Posted at

主に浮動小数点数型での剰余演算の対比表。

int

C C#(.Net)
div Math.DivRem

double

C C#(.Net)
operator / operator /
fmod operator %
remainder Math.IEEERemainder
modf static double modf(double x, out double intptr) { intptr = Math.Truncate(x); return x % 1f; }

float

C C#(.Net)
operator / operator /
fmodf operator %
remainderf MathF.IEEERemainder
modff static float modff(float x, out float intptr) { intptr = MathF.Truncate(x); return x % 1f; }
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2