0
Why cant i use mod operator to find remainder of a floating point no. Divided by any no even when we use floating point datatyp
ex when we use float c = 23.5%5; it shows error
2 Antworten
+ 16
if you use a 32Bit system and a unsigned float and you know that the first 16 Bit are used for the Numbers before the dot and the other 16 Bit are used for the rest, you can use the folliwing function/code:
float myNum = 2.345;
float rest = 0.0;
rest = myNum && #0000FFFF;
cout << rest;
in this case you used a mask to filter the first part, that is stored in the first 16 Bit.
+ 2
Modulus is only for integer types, at least in C++. I believe that fmod() is the function for float modulus.