« first day (271 days earlier)      last day (4683 days later) » 

5:01 PM
Hmm, no.
Something's wrong.
 
But that's not O(1) :(
Wait, it is.
No, I don't know.
 
O(1) in what :)? Why not count the operations?
 
It has a cycle. With ifs. I'm tired.
This is what the code I pasted above should look like.
It's a very rough approximation. But very fast.
(Don't bash me on the union type pun trick - it's GCC)
 
I cannot wait for four more weeks to pass. I can quit this web page making, and get back to real coding.
 
5:07 PM
What's real coding?
 
Something with a programming language!
 
but dude the L in HTML is language man!
 
JavaScript is a programming language.
And, get this: HTML5+CSS3 is Turing-complete.
 
@MartinhoFernandes Can't hear you when I have my hands over my ears and I'm shouting LALALALALALA
 
Not using HTML5 though.
I just want to get back to not having to worry about whether or not what I make is IE compatible.
 
5:09 PM
@MartinhoFernandes Get this, Ook+C++ is turing complete!
 
Ook! is Turing-complete on its own.
 
is it really?
 
c++ templates are turing complete too
as are c++0x constexpr functions
 
@hexa Yes. It's just a renaming of BrainFuck's operators.
 
hey guys
-1
A: Function call with different datatypes

DeadMGYou declared a function as int but never returned anything, and didn't give main a return type either. I'd say any compiler would be well within it's rights to reject your code.

some fuck anonymously downvoted me
 
5:11 PM
lol, theese orang-utangs
 
And just to be clear HTML5+CSS3 don't need JavaScript for Turing-completeness.
I know it's crazy.
 
@MartinhoFernandes Why? The Turing tarpit is not exactly an exclusive club.
 
@LucDanton I bet it's just taking the first taylor term or something like that.
 
I found a browser tab opened in May.
 
.lol
 
5:14 PM
Was she hot?
 
@KerrekSB Nah it's Newton-Raphson; this particular mask fetches the exponent to divide by two. Or something like that.
 
what is best language to programme robots?
 
it's Newton-Raphson
 
C++ or java
 
whichever has a better SDK for it
 
5:15 PM
I don't think any of the two has any particularly relevant feature to distinguish them.
So what DeadMG said.
 
depends on what kind of robot I suspect
if you want to build a humanoid, I would say both are unusable
 
@JohannesSchaublitb why?
 
i hear it takes special languages
 
@LucDanton Is that operating on floats or ints?
 
I know in FIRST we programmed out robots in C, though we eventually had the option of Java, C++, and some weird IDE.
 
5:17 PM
@KerrekSB If I were to explain it to you I might as well be reading the article out loud, no offense intended :)
 
Humanoids must be programmed in Brainfuck.
 
I see -- I'm reading it now!
 
@KerrekSB floats. Most of it depends on the fact that a float is stored as a mantissa+exponent, so just dividing the exponent by 2 gives a first approximation at the square root.
With modern hardware, the fastest way to get a reasonably accurate square root of an int is to convert to floating point, take the square root, and convert back to int (seriously). Years ago, I wrote a fairly decent Newton-Raphson implementation, but I wouldn't use it in real code anymore.
 
@Jerry you mean when it is in floating point you would modify the exponent with type punning manually to calc the square root?
 
@JohannesSchaublitb Probably not -- on current hardware, FSQRT is pretty fast. The last time I checked, it was (at least usually) faster than the old Doom code, even if it doesn't have as cool of tricks.
 
Hmm. I'm still a bit puzzled by the shift of the bit pattern of the float.
OK, it'll half the exponent, that's good.
 
im unaware of all these ASM functions
 
It'll also do something weird to the mantissa. Are we using the silent 1?
We're turning 1.mmmmm into 1.Emmmmm, where E is the lowest bit of the erstwhile exponent
 
square of a float is shifting just the exponent I would think
 
You have to divide the exponent by 2 and take the square root of the mantissa
 
5:27 PM
@KerrekSB Keep in my mind that the function is computing 1/sqrt, not sqrt IIRC.
 
hm wait. it would not be that easy I think. the exponent is biased...
 
For the latter, consider the mantissa as 1 + x, x < 1. Then the square root is approximately 1 + x/2
 
@LucDanton Exactly.
 
@KerrekSB I would think one would just divide the exponent by 2?
 
Oh, yes, that too!
 
5:29 PM
@MartinhoFernandes Twisting the knife... so cruel!
 
maybe the choice of initial value precisely adds half the bias back
that stands to reason
 
ah I see now xD
 
You want (B+e)/2, but you have B + (e/2)
We should be able to verify at least the first 9 bits of the magical constant
 
@DeadMG I didn't downvote you but you should probably incorporate Jerry's comments.
 
5:34 PM
is converting to and from double not a costly operation?
 
It's not so much converting as manipulating the representation.
Same data, different view.
 
@JohannesSchaublitb On older hardware, yes. Not as much anymore though.
 
(ooh so many threads of discussion at the same time)
 
@LucDanton Doing that type of stuff in this room will give you at least 3 pages of explanations on how that is UB and it's bad and ugly and you should just... not do it.
 
5:40 PM
@0A0D ...and Johannes's -- he's quite right; this is one of those places that C and C++ differ (and despite the tag, what I said was really about C, not C++).
 
@JerryCoffin question is vague and probably tagged wrong anyways.. leads to mass confusion
 
i -1ed the question
 
@0A0D True -- I went partly from the tag, and partly from the use of printf, but probably should have more clearly pointed out which points applied to which language.
 
@JerryCoffin makes sense now about your comment now that you have explained it
 
@JohannesSchaublitb And fairly so, I'd say. He didn't ask it very well, IMO.
 
5:48 PM
what question?
 
Why do they have a term for the square root of -1, but not a special term for 1/0
 
3
A: Function call with different datatypes

DeadMGYou declared a function as int but never returned anything, and didn't give main a return type either. I'd say any compiler would be well within it's rights to reject your code.

 
-1
Q: Function call with different datatypes

wadafarfarIsn't line 7 of this program "pay = prt(pay);" supposed to throw a compile or run-time error because it is passing in an int to a param that requires a double? I compiled it fine with dev-c++ and ran the program with both lines of output. Please explain, thank you. #include <stdio.h> int p...

honestly, when I saw DeadMG at -1 and that question at 1, I thought I would like to reverse the picture.
 
The argument for the no term to describe 1/0 is that division is defined by multiplication, and nothing multiplied by 0 equals a number other than zero.... however, square root is defined by exponent, and nothing squared equals a negative number.
 
Wtf is main ()? Do compilers still allow implicit int?
 
5:50 PM
C compilers, yes
 
@JohannesSchaublitb i just noticed the OP asked about Java in a C question - God help us
 
@0A0D Isn't Java just like C minus pointers plus classes? ;-)
 
 
Apropos Java:
0
Q: null and the symmetry of equals

FredOverflowEquality is supposed to be symmetric, right? null.equals(someObject) => NullPointerException someObject.equals(null) => false What is the rational for not having the second form throw a NullPointerException?

 
maybe because the operator . tries to derreference null?
I know nothing of java tho, just guessing
 
5:58 PM
crazy. The visual studio team is taking feedback now?
 
@Xaade In real numbers, 1/0 gives infinity, but there is no square root of a negative number. In complex numbers 1/0 is still infinity, and the square root of -1 is i.
 
/me checks for flying pigs
not just taking feedback, but doing so using a service not developed by Microsoft
 
@JerryCoffin 1/0 can't be infinity because x*0 = 1 can't be solved.
 
@Xaade Sure it can be infinity. There's no requirement for a unique reversal.
 
Well, it can be solved, it's just that those who deem themselves worthy of describing math determined that 0 was an absolute nothingness, rather than the lack of anything.
x*0 = 1; x = 1/0
 
6:02 PM
@hexa, that's right
@xaade, actually x*0 must be = 0 because of the zero-product property
 
Which I think is a fallacy
The terms should follow the order of operations, not just deem one term to act differently for the sake of it.
what is x/y * y/x
 
1
 
x/y * y/x = 1, unless x or y is 0
 
it's UB if one of them is 0
 
If they had a unique term for 1/0, the exception wouldn't exist.
 
6:05 PM
in this room, it's always safe to bet on UB for any question
 
by the way
 
They have a unique term for (-1)^(.5)
 
I had a totally fucking awesome idea
 
Why can't 1/0 just be another imaginary number.
 
@jalf The real question is whether they'll actually fix anything based on the input.
 
6:06 PM
a program is a series of instructions to the compiler, right? so why not pre-compile the source code into a function that takes compiler data structures and loads the code?
 
because the zero-product property above is a theorem
 
@Xaade Infinity is an imaginary number, let me prove it to you: think of a big number, infinity is bigger than that.
 
And I think the logic is flawed @ignis
 
what do you mean?
 
zero should just come in and say, I'm outside the order of operations bitches.
That's simple laziness....
@hexa Especially since the universe is a soccer ball.
 
6:08 PM
0
A: null and the symmetry of equals

0A0DThe second example is not an example of symmetry because it violates one of the simple rules in regards to Object and the equals() method: For any non-null reference value x, x.equals(null) should return false.

 
btw @MartinhoFernandes, where you got that float sqrt hack from?
 
@FredOverflow hate to break it to you, but this is also a dupe of stackoverflow.com/questions/2887761/…
 
@0A0D feel free to vote to close as duplicate, then
 
@FredOverflow did, answers will be linked once closed I'm sure
 
6:26 PM
0
Q: Nested Comments in C/C++

PritpalThis is an interview question:- Write a C program which when compiled and run, prints out a message indicating whether the compiler that it is compiled with, allows /* */ comments to nest. The solution to this problem is given below :- Sol:- you can have an integer variable nest: ...

 
6:39 PM
@Xaade My teachers have always made the emphasis that i is not the square root of anything :)
 
I'm afraid there's also a bit of a rivalry between the Anglo-Saxons and the French in this case. Though I have to say that saying i is a square root is silly.
The French Wikipedia uses the same haughty tone as my teachers regarding the subject hah.
 
@LucDanton are you surprised? ;)
 
Quake3 is coded in plain C
 
@0A0D No, but only because I suspect this is an historical sore issue between mathematicians of either side of the channel.
The French apply the haughty Frenchman stereotype to Parisians but not themselves ;)
 
6:49 PM
@hexa It's all based on Wolfenstein
 
is it really?
 
@LucDanton Canadian French are quite nice
compared to their brethren :)
@hexa so I have heard...
 
@hexa: Yes, they're all upgrades of the Wolfenstein engine, I believe
 
@0A0D I like their television shows.
 
cool
 
6:51 PM
@hexa There's a .NET version of the Quake 3 engine too
 
I think I saw Q3 running natively on an android phone, don't quite remember if thats accurate
 
Greetings, humans
 
yes, it is accurate
I think
 
I see my conversational bot made it back to me.
 
@hexa kwaak is what it is called
 
6:53 PM
nice haha
I was a hardcore quake player back in 99, 00 and 01
not q3 tho, quakeworld
 
@hexa I never could afford the hardware back then :(
 
to play qw?
 
@Xaade That's mainly because it turns out the square root of -1 is a lot more useful than the reciprocal of zero.
 
@hexa I had a 300 Mhz PC from 2000 to 2004 in college. Never had a good enough graphics card. I did manage to play some counter strike though
 
wow, that sucks
I had a 2.4GHz PC in 2004
 
6:56 PM
quakeworld would run perfectly on a pentium 233 with a 2mb trident gfx card. (i think that was the spec of the gfx card)
 
although of course, soon after that the GHz wars were over
 
@DeadMG took forever to compile code on Visual Studio 6 back then.. I remember working on a huge senior project using PLY drawings with Qt and OpenGL. Took forever to compile and run
 
oh, I wasn't even a vaguely respectable coder until 2007
and even then, I was just hacking around with Lua
 
Are you a respectable coder now?
 
Als
Hello @Xaade
Hello folks
 

« first day (271 days earlier)      last day (4683 days later) »