wuthering thoughts
Another pleonastic blog. Diary of an insomniac. And I always lose my words beyond the second sentence.
Showing posts with label WTF. Show all posts
Showing posts with label WTF. Show all posts

Super Laptop Battery

Category: , By Suman Kar

And you thought Lenovo's batteries were bad ...
 

Google Calculator: Math Fail

Category: , , , , By Suman Kar
Did you know that you can enter cos (pi/2) and get back a nice 0? The parentheses thingy is a matter you'd like to be careful with though. Because cos pi/2 is treated as (cos (pi))/2. For that matter, log, ln, e are all keywords (just like your pi) with proper arguments. What is surprising, unfortunately, is that there are no hyperbolic functions. Try with arccos, acos -- they don't work. One more of Google's strange omissions. Oddly enough, (9^9)^9 works and so does e^e^e whereas 9^9^9 doesn't! 5/5 returns 1, 1/0 doesn't work. Next, try out tan (pi/2) on your desktop calculator (if you don't know what it is). Mine says 'invalid input for function'. Google is smart, real smart. Check for yourself! Check out more Google oddities on reddit -- here.




Got more of Google bloopers? Post 'em here!

 

WTF #2: PDF.COM

Category: , , By Suman Kar
PDF is an open standard (ISO 32000-1:2008) file format for document exchange created originally by Adobe Systems. I decided to check-out more on PDF and started off by keying in www.pdf.com in my browser's address bar. Lo' and behold! Turns out the domain belongs to a certain EDA company - PDF Solutions, Inc. Call it identity crisis or lack of foresight, but sure goes down as a classic WTF.
 

WTF #1: Microsoft's ternary boolean

Category: , , , , , By Suman Kar
This one goes into my little red-book of WTFs in all-caps. Epic fail from the behemoth. Look up the MSDN documentation of Win32 GetMessage() function. The section on 'Return Value', you ask? Yeah, right,the warning box. I'll quote them:

'Because the return value can be nonzero, zero, or -1,[...]'


In case you are not too familiar with Win32, I'll post the signature as well.
BOOL GetMessage( 
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax
);
PS: Just so the joke is not lost to the multitude of non-programmers (or even our lucky non-Win32 programmer comrades) I'll try to explain. The 'BOOL' on the left of GetMessage() says that the function (GetMessage) has a boolean return type. Which, for what it is worth, means that the function can either return the value 'true' or the value 'false' after executing. The boolean data-type was never a part of good-ol' C, neither C++ and hence all sorts of folks have had their own interpretation of how these two values ought to be represented. Historically, people have used integers to pose as booleans and treated the value '0' as 'false' and all others (positive or negative) as 'true'. A sin we mortal programmers are committed to, when using a boolean that really are integers under the hood, is to check if the value is '0' or not. And we just ignore the others -- we know they are true. Unfortunately, Microsoft, in this case, couldn't help but further the cause of the already abused boolean to the next step. It suggested that, we'll give you true and false all right, but you know, you'd be better keeping an eye out if you're getting a '-1' as your function's return value. Now that's a royal screw-up. Booleans are booleans. There ain't no way no self-respecting programmer will check for a petty '-1'! Never.

Dear MS, change the type while you still can and save us the ignominy.

PPS: For the historically inclined check out George Boole after whom the type is named.