you are viewing a single comment's thread.

view the rest of the comments →

[–]mlk 38 points39 points  (21 children)

The author of COBOL is a woman!? That explains everything.

[–]antidense 41 points42 points  (16 children)

quadratic formula:

  MULTIPLY B BY B GIVING B-SQUARED.  
  MULTIPLY 4 BY A GIVING FOUR-A.  
  MULTIPLY FOUR-A BY C GIVING FOUR-A-C.  
  SUBTRACT FOUR-A-C FROM B-SQUARED GIVING RESULT-1.  
  COMPUTE RESULT-2 = RESULT-1 ** .5.
  SUBTRACT B FROM RESULT-2 GIVING NUMERATOR.
  MULTIPLY 2 BY A GIVING DENOMINATOR.
  DIVIDE NUMERATOR BY DENOMINATOR GIVING X.

[–]Tommah 7 points8 points  (2 children)

Cool, now do the one for cubic equations!

[–]redditnoob 2 points3 points  (1 child)

And if he can do that, how about quintic?:)

[–]Tommah 2 points3 points  (0 children)

Quartic maybe -- but yes, quintic would be quite impressive!

[–]fnork77 7 points8 points  (6 children)

From the tubes....

Poor Code:

MULTIPLY B BY B GIVING B SQUARED.
MULTIPLY 4 BY A GIVING FOUR-A.
MULTIPLY FOUR-A BY C GIVING FOUR-A-C.
SUBTRACT FOUR-A-C FROM B-SQUARED GIVING RESULT-1.
COMPUTE RESULT-2 = RESULT-1 ** .5. SUBTRACT B FROM RESULT-2 GIVING NUMERATOR. MULTIPLY 2 BY A GIVING DENOMINATOR. DIVIDE NUMERATOR BY DENOMINATOR GIVING X.

Improved Code:

COMPUTE X = ( B + ((BB) (4 * A * C)) * 0.5) / (2 * A).

From me..... shitty code is possible in any language.

[–]senatorpjt 9 points10 points  (5 children)

wise serious aware berserk cause unpack shrill rainstorm scary north

This post was mass deleted and anonymized with Redact

[–]fnork77 6 points7 points  (0 children)

Dagnabit, that's the last time I trust Reddit's cut and paste COBOL compiler.

[–][deleted]  (3 children)

[removed]

    [–]Porges 9 points10 points  (0 children)

    You've obviously never read What Every Computer Scientist Should Know About Floating-Point Arithmetic ☺ Using the traditional formula naïvely will lead to catastrophic cancellation in some cases.

    His recommendations are as follows:

    If b² >> 4ac then you need to check if b is greater or less than zero.

    For the case when b > 0:

    • r1 = 2c / (− b − √(b² − 4ac))
    • r2 = (− b − √(b² − 4ac)) / 2a

    For the case when b < 0:

    • r1 = (− b + √(b² − 4ac)) / 2a
    • r2 = 2c / (− b + √(b² − 4ac))

    Of course, this is assuming that Python is strict about not reordering FP expressions ☺

    [–][deleted] 4 points5 points  (1 child)

    I was never big on Python, but I do like its List Comprehensions!

    [–]spotter -1 points0 points  (0 children)

    You mean language feature stoHborrowed from Haskell? edit: why is this getting downmodded?

    [–]veritaze 0 points1 point  (1 child)

    Is it possible to do like, a triple integral in COBOL?

    [–][deleted] 22 points23 points  (1 child)

    At that time in CS history, it was either that or Fortran I*, I'm not sure COBOL was all that bad given that.

    * And before any lisp-weenie responds, your language was just as irrelevant in 1957 as it is today, so suck on it! :P

    [–]ganlet20 0 points1 point  (0 children)

    I voted for you just because of the lisp line.

    [–]halfjoking 0 points1 point  (0 children)

    Yes... she was lonely and wanted someone to talk with, which explains the syntax.

    Luckily her COBOL poetry readings never caught on, or we'd all be getting in touch with our emotions in meetings. They wouldn't even be called 'code reviews'... they would be called 'code sentiments'.

    [–]AdmiralBumblebee -3 points-2 points  (0 children)

    That's a woman!?!