Hacker News new | past | comments | ask | show | jobs | submit login

I suspect this is why the topic is relatively obscure; situations where you have a negative divisor and need the remainder/mod are not common.



> situations where you have a negative divisor and need the remainder/mod are not common.

yep. But sometimes, when you have numbers that come from some external system, and you didn't check them or expect that the % operator will make it positive, you end up with this sort of problem. Such as having negative positions with CSS, or a game where you end up with negative values for coordinates.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: