4 ms·
Slightly off-topic: didn't know what ⌊x/2⌋ is Google: x squared (???) GPT: The expression ⌊x/2⌋ represents the greatest integer that is less than or equal to
by postsantum 3y ago
Slightly off-topic: didn't know what ⌊x/2⌋ is
Google: x squared (???)
GPT: The expression ⌊x/2⌋ represents the greatest integer that is less than or equal to x/2. It is called the floor function of x/2. For example, if x=5, then ⌊x/2⌋ = ⌊5/2⌋ = 2. If x is an even integer, then ⌊x/2⌋ = x/2. If x is an odd integer, then ⌊x/2⌋ = (x-1)/2.
- bluepod4 3y agoI was aware of the floor function (and the corresponding ceiling function) since I’m a software engineer. But I wasn’t aware that you could graph it. It never came up in high school or college math. And I never thought about it. Of course, it makes sense now that I’ve seen it.
- wholinator2 3y agoIt's also sometimes referred to as a step-function though i believe that name encompasses many more functions than just the floor
- hgsgm 3y agoIt's piecewise-linear and periodic. Also called sawtooth. Step functions are piecewise constant. It would not be fun to climb steps of this shape.
- bluepod4 3y agoYeah, in college I’ve worked with step/unit functions in both my “differential equations” and “signal and systems” classes for sure. But it never occurred to me and it was never presented by professors or TAs that they were essentially the same as floor/ceiling functions. Or maybe I just forgot since it’s been more than a decade?
- hgsgm 3y agoCan you name a single-variable function that software engineers use that can't be graphed? How would such a function be useful?
- bluepod4 3y agoNo. I think the term “function” is overloaded here. My point was that I viewed it solely as a _programming_ function and not a _mathematical_ function (even though it exists in math libraries), hence my last sentence “Of course, it makes sense now that I’ve seen it.” Out of all the functions in math libraries that I’ve used, floor/ceiling are the only ones where I had this idea for some reason. It was obvious to me that Math.sin(x) and Math.abs(x) can be graphed. I’ve seen those graphs over and over again. But whenever I used the floor or ceiling functions, I just thought in terms of rounding up or down with a predetermined rule to finish whatever piece of code I was working on. But as others have pointed out, I have actually worked with the floor function as a mathematical function in several math classes. I have seen the graphs. They just weren’t called floor or ceiling functions. I just never made the connection that they were the same and I don’t recall any computer science professor or TA “bridging the gap” to what was learned in the math classes.
- kolbe 3y agoIt's the floor operator. Also known as round down.
- eesmith 3y agoAnd introduced by Iverson for APL in 1962: https://www.johndcook.com/blog/2021/04/15/floor-ceiling-bracket/ https://www.johndcook.com/blog/2021/04/15/floor-ceiling-brac... and https://en.wikipedia.org/wiki/Floor_and_ceiling_functions https://en.wikipedia.org/wiki/Floor_and_ceiling_functions .
- hgsgm 3y agoAPL, famous for baffling programmers with weird notation, also known for making one part of math more readable :-)
- mjd 3y agoSorry about this. I added an explanation to the article.
- housecarpenter 3y agoI expect Google is stripping the ⌊ ⌋ brackets out as punctuation in the search, so that you're effectively only searching for "x2", hence the "x squared" results.