y = (x + 305) / 146097 * 400 + (x + 305) % 146097 / 36524 * 100 + (x + 305) % 146097 % 36524 / 1461 * 4 + (x + 305) % 146097 % 36524 % 1461 / 365;
From Barr Code
The code you see was actually found in a FDA approved medical product. I may not be a good coder or an honour student, but it pisses me off to see people to code like that. I love the usage of those parentheses, because the rest of the equation is easy to read right? I also wonder like Barr, does it even work?
Like I said to my team leader, I prefer to code simply because someone is going to read my code (or myself) and go WTF with certain portions. Often, its just me who goes back and asks what was I thinking with some of my code. Like a small bug in one of my graphing applications that wouldn't run in real time because of some wacky logic I had when I first wrote it. The sad part, when I re-used that code to be the basis of another graphing application... I deleted the error and implemented something better that works in real time.

0 comments:
Post a Comment