bitshift op
>>59482736
One of these things are different from the others.
no it isnt. everything divides by 2.
Real programming languages don't support bitshifting, thats just for autistic people lol
>>59482761
Until you consider rounding errors.
lol stfu highlevelfag
>>59482778
because multiply/division is the only purpose of bit shifting : ^ )
>>59482815
who said that?
>>>59482815
Whats wrong autist? mad that you cant find a job where something like bitshifting is relevant ??
learn java like a normal person lol
>>59482787
there aren't rounding errors where nothing cant be rounded.
Most compilers optimize power of 2 divisions into bit shifts.
Doing actual bit-shifting in your code is autistic.
>>59482895
>Most compilers
>>59482736
If your compiler doesn't do that for you automatically it's shit
>>59482778
>Real language
>Can't even use basic bitwise ops
HAHAHAHA what shit fucking garbage lang do you use? even fucking python has bit ops.
>>59482913
you fucking CIA nigger i wrote my own compiler
the difference between a professional and a ammatuere is if you write your own compiler
>>59482736
>>59482761
>>59482778
>>59482852
>>59482891
>>59482895
god damn shitheads. last one only works on integers.
>>59482964
you nigger stop shittalking if you dont know
>>59482895
IKR fucking autists bro
>>59482913
Who even uses compilers in 2k17 ?? its like you dont want to have a job
>>59482930
LUA
>>59482994
lua isnt a programming language
html is one.
each of these may yield different values on same input
>>59482736
>>1
what did he mean by this
>>59482994
>LUA
https://www.lua.org/manual/5.3/manual.html#3.4.2
>>59482994
>using an outdated version of Lua
So how's your roblox game coming along?
>>59482852
Actually my job is exactly that.
>>59482994
nice paste aspie
>>59483024
>html
>programming language
Pick one
>>59482994
>Who even uses compilers in 2k17 ?? its like you dont want to have a job
I'm a white man, I wrote my own fucking compiler, I'm not a nigger like Linus. I'm a professional, I started at Ticketmaster 1990 and we wrote a compiler, the difference between an amateur and a professional is you write your own compiler. I have a 20,000 line divine intellect compiler that operates just in time and ahead of time, you seem to be in denial.
>>59483789
>>59482936
My CIA niggers
>>59482778
What language doesn't support bitwise operations?
>>59482736
Wouldn't division of an int by two just get compiled into a bitshift anyway?
>>59484960
Yes. OP is retarded.
Any optimizing compiler will do this.
>>59482905
sorry, i meant literally every compiler.
What's the second one do?
>>59485363
Mulitplies by a half, so the equivalent of dividing by 2.
Or did you mean something else?
>>59485716
Why is the f there?
>>59485874
so it's a float instead of double
>>59485874
It's to tell the compiler that the number is a floating point number.
>>59485889
>>59485911
Ah, right. Thanks.
>>59482736
>Buttshifting floats.
>>59482736
>>59486272
where does n come from?
>>59486335
end condition for a loop over n
>>59486272
>x^0.5
>Using XOR
>any year
>>59486272
What is n?
>>59486352template<typename T>
void swap(T &a, T &b)
{
a ^= b;
b ^= a;
a ^= b;
}
>inb4 sepples
>>59482994
gamerfood is that you?
>>59482736
How does this work?
>>59486681
https://en.wikipedia.org/wiki/XOR_swap_algorithm#Reasons_for_avoidance_in_practice
>>59482736
>>59486774
https://en.wikipedia.org/wiki/XOR_swap_algorithm#Reasons_for_use_in_practice
>>59486934
>Because these situations are rare, most optimizing compilers do not generate XOR swap code.
>>59483789
Shitposting aside, it seems like a really bad idea
to use it.
>>59486841
>having bluetooth turned on
>browsing on phone
kys
>>59486352
C has an exponent operator, didn't you know? Here, you can test it:if (2^5 == 32)
if (3^3 == 27)
if (10^4 == 10000)
if (5^2 != 26)
if (4^3 != 8)
if (2^4 == 4^2) {
printf("exponentiation seems to be working just fine");
}
>>59487582
Wow, I didn't know that! This'll make my code much cleaner.
>>59487704
please don't
>>59482778
Hot
>>59482895
Im taking it you've never done embedded programming
because masking subroutines use bitshift
>>59482964
>bit shifting a signed int
>>59486841
This, people should focus on maintaining and improving modern compilers instead of worrying about autistic bit shifts.
>>59482736CL-USER> (/ 5 2)
5/2
CL-USER> (* 5 0.5)
2.5
CL-USER> (ash 5 -1)
2
>>59482736
>doing the compilers job
autism
>>59482736
Why don't they include tricks like these in compilers? Would a compiler turn divide by two for an integer into bitshift?
>>59490054
>5/2
>>59490054
>Better solutions descending in C
>Better solutions ascending in CL
Really gets the old noggin joggin'.
>>59482736
Not if you're using Javascript
Speaking of numbers, all numbers are 64-bit, except if you plan to do
any bitwise operation at all, in which case they're silently converted
to 32 bits, than back to 64 again:Math.pow(2,31) == 2147483648 // true, as expected
1 << 31 == -2147483648 // also true, because fuck you
>>59484960
>>59484983
Only if it's a literal or constant.
>>59490356
What makes you think they don't?
I'd assume it would be a reasonable optimization to expect.