In my case Math.ceil was the solution. With Math.round or Math.floor I always had one value too low.
Math.ceil(scrollTop) >= scrollHeight - clientHeight