CS people what do you call // ?
-
@futurebird
a = (a DIV b) * b + (a MOD b)Would you say "a div b" if explaining it to a fifth grader?
-
CS people what do you call // ?
As in 16//5=3
* integer divide
* double divide
* floor
* floor divide@futurebird A comment đââď¸ââĄď¸
-
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.
@futurebird I mean, I'm an engineer, int pi=3
-
@futurebird A comment đââď¸ââĄď¸
-
@futurebird I mean, I'm an engineer, int pi=3
Making it an int is EXTRA offensive. I could forgive float pi=3
-
Making it an int is EXTRA offensive. I could forgive float pi=3
@futurebird but then I can't just divide an int by it and get the result into an int!
-
@futurebird A comment đââď¸ââĄď¸
@futurebird Darn, I just clicked on reply and didn't see that n people had already said the same thing. Sorry.
-
@futurebird but then I can't just divide an int by it and get the result into an int!
@futurebird I'd have to do // but the text turns grey when I do that!
-
CS people what do you call // ?
As in 16//5=3
* integer divide
* double divide
* floor
* floor divide@futurebird I'd call it an integer divide, I think.
-
Would you say "a div b" if explaining it to a fifth grader?
@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 operators
https://www.bbcbasic.co.uk/bbcwin/tutorial/chapter05.html
and I was comfortable using them towards the tail end of primary school.
-
@futurebird I mean, I'm an engineer, int pi=3
@ehproque @futurebird I'm an astronomer. Let's call it ten for now...
-
CS people what do you call // ?
As in 16//5=3
* integer divide
* double divide
* floor
* floor divide@futurebird I have no idea what this even means, but I call it "Slash, slash."
-
@ehproque @futurebird I'm an astronomer. Let's call it ten for now...
-
@ehproque @futurebird I'm an astronomer. Let's call it ten for now...
@khleedril @futurebird I'm a quantum physicist, let's call it 1
-
@futurebird I have no idea what this even means, but I call it "Slash, slash."
You and the whole fifth grade.
-
@khleedril @futurebird I'm a quantum physicist, let's call it 1
@khleedril @futurebird â=h, where is your God now
-
CS people what do you call // ?
As in 16//5=3
* integer divide
* double divide
* floor
* floor divide@futurebird Comment?
*ducks*
-
@futurebird a comment
@futurebird in all seriousnessness, the use of "floor divide" implies the result is rounded towards negative infinity, in contrast with "trunc divide" , which implies rounding toward zero, an important distinction when one operand turns out to be negative. Now here's a question: in your favorite languages, which way does integer divide behave? Does the language definition even require a particular behavior? (C90 and C99 for example call it "implementation defined". )
-
@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 Does What I Need But Better Stay Away From.@martok this operator has returned an int since it was added in Python 2.2, so this seems weird?
-
@futurebird Comment?
*ducks*
@futurebird Jokes aside, is it a floor or a towards-zero like the awful C "division" operator? That would affect proper naming a lot.