- Feature Articles
- CodeSOD
-
Error'd
- Most Recent Articles
- Secret Horror
- Not Impossible
- Monkeys
- Killing Time
- Hypersensitive
- Infallabella
- Doubled Daniel
- It Figures
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
-Frist
Edit Admin
I'm glad that when I work with hardware like that, I can use Python and libraries that handle this stuff for me.
Edit Admin
And of course UInt16, no matter how you capitalise it, is the wrong internal data type for five-digit numbers anyway.
Admin
W.r.t. rounding errors, they would probably have been better off inserting a decimal point/adding trailing zeroes in the value string before parsing as a double.
Edit Admin
I also like the function name vs signature:
public double ConvertIntToDecimal(...
Given that the language has numeric types called both
double
anddecimal
how about the name itpublic double ConvertIntToDouble(...
Or better yetpublic double ConvertIntWithFractionToDouble(...
Or even better, create an object /struct that captures the two string values and exposes the value as a double (and/or a true decimal)
Edit Admin
" they're mistake is an easy mistake to make " I was so sure this was a clue.
Edit Admin
Isn't a big chunk of the WTF here is on Janet's company? How did they pay the contractors and release them from the contract before actually checking if what they wrote worked at all? I admit I haven't worked myself with the kind of HPCs that do one project and skitter off, but that seems really financially irresponsible.
Edit Admin
Fixed point arithmetics, pretty common in the embedded world.
Admin
Poor management lets a lot of consultants off the hook. I've been at companies that used to just throw work over the wall at them and take back whatever they produced with no review and no testing, mostly because the work was handled by non-technical managers who didn't understand and didn't care.
Admin
Nothing sets my teeth chattering quicker than inconsistent casing. Especially in C# where the casing conventions are relatively simple, if you can't handle or can't be bother to follow those few rules, then there's no reason to think the rest of your code is written with any more care.
Admin
They're mistake? Seriously?
Admin
Ask programmers to test? scoff
Seriously, testing isn't a lost art. Sometimes it's not even a found one. In a number of my classes (usually about 2/3 professional programmers) I describe a hypothetical program that reads in a line of user input with 3 comma separated lengths of a triangle's sides. The program determines if it's a valid equilateral, isoscoles, or scalene triangle. I ask them to come up with as many ways to test this as possible. After getting no more than 5 or 6 lines of test cases from any of them, I proceed to floor them with (and this is just partial and only the first 3 should succeed):
1,1,1 1,2,2 1,2,3 -1,-1,-1 l,1,1 1,1 1 2,2,80 one, two,three 4,4,4,4 equilateral ,, , ,,, Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean mauris ipsum, lacinia sit amet augue vitae, porta accumsan mi. Sed ante urna, tristique vel pulvinar tincidunt, lacinia ut turpis. Suspendisse ante risus, venenatis sed ullamcorper vehicula, tempus ac justo. Nulla id vulputate ligula. Vivamus tincidunt libero lorem, eu tristique ante volutpat id. Cras id erat luctus, pharetra lectus sed, aliquam lacus. Sed at ultrices odio, sed posuere justo. Nunc fringilla tellus vitae libero rhoncus facilisis. Nulla placerat egestas varius.
Admin
Why not convert to double before doing the division and skip the integers alltogether.
Admin
Not only does the method name mislead about the method's purpose, the comment header isn't helpful either. Maybe there is a policy to blindly follow: "Always use the Java automatic documentation features, so the documentation will write itself!" This has been done, obviously without using any brains, even though the summary is wrong, as it doesn't set the "single parameter" value, nor does it set the single parameter called "value", also the parameter "Value" does not contain the name of the parameter as suggested, and "decimals" is completely ignored. Finally, nothing is said about what the method returns. Is stuff like this one of the very typical things you are supposed to find in HPC "work" results? And people PAY for that?! Strange world...