• a (unregistered)

    frost

  • Vietcongster (unregistered)

    And now we know that Chernobyl was actually caused by a rounding error in the value of pi when it tried to render a circle.

  • Steve_The_Cynic (nodebb) in reply to Vietcongster

    Algorithms to draw circles without using or even knowing pi have existed for a very long time. (Ultimately, they are all derived from the "circle equation", xx+yy = r*r, in which pi does not appear.)

  • Vietcongster (unregistered) in reply to Steve_The_Cynic

    You never know if the rendering code was made by an intern/HPC/CEO's cousin who should have known better...

    But thanks for clarifying, since I'm not a true programmer, more like a programming enthusiast who comes here for the lolz and try to avoid those disasters when whipping an Excel macro out (though certainly many of them are worthy of front page here).

  • Nuclear Engineer (unregistered)

    I'll somewhat call BS on this. Any Nuclear power plant needing changes like that wouldn't assign it to an unsupervised intern fresh out of college. This would have a Responsible Engineer (RE) that would approve and test changes. Additionally, any change made to those systems are required to have a rollback plan in case the update fails or fails to produce correct output. AND... those systems do not control reactivity such that a plant could enter Fuel Damage conditions (i.e. the Media's "Melt Down"). The Reactor Protection Systems are (across the entire industry world wide) largely Analog with only a few plants having done Digital upgrades in the last 15 years (well after Y2K).

  • temp (unregistered) in reply to Steve_The_Cynic

    I recall a site about graphing a circle with a loop containing the two lines x -= y, y += x based off the properties of the circle, and how this behaves for certain values of constants multiplying to it but I cannot for the life of me seem to find it online anymore.

  • Matt Westwood (unregistered) in reply to Vietcongster

    Does anyone know of any algorithms to draw circles for which one has to know the value of pi? Or is this just one of those bletheringly stupid statements made by mathematical ignoramuses pretending to have a brain?

  • dkf (nodebb) in reply to Nuclear Engineer

    Any Nuclear power plant needing changes like that wouldn't assign it to an unsupervised intern fresh out of college.

    Well, this does seem to be a story that is not based in the US. It could also be a different industrial control system; the nuclear regulator has very little to say about the running of a large bakery or oil refinery.

  • PWolff (nodebb) in reply to dkf

    A bakery control system is significantly cheaper than that of a nuclear power plant, so a cheap PHB might have chosen that instead of one deisgned for systems that can fail really, really bad.

    Or it was a bakery to start with, and some narrator replaced it with a nuclear power plant just to enhance the drama somewhat.

  • Steve_The_Cynic (nodebb) in reply to temp

    It's a close relative of Bresenham's Algorithm for drawing lines in pixel space without using multiplication and division. For circles, the operation you seek to avoid is square-subtract-squareroot, especially the square root part.

  • Steve_The_Cynic (nodebb) in reply to Matt Westwood

    Re knowing pi for algorithms: you could do some sort of stupidity involving enumerating angles and doing sin and cos to calculate (x,y) offsets from the centre. You need to know pi somewhere in that, either to calculate the endpoints of the loop in radians or to convert degrees to radians.

    But it is beyond stupid.

  • Vietcongster (unregistered) in reply to Matt Westwood

    Just one of those bletheringly stupid statements made by mathematical ignoramuses pretending to have a brain, thank you. I already admitted I was wrong in trying to make a (also admittedly lame) joke here.

    However, with that kind of attitude, I imagine how hard would it be for a non-technical person to work with you, even if he/she has the best of intentions and actually willing to learn.

  • code.goddess (unregistered) in reply to Steve_The_Cynic

    Strangely enough, that's exactly how to draw circles on a Commodore 64, according to a programming book whose title escapes me.

  • Tsaukpaetra (nodebb)

    I'm a little freaked out that I remember this article originally.

  • Matt Westwood (unregistered) in reply to Vietcongster

    I'd rather eat sick.

  • TenshiNo (unregistered) in reply to Matt Westwood

    var prec = 360; for(int i = 0; i < prec; i++) { var t = Math.Pi * i / (prec / 2); var x = xCetner + xRadius * Math.Sin(t); var y = yCenter + yRadius * Math.Cos(t); }

    I still remember that little piece of code from some manual or other, back when I was first learning to code in the early 90's.

  • Benito van der Zander (google) in reply to Steve_The_Cynic

    especially the square root part.

    I think I had to do that as exercise in university.

    And I failed it, because I eliminated the square root part, but you were supposed to eliminate the square root part AND the multiplication part

    Addendum 2016-07-07 19:49: I hate university exercises

  • Norman Diamond (unregistered)

    If I understand correctly, the mainframe that crashed was only doing monitoring not control, and the older monitoring systems were still functioning. So this "convenience" monitoring system could well be assigned to an intern -- and it might even have been reviewed by experts, since who could guess that drawing circles would crash the mainframe?

    Meanwhile a comment on the original posting asked: "I'd understand if the display failed, but drawing circles crashed the mainframe? I mean, did the software cause the equivalent of BSoD? The whole OS went down."

    I was blamed for the equivalent of a BSOD on a mainframe. Someone ran my program with a CPU time limit of 2 seconds. My program tried to interpret their erroneous script and it crashed (which IBM called an ABEND). While IBM's OS/360 was in the middle of printing a dump, the dump printing routine went over 2 seconds of CPU time, so it ABENDed again. OS/360 got confused by the recursive ABEND and tried to charge the job step for using 2,540 minutes of CPU time. Some kernel programmer (then called system programmer) knew that a job step could never be charged for more than 1,440 minutes of CPU time, and coded a decimal divide instruction to do some accounting that ABENDed a third time when the number of minutes was greater than 1,440. The whole OS went down. Yes it was the equivalent of a BSOD. I got blamed. I diagnosed the bugs. I still got blamed.

  • Olad (unregistered)
    Comment held for moderation.
  • Matt Westwood (unregistered) in reply to Olad

    Bossy little fascist, aren't you? It's people like you that make me proud we voted out of your filthy European Union. Nukes are too good for you.

  • Steve_The_Cynic (nodebb) in reply to Matt Westwood

    Fortunately, the process of actually leaving, now that the xenophobic morons have voted to make my life difficult, will take long enough for me to finish getting French citizenship before the UK is officially out of the EU, although not by much.

  • Take a Pill (unregistered)

    Geez guys...we're all supposed to be having fun here. Keep calm and enjoy life™.

  • Medinoc (nodebb) in reply to Nuclear Engineer

    I second Nuclear Engineer in calling BS on the whole "10 days without rollback" thing.

    On the "draw circle by trigonometry" stuff, that's also how it was taught in the Amstrad CPC user's manual. Except you didn't have to directly use the value of PI, because you could simply use a global setting that made all the trig functions accept degrees directly.

    These days, I'd try the "calculate Pythagorean theorem and compare values" instead, with mirroring over all four symmetry axes.

    Addendum 2016-07-08 07:52: Wow, someday I should study how NodeBB's markup works, because I didn't want to hugeify that first sentence, I was trying to insert a separating line...

  • Planar (nodebb) in reply to temp
    two lines x -= y, y += x

    It's not that hard, it's based on the differential equations that link sine and cosine. Consider a point at angle a on the circle. Its coordinates are:

    x = cos a y = sin a

    When a changes, your point moves in the direction of the derivatives: dx/da = sin a = y dy/da = -cos a = -x

    So you can approximate your circle by repeatedly moving by a small angle t with: x += t * y y -= t * x

    Addendum 2016-07-08 10:05: Stupid forum with no preview :-(

    Cut the formula lines like this:

    x = cos a

    y = sin a

    dx/da = sin a = y

    dy/da = -cos a = -x

    x += t * y

    y -= t * x

  • jkshapiro (nodebb) in reply to Planar

    But can this be used as an actual construction technique? Doesn't the radius increase with each iteration, by a factor of (1+t*t)? My simulations always seem to end up with a nice logarithmic spiral.

  • tharpa (nodebb) in reply to Matt Westwood

    Your response doesn't seem to fit what he said at all. Did you even read what he said?

  • MrGimp (unregistered) in reply to Matt Westwood

    Feck off mate

  • Patrick (unregistered)
    Comment held for moderation.
  • GorGutz 'Ead 'Unta (unregistered) in reply to Matt Westwood

    You didn't vote out of anything. You voted on an "advisory referendum". Basically it was a vote to ask parliament to do something about this. Parliament could refuse to do anything because they aren't required to do anything but consider the idea. You would know that if you how a parliamentary system worked.

  • Modern Programming Expert (unregistered)

    Buy guys, why didn't they just use node.js?

  • earl colby pottinger (unregistered)
    Comment held for moderation.
  • Ron Fox (google)

    Was actualy toaster control/monitoring system as Miklos originally thought ;-)

  • Dave (unregistered)

    Re Matt Westwood: he's a Nazi troll who normally haunts NotAlwaysWorking.com and its sister sites. Sadly he now seems to be defacing these pages too. Just ignore him and he'll first get louder and louder, but then eventually get bored and toddle off to do something else antisocial.

  • urkerab (nodebb)

    If you really want a terrible way to draw a circle using π, look no further than the ZX Spectrum. It's circle algorithm? Draw a small chord, and then draw it again in the other direction, but as a ~350 degree arc. Suffice to say, its circles were only approximately circular.

  • dave (unregistered)

    Lazy accent stereotyping? Really?

  • Anonymous (unregistered) in reply to jkshapiro
    Comment held for moderation.

Leave a comment on “Classic WTF: The Circle of Fail”

Log In or post as a guest

Replying to comment #:

« Return to Article