I answeredanswered a meta question a while back asking a similar question.
Stack Overflow presents knowledge. Just like a book. If you gain knowledge from a book, then using this knowledge doesn't need citation. You don't cite your grammar school book on use of the English language with any word you type either, right?
Now if you quote verbatim, you need citations. But only on something that actually has creative value. If I quote Shakespeare, I better do so properly. But somebody has said "good morning" first. And I sure won't mention his name every morning for about 10-20 times.
Your examples are things that are really just common knowledge. Comparing floating point values? Calculating something from two integers? That's not things worth attributing. Everybody does that. It is obvious that nobody had programming just implanted. We all learned it somewhere and from somebody.
If you actually learn something from Stack Overflow (and I realize not everybody does), you don't need to copy it verbatim. You will adapt it to your needs, even if your needs are just different variable naming or braces. And if you adapt what you learned, you don't need to attribute it to someone. It's your product, even if you had help creating it. We all have help creating things. Nobody can create things out of thin air.