In this expression statement
lsb = lsb % 10;
the both operands of the operator %
have an integer type.
While in this expression statement
lsb = (floor(d)) % 10;
one operand of the operator %
has a float type and the second operand has an integer type.
The operator %
is defined only for integer types or for unscoped enumerations.
From the C++ (2014) Standard (5.6 Multiplicative operators)
2 The operands of * and / shall have arithmetic or unscoped
enumeration type; the operands of % shall have integral or unscoped
enumeration type. The usual arithmetic conversions are performed on
the operands and determine the type of the result.
You could cast the first operand to the type int
to make the expression correct.