I should have said a well chosen epsilon. If the computation is good to 0.001, (based on a detailed error propagation analysis of the algorithm against the expected input range), then I would use an epsilon of 1/512 when comparing against an int. The idea is that with a coarseness at that level the compiler rounding would likely have little effect. The comparison number would be (int + a power of two). But it sounds like for your scenario a scaled int or a rational would be more appropriate.
If you have access to a university library, (most universities will let you sign in and browse), is Chapter One of Stoer and Bullrish text Introduction to Numerical Analysis. (ISBN 0-387-954452)
It is on my desk because I am working out the epsilon for an algorithm a colleague designed. :-)
Unless this is a numeric simulation where performance really matters, the correct answer is that you should not be using floats in the first place. Use a rational type, or scaled integers instead. If this is a numerical computation the comparison should be using an epsilon.
Floats are strictly a performance optimization for doing computations whose solutions could be rational or irrational numbers. In all other cases you should either use integers or rational numbers.
Bottom line is if you are not doing physics, graphics, signal processing, or system/financial modeling you should never use floats/doubles/quad
If the need to do this comparison is because of a non-numerical third party library giving you a float, you should consider dropping the library. The library author, while not likely to be an idiot in the broader sense, is definitely a numerical idiot.
If you have experience solving hard problems that helps. I had the good fortune of doing so in graduate school. That lead to a job solving another totally unrelated hard problem, with a technology stack totally unrelated to my graduate work. Once I had two gigs like that, the only people who responded to my resume's were people looking for someone to work with immature technology, or had a very hard problem to solve.
Also once you decide that you want to have a professional career jumping on technology grenades, do not work as an employee. I made that mistake. The nature of grenade jumping is that your are asked to solve a hard problem that needs to be solved in a short time, if you are an employee this amounts to massive hours, (70-90 hour work weeks), of unpaid overtime. Work as a contractor and be sure to bill for every hour. Or be sure to get a very healthy option grant if it is a promising start up. My life has been much happier once I started doing that.
Also be sure to work out, this sort of work takes a severe toll on your health if you do it for 20-30 years.
When I was an undergrad and graduate student I got into the habit of always doing the readings pencil in hand, which involves filling in the details of the important proofs, and doing some simple problems of my own devising before going to the lecture. I still do that before I work the exercises for an online course.
Of course whether I finish the exercises before the lecture completes really depends on the course. If it is implementing a simple algorithm and devising some test cases for it then it is often the case. If it is implementing an ML algorithm over a large data set, of course not.
Also I have been working in open offices for a long time, so I have learned to focus when there is a lot of background noise. I usually do not start paying attention to the lectures unless it sounds like there is a good joke, or I am getting stuck doing the exercises.
I also do not actually watch the lectures, I only listen to them unless I get stuck in the exercises.
That is funny, every time I see a course with a bunch of video lectures and no notes and reading list I move on. My strong preference for on-line learning is a reading list, ideally spread between no more than 3 or 4 books, a syllabus, and list of exercises.
If there are videos I listen to them while I am doing the homework associated with the video, but usually I get the homework done before the video finishes.
Disclaimer: I can probably get away with this because I already have a PhD and so I have a lot of practice in learning things
If you have access to a university library, (most universities will let you sign in and browse), is Chapter One of Stoer and Bullrish text Introduction to Numerical Analysis. (ISBN 0-387-954452)
It is on my desk because I am working out the epsilon for an algorithm a colleague designed. :-)