I have a function which is designed to round a number down to the nearest even number.
double round(double d) { floor(d + 0.5); if(d % 2 == 1) { d = d-1; } return d; } However, this returns the error "expression must have integral or enum type" when I try to compile the code. The error is reported from the same line as the if statement.
Can anyone point me in the right direction?
%on a double(in C++)floor(d + 0.5);doesn't do anything.