Float values in c


error: invalid operands to binary % (have ‘float’ and ‘double’)
How to debug?


I’m not sure debug is the right word here

Your compiler has already figured out what’s wrong and has told you. You’d have to rethink how you describe whatever it is you mean to do there using only actions that the C language defines

The compiler says that something isn’t possible. If you think it’s possible, then you’ll need to examine your argument for why that is, it has to be supported by something. So, what does the modulus operator do, and is that what you’re trying to use it for? (It’s not, that’s what the compiler says)

Oh and note that testing if the result of a floating point operation is exactly a particular value is probably a bad idea. Float is not a lossless valuetype. If you want something exact, use int and make sure you stay within its limits. If it’s not supposed to be exact then you also won’t be wanting to test if something is equal.