4 ms·
Is this a problem that comes up often? What kind of situation would make you want to calculate this?
by beervirus 6y ago
Is this a problem that comes up often? What kind of situation would make you want to calculate this?
- baddox 6y agoIt's common in computer graphics and user interface programming. You want to move your character around a 2D grid, but you don't want either of its x and y coordinates to ever move outside the bounds of the 2D grid. Or you want a web page with an article section that is 50% of the browser width, but never narrower than 300px and never wider than 800px.
- mr_toad 6y agoIt’s pretty common in data science or financial applications to restrict the range of data in this way. There are probably SQL devs reading this and wondering what the fuss is about.