Post B32mYkfisvvKB6s90C by jonathanhogg@mastodon.social
 (DIR) More posts by jonathanhogg@mastodon.social
 (DIR) Post #B32boBiHWtBqtRE8rg by futurebird@sauropods.win
       2026-02-06T10:02:21Z
       
       0 likes, 0 repeats
       
       CS people what do you call // ?As in 16//5=3* integer divide* double divide* floor* floor divide
       
 (DIR) Post #B32c7pGOhsbF3fY4VE by ehproque@neopaquita.es
       2026-02-06T10:05:51Z
       
       0 likes, 0 repeats
       
       @futurebird are you telling me that all these years I didn't need to do floor(16/5) ??
       
 (DIR) Post #B32cAYqkBn5f1Kqz7Q by RogerBW@discordian.social
       2026-02-06T10:06:22Z
       
       0 likes, 0 repeats
       
       @futurebird Integer division, truncating division, Euclidean division.
       
 (DIR) Post #B32cCHFCcJdczt70xU by futurebird@sauropods.win
       2026-02-06T10:06:42Z
       
       0 likes, 0 repeats
       
       @ehproque % is mod and // is floor and they make the world go round.
       
 (DIR) Post #B32cIhxcCPeHasx6RM by sleet01@fosstodon.org
       2026-02-06T10:07:49Z
       
       0 likes, 0 repeats
       
       @futurebird I've been calling it "integer division" but apparently it's actually "floor division" and I've just been lucky enough to never use it on a negative number?
       
 (DIR) Post #B32cL6HwifqncnbQg4 by ehproque@neopaquita.es
       2026-02-06T10:08:17Z
       
       0 likes, 0 repeats
       
       @futurebird % I knew how to use before I knew what a derivative was, but //   has always been a comment to me
       
 (DIR) Post #B32cU1ZnbliLcJCzmS by joelvanderwerf@mastodon.social
       2026-02-06T10:09:52Z
       
       0 likes, 0 repeats
       
       @futurebird Two thirds of an Apple ///?
       
 (DIR) Post #B32cVy6vSrVxRnd94i by futurebird@sauropods.win
       2026-02-06T10:10:16Z
       
       0 likes, 0 repeats
       
       @ehproque I program in flavors of java every day and use // for comment, but somehow forgot that. I guess floorDiv() is fine. Seems wordy IDK.
       
 (DIR) Post #B32cZL04onDhJ527uq by iris@neuromatch.social
       2026-02-06T10:10:50Z
       
       0 likes, 0 repeats
       
       @futurebird I think integer division or quotient.
       
 (DIR) Post #B32caHEyHZb3w4RqBU by ehproque@neopaquita.es
       2026-02-06T10:11:01Z
       
       0 likes, 0 repeats
       
       @futurebird do you know how to get pi in c++?
       
 (DIR) Post #B32cdx733ijUfWUjUO by llewelly@sauropods.win
       2026-02-06T10:11:41Z
       
       0 likes, 0 repeats
       
       @futurebird a comment
       
 (DIR) Post #B32cgmTn37uEYjTrjU by futurebird@sauropods.win
       2026-02-06T10:12:13Z
       
       0 likes, 0 repeats
       
       @ehproque um... not really. What do you do? load a math library?I mean, how much pi do we need? Just type out ten decimal places and make it a global.
       
 (DIR) Post #B32d2om7CADY38Ymwa by bencurthoys@mastodon.social
       2026-02-06T10:16:10Z
       
       0 likes, 0 repeats
       
       @futurebird DIV and MOD. 16 DIV 5 = 316 MOD 5 = 1
       
 (DIR) Post #B32d9UJjefVYd0SyBc by martok@mstdn.social
       2026-02-06T10:17:21Z
       
       0 likes, 0 repeats
       
       @futurebird I used to call it integer division until I learned that at least in Python it doesn't actually return an int.Now I just call it The Thing That Looks Like It Dooes What I Need But Better Stay Away From.
       
 (DIR) Post #B32dFcaBpySY055Tai by ehproque@neopaquita.es
       2026-02-06T10:18:29Z
       
       0 likes, 0 repeats
       
       @futurebird nobody knows! There's like a zillion ways to do it because there isn't something like a "include <maths>maths::pi"
       
 (DIR) Post #B32dGbleLys5lHuzQG by bencurthoys@mastodon.social
       2026-02-06T10:17:36Z
       
       0 likes, 0 repeats
       
       @futurebird a = (a DIV b) * b + (a MOD b)
       
 (DIR) Post #B32dGd0viegjcy4hsW by futurebird@sauropods.win
       2026-02-06T10:18:38Z
       
       0 likes, 0 repeats
       
       @bencurthoys Would you say "a div b" if explaining it to a fifth grader?
       
 (DIR) Post #B32dHp40P97NHw5Cwi by amenonsen@mastodon.social
       2026-02-06T10:18:55Z
       
       0 likes, 0 repeats
       
       @futurebird A comment 🏃‍♂️‍➡️
       
 (DIR) Post #B32dJJTioCLxuKp2no by ehproque@neopaquita.es
       2026-02-06T10:19:09Z
       
       0 likes, 0 repeats
       
       @futurebird I mean, I'm an engineer, int pi=3
       
 (DIR) Post #B32dK9wviqcAdyt6Y4 by futurebird@sauropods.win
       2026-02-06T10:19:16Z
       
       0 likes, 0 repeats
       
       @amenonsen GET OUT
       
 (DIR) Post #B32dMf3L3Gq5gk4uYa by futurebird@sauropods.win
       2026-02-06T10:19:47Z
       
       0 likes, 0 repeats
       
       @ehproque Making it an int is EXTRA offensive. I could forgive float pi=3
       
 (DIR) Post #B32dSZAlpKFrBmN0xE by ehproque@neopaquita.es
       2026-02-06T10:20:49Z
       
       0 likes, 0 repeats
       
       @futurebird but then I can't just divide an int by it and get the result into an int!
       
 (DIR) Post #B32eWlN4W0cU8NgmuG by darkling@mstdn.social
       2026-02-06T10:32:45Z
       
       0 likes, 0 repeats
       
       @futurebird I'd call it an integer divide, I think.
       
 (DIR) Post #B32fCQKD9e6Z1VDTYe by bencurthoys@mastodon.social
       2026-02-06T10:40:19Z
       
       0 likes, 0 repeats
       
       @futurebird I'd say "division with remainder" if explaining it to a child. "Sixteen divided by five is three remainder one". But my first computer - a BBC Model B - had DIV and MOD operatorshttps://www.bbcbasic.co.uk/bbcwin/tutorial/chapter05.htmland I was comfortable using them towards the tail end of primary school.
       
 (DIR) Post #B32hvFqNAc8hSJlSN6 by khleedril@cyberplace.social
       2026-02-06T11:10:47Z
       
       0 likes, 0 repeats
       
       @futurebird I have no idea what this even means, but I call it "Slash, slash."
       
 (DIR) Post #B32hxcmuppidCAHGtM by khleedril@cyberplace.social
       2026-02-06T11:08:46Z
       
       0 likes, 0 repeats
       
       @ehproque @futurebird I'm an astronomer.  Let's call it ten for now...
       
 (DIR) Post #B32hxdyePghSsqm9p2 by futurebird@sauropods.win
       2026-02-06T11:11:16Z
       
       0 likes, 0 repeats
       
       @khleedril @ehproque **muffled whimpering**stoooop
       
 (DIR) Post #B32i1R0uYN8npudmTI by futurebird@sauropods.win
       2026-02-06T11:11:58Z
       
       0 likes, 0 repeats
       
       @khleedril You and the whole fifth grade.
       
 (DIR) Post #B32kLbGYLSSLKihTl2 by david_chisnall@infosec.exchange
       2026-02-06T11:38:00Z
       
       0 likes, 0 repeats
       
       @futurebird I can't read this and not interpret // as a start-of-line-comment marker.  So this line is just 16.  And I call 16 an integer.
       
 (DIR) Post #B32mYkfisvvKB6s90C by jonathanhogg@mastodon.social
       2026-02-06T12:02:47Z
       
       0 likes, 0 repeats
       
       @futurebird Years ago I got offered "show your Python skills" quiz on LinkedIn and the answer to this question was given as "integer division". I was so furious I put in a complaint. It is, of course, "floor division". And Python-style modulus is the One True '%' operator –C's remainder can get in the bin.
       
 (DIR) Post #B32nJ0fXjxtZ74qUts by yonder@spacey.space
       2026-02-06T11:52:37Z
       
       0 likes, 0 repeats
       
       @ehproque I still like to...#define PI 3.14159265358979it feels artisan. bespoke. handwoven@futurebird
       
 (DIR) Post #B32nJ26WP94NZ2TYae by futurebird@sauropods.win
       2026-02-06T12:11:07Z
       
       0 likes, 1 repeats
       
       @yonder @ehproque no no no THIS is "hand crafted" ... only the finest pi made of the most dubious loops. import randomimport mathinside=0.0resolution=60000for i in range(resolution):  x,y = random.random(),random.random()  if math.sqrt(x*x+y*y)<1:    inside+=1    pi=4*inside/resolutionprint(pi)
       
 (DIR) Post #B32nSFDL20ngpX3YzQ by futurebird@sauropods.win
       2026-02-06T12:12:51Z
       
       0 likes, 0 repeats
       
       @yonder @ehproque importing math feels very goofy. I should write a square root finder to avoid that. How do those go? It's like newton's method I think.
       
 (DIR) Post #B32nXgl03SxxhWOhkG by futurebird@sauropods.win
       2026-02-06T12:13:50Z
       
       0 likes, 0 repeats
       
       @yonder @ehproque And now that I think about it, we don't need random either, just make it an grid, if it's fine enough it should be OK, right?
       
 (DIR) Post #B32nwwLzCjRnJQjqAi by darkling@mstdn.social
       2026-02-06T12:18:22Z
       
       0 likes, 0 repeats
       
       @futurebird @yonder @ehproque Newton's method converges wonderfully quickly, so it's often a good place to start. I believe that CORDIC algorithms can also do square roots (although I haven't seen or derived one myself) -- those can be nicer for implementation if you don't have an FPU (or are building one), because they tend to be all about adds and bit-shifts and not much else.CORDIC only generates one digit per iteration, though, whereas Newton doubles the precision each time.
       
 (DIR) Post #B32o1DZd7eorsU9yjI by burnitdown@beige.party
       2026-02-06T12:19:07Z
       
       0 likes, 0 repeats
       
       @ehproque @futurebird i need more pi
       
 (DIR) Post #B32oK1TaKCnhrOIcBk by gbargoud@masto.nyc
       2026-02-06T12:22:32Z
       
       0 likes, 0 repeats
       
       @yonder @ehproque @futurebird Can random.random() be stuck in a constexpr to do that at compile time or did someone rightfully shoot down the idea of compile time nonsererminism?
       
 (DIR) Post #B32pXZznORiWdhOThI by futurebird@sauropods.win
       2026-02-06T12:36:13Z
       
       0 likes, 0 repeats
       
       We don't need any random numbers to be THIS terrible. def root(n, tolerance=0.00001):  if n==0:    return 0  g = n/2  while 1==1:    save = g    g = 0.5 * (save + n / save)     if abs(g - save) < tolerance:      break  return ginside=0.0resolution=100for x in range(resolution):  x=x/resolution  for y in range(resolution):    y=y/resolution        if root(x*x+y*y)<1:      inside+=1pi=4*inside/(resolution*resolution)print(pi)
       
 (DIR) Post #B32smPHhnbD3cqX5kG by futurebird@sauropods.win
       2026-02-06T13:12:25Z
       
       0 likes, 0 repeats
       
       @daniel OMG You know, when I started writing this I had that in mind and just forgot about it... LMAO.
       
 (DIR) Post #B32wxjRXacLL9GmyGG by llewelly@sauropods.win
       2026-02-06T13:58:54Z
       
       0 likes, 1 repeats
       
       @c0dec0dec0de @futurebird imagine you descended to the basement of a strange building, and suddenly found yourself stuck to the ceiling. Such is the world of programming when not everyone agrees on the meaning of floor() ... *sigh*
       
 (DIR) Post #B32xq1Ol368STNNHF2 by oblomov@sociale.network
       2026-02-06T14:09:03Z
       
       0 likes, 0 repeats
       
       @futurebird integer divide. Floor divide may or may not be appropriate for negative operands depending on how it is defined.
       
 (DIR) Post #B3378hLohyBTO0ymYa by knord@mastodon.social
       2026-02-06T15:53:22Z
       
       0 likes, 0 repeats
       
       @futurebird @yonder @ehproque the pi of monte carlo
       
 (DIR) Post #B33OsKW3dcxL6h78MK by mansr@society.oftrolls.com
       2026-02-06T19:12:05Z
       
       0 likes, 0 repeats
       
       @futurebird C programmers call that a comment.