• LCrawford (unregistered)

    System.out.println("Frist resul is a comment");

    They neglected to print the passed value 'value_To_Round' . How did they ever debug it?

  • (nodebb)

    Wrong, wrong, wrong! The class and method aren't even pretending to be enterprisey. What second-rate school did these idiots attend?

  • Kleyguerth (github)

    "It totally is"

  • (nodebb)

    Someone should reimplement integer addition.

  • gumpy_gus (unregistered)

    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."

  • (nodebb) in reply to gumpy_gus

    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.

  • gumpy_gus (unregistered) in reply to dkf

    oops, that was supposed to be always true, my goof.

  • sizer99 (google)

    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.

  • sizer99 (google)

    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.

  • I dunno LOL ¯\(°_o)/¯ (unregistered)

    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.

  • Caught Out (unregistered)

    So you have all never heard of the fun that is bankers rounding????

    Having said that it doesnt exactly excuse any of this mess

  • (nodebb)

    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.

  • Richard (unregistered) in reply to tahir_ahmadov

    Too late: https://ericlippert.com/2013/09/23/math-from-scratch-part-three/

  • smf (unregistered)

    It's not that bad. You're lucky they didn't drop to assembler for speed.

Leave a comment on “To Round a Corner”

Log In or post as a guest

Replying to comment #:

« Return to Article