该fmod
功能如何实施?
我尝试了以下方法:
#include <stdio.h>
#include <math.h>
float floatMod(float a, float b)
{
return (a/b - floor(a/b));
}
int main()
{
printf("%f\n", fmod(18.5,4.2));
printf("%f\n", floatMod(18.5,4.2));
}
Run Code Online (Sandbox Code Playgroud)
但输出不一样......
c ×1