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

double
floatval_mod(double n2, double n3)
{
    return (n2 - n3 * floor(n2 / n3));
}
void
try(double x, double y, double answer)
{
    printf("floor(%4.1f/%4.1f) = %4.1f, floatval_mod(%4.1f, %4.1f) = %4.1f,  expect %4.1f\n",
	x, y, floor(x/y), x, y, floatval_mod(x, y), answer);
    return;
}

int main(int argc, char **argv)
{
    try(5.0,  -3.0, -1.0);
    try(-5.0,  3.0,  1.0);
    try(-5.0, -3.0, -2.0);
    return 0;
}
