- Feature Articles
- CodeSOD
- Error'd
- 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
System.out.println("Frist resul is a comment");
They neglected to print the passed value 'value_To_Round' . How did they ever debug it?
Admin
Wrong, wrong, wrong! The class and method aren't even pretending to be enterprisey. What second-rate school did these idiots attend?
Admin
"It totally is"
Admin
Someone should reimplement integer addition.
Admin
One of my professors told a story about programming the CDC 1604. It was designed by Seymour Cray. He designed it to work even with floor-sweeping transistors from Texas Instruments, which cost only $1 instead of the going rate of $8 each.
That made its computations a bit unreliable, so the prof says, it was wise to scatter your FORTRAN program with tautologies like IF( x/1000 + 1 ) * 1000 <> x + 1000) PRINT *, "CALL THE FIELD ENGINEERS."
Admin
That's terrible! Unless the machine did its arithmetic all in base 10 (OK, distinctly possible in machines of that era) that will print a message for nearly every input. Much better to flip the order of the operations.
Admin
oops, that was supposed to be always true, my goof.
Admin
I like how all the println's refer to the 'resul' even when the variable name is 'finalResult'. At first I thought it was a typo, but no, it's consistently wrong. Probably some ESL thing going on.
Admin
Also The Real WTF (TM) is that they have multiple 'round to x' and 'round to y' procedures when you just need one that takes the number to round and what you want to round it to ( result = RoundTo( 1234, 50 ); // result = 1250 ). It's just as easy to do it to an arbitrary value as a constant one - unless you're just out of school, I guess.
Admin
What I like the most is the comments in the source code that explain what these functurds are supposed to do. Because of course nobody will ever have to maintain these H1-BMs.
Admin
So you have all never heard of the fun that is bankers rounding????
Having said that it doesnt exactly excuse any of this mess
Admin
Of course it's not copy-pasted anywhere else. Rather, all the other versions are slightly to moderately different, because it was implemented from scratch each time it was needed.
Admin
Too late: https://ericlippert.com/2013/09/23/math-from-scratch-part-three/
Admin
It's not that bad. You're lucky they didn't drop to assembler for speed.