• (cs) in reply to Global Warmer
    Global Warmer:
    Why don't you tell me what the square root of -25 is?
    That's what Google is for! [image] [edit: not that I don't know that with my eyes closed while sitting on a wooden table]

    Top Cod3r saying that people have learned from him is as funny as the rest of his posts :D

  • John Muller (unregistered)

    My quick estimate for a starting point for square roots is to take the first half, rounded up, of the whole number digits... in binary.

    so 1,000,000(decimal) is 11110100001001000000

    the half of the bits is 1111010000, which is 976(decimal)

    65,536 -> 10000000000000000 -> 100000000 -> 256

    65,535 -> 1111111111111111 -> 11111111 -> 255

    conceptually, it's just moving the 'decimal' point, unfortunetly, I havn't seen a calculator that handles non-base 10 non-integers. (that is, binary 10.01 = decimal 2.25) But then, I havn't been looking particularly hard.

    It also works in decimal, but you can end up much further off.

  • (cs)

    The user can just use the old GWBasic program to get a list of possible beams, then put the resulting beam from the basic program into the fancy new GUI program - it should pass, right? Just use it as a verification tool.

  • Peter (unregistered) in reply to Graham Stewart
    Graham Stewart:
    Hmm... the javascript root finder doesn't do so well with finding the root of negative numbers. :)
    What's even more of a WTF is that you can crash the entirety of Google Chrome by putting in "-10" and holding 'enter'. In less than half a second.
  • Maarten (unregistered) in reply to Marc B
    Marc B:
    Why didn't he just write a script wrapped around the vendor's program to iteratively feed in each beam size and have it print out the ones that passed the test?
    Because, he as an engineer, wasn't actually a star programmer. That's why they were still using a suite of hacked together BASIC-scripts.
  • SP (unregistered) in reply to Marc B

    Ding! Ding! Ding!... looks like we have a winner... that's what you get when you have programmers and user and nothing in between. Often times you really need an analyst in between.

    Its about solving the problem the user's way, programmers often solve the problem their way. An analyst would make sure the programmers also package up their solution so it looks like it solves the problem the user's way.

    Sometimes, when you're lucky, you can get a programmer that can wear the analyst hat as well.

  • foo (unregistered)

    "This approach is known as iterative approximation, and is not used all that often in software development."

    What the heck? Darn near every AI technique is some form of gradient descent, i.e. iterative approximation. The same is true for most of scientific computing and numerical analysis. Even binary search is a form of iterative refinement. Don't they teach mathematics in CS programs anymore?

  • Zap Brannigan (unregistered) in reply to SP
    SP:
    Ding! Ding! Ding!... looks like we have a winner... that's what you get when you have programmers and user and nothing in between. Often times you really need an analyst in between.

    Its about solving the problem the user's way, programmers often solve the problem their way. An analyst would make sure the programmers also package up their solution so it looks like it solves the problem the user's way.

    Sometimes, when you're lucky, you can get a programmer that can wear the analyst hat as well.

    Office Space Quote:

    Well-well look. I already told you: I deal with the gd dmn customers so the engineers don't have to. I have people skills; I am good at dealing with people. Can't you understand that? What the hell is wrong with you people?

  • (cs) in reply to Eternal Density
    Eternal Density:
    Top Cod3r saying that people have learned from him is as funny as the rest of his posts :D

    You can learn from Top Cod3r! Simply read his posts and you'll learn what not to do.

  • Anonymous (unregistered)

    Why is everyone forgetting that there are two roots? √(-25) = ±5i

  • Joe Z (unregistered) in reply to Leonardo

    Here in Texas it works similarly. I cannot legally use the word "engineer" in my job title or on my business card because I'm not an RPE (Registered Professional Engineer). To become one I'd need PE certification and I'd need to register with the state.

    Texas' law arose from a famous case where a school building exploded back in the 1930s due to an improperly designed boiler system put together by someone who was incompetent, but was using the title engineer.

    Now, my job is as an engineer. But, anything that needs signoffs and certs for safety, etc. need to go in front of RPEs for signoff, and that's a Good Thing.

  • Joe Z (unregistered) in reply to John Muller
    unfortunetly, I havn't seen a calculator that handles non-base 10 non-integers. (that is, binary 10.01 = decimal 2.25) But then, I havn't been looking particularly hard.

    If you use Linux, check out 'bc'.

    $ bc -l 
    bc 1.06.94
    Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
    This is free software with ABSOLUTELY NO WARRANTY.
    For details type `warranty'. 
    obase=2
    ibase=2
    sqrt(1111111111111111)
    11111111.11111111011111111111111111011111111111111110111111111111111\
    10101111
    

    I've actually had to code up a proper square root library function before.

    There's a lot of nifty tricks you can play based on the idea that (x + 1)^2 = x^2 + 2x + 1. So, if you're iteratively refining a square root, if you keep track of what 2x + 1 is, you can decide if setting a bit will put you over the target value or not. In the end I was surprised at how fast and small you could make it. It's actually faster than division on the machine I wrote it on.

  • Per (unregistered) in reply to Anonymous
    Anonymous:
    Why is everyone forgetting that there are two roots? √(-25) = ±5i

    The quadratic equation x²+25=0 has 2 roots. But the ordinary root function is undefined for negative values. This is because it would no longer be a single valued function, which is desirable.

  • Joe Z (unregistered) in reply to EJ_
    EJ_:
    Satanicpuppy:
    Heh. Root finding launched me to cult hero status in college, as I managed to be the first person to program my graphing calculator to calculate roots via Newton's Method while showing the work. Made a tedious test question the work of seconds.

    Sure it was cheating, but I was a CS major, and I felt it was "better" for my career to be able to hack together the code on my calculator than it was to actually be able to do the math.

    Haha, I loved doing this too. The teachers would proclaim "show your work!" so we wouldn't just let the calculators do it for us. I'd write a little application to show me what my work would have been had I done it out :) I never shared with anybody though... probably would have been a good way to make some friends looking back...

    In high school, I did this in a business math class to compute depreciation tables and compound interest problems. Those were tedious and very easy to get wrong, but the math was simple at its base. I did something similar in college for my Engineering Economics course. I didn't feel bad doing this, since other kids had calculators with this built in, and the teacher cared more that we used the write formula / depreciation schedule than that we actually computed the arithmetic correctly.

    In my DSP course, though, I wrote programs to plot response curves in response to various filter coefficient combinations. I went ahead and showed my program to the professor and told him I had written it and asked if I would need to bring a different calculator to my exams. His response was that if I was smart enough to write the program, then it's clear I understood the material and could use it. Just don't give it to anyone else. :-)

  • Joe Z (unregistered) in reply to Joe Z
    Joe Z:
    and the teacher cared more that we used the write formula / depreciation schedule than that we actually computed the arithmetic correctly.

    It'd help if I used the right homophone.

  • Vollhorst (unregistered)

    "The square root of 5 is something like Infinity"

    Ah, yes... at least it is close.

  • Bluprintz (unregistered) in reply to greyfade

    Quake III uses such an implementation,

    You can use such an iterative method for calculating inverse sqrt, but it turns out that 0x5f3759df is a 'near perfect' first guess.

    More info here: http://www.codemaestro.com/reviews/9

  • N Morrison (unregistered) in reply to Leonardo
    Leonardo:
    ... A former diector of the engineering school I graduated almost went to jail because he signed hydraulic project for a friend, but didn't re-calculate. Turns out that the thing exploded and killed a person. The "friend" lost his license and went to jail for a couple years. The director was reprimanded, suspended as PE for 6 months, paid his ass off in both criminal and civil suits and was sentenced 3 months in jail, commuted to community services for a year.
    Lest you think these discussions amusing, I refer you to http://en.wikipedia.org/wiki/Hyatt_Regency_walkway_collapse for more details on the Hyatt Regency walkway collapse. "... both walkways crashed one on top of the other and then into the lobby below, killing 114 people and injuring more than 200 others." Also "... convicted the engineers employed by Jack D. Gillum and Associates who had signed off on the final drawings of gross negligence, misconduct, and unprofessional conduct in the practice of engineering; they all lost their engineering licenses in the states of Missouri and Texas and their membership to ASCE. While Jack D. Gillum and Associates itself was cleared of criminal negligence, it was stripped of its license to be an engineering firm."
  • (cs) in reply to Per
    Per:
    The quadratic equation x²+25=0 has 2 roots. But the ordinary root function is undefined for negative values. This is because it would no longer be a single valued function, which is desirable.
    And that's not a problem for x²-25=0?
  • jimicus (unregistered) in reply to Marc B
    Why didn't he just write a script wrapped around the vendor's program to iteratively feed in each beam size and have it print out the ones that passed the test?

    Because engineers aren’t programmers, don’t want to be programmers, and don’t particularly like programming. When your competition uses software built by programmers and has their staff focus on engineering, they’ll leave you in the dust.

  • OutWithTheTroll (unregistered) in reply to Kermos
    Kermos:
    You can learn from Top Cod3r! Simply read his posts and you'll learn what *not* to do.

    True, but it's still trolling. I guess it was Alex's turn to take out the trash ^_^ Let's leave it out ;)

  • Riho (unregistered)

    And where leaves that the freedom of speach?

  • tragomaskhalos (unregistered) in reply to lindee
    lindee:
    lindee:
    the real wtf is that parseFloat returns a new number. your function should be called terribleBabylonianGuessPlusStringConcatenation

    babylonians couldn't parse floats... and neither can alex

    Meh, the Babylonians were more VBScript kind of guys ....

  • Endo808 (unregistered) in reply to Marc B

    Errrm isn't that the point of the article???

    Why force your engineers to write script wrappers for mis-sold 3rd party software just so you can make said software work exactly like the in house software you already have?

  • Graham Stewart (unregistered) in reply to Bellinghman
    Bellinghman:
    And that's not a problem for x²-25=0?

    x² - 25 = 0 x² = 25 x = 5

  • Inglorion (unregistered) in reply to Marc B

    I guess the fancy GUI application didn't lend itself to easy scripting. Like so many of them ...

  • calc.exe (unregistered) in reply to Graham Stewart
    Graham Stewart:
    Bellinghman:
    And that's not a problem for x²-25=0?

    x² - 25 = 0 x² = 25 x = 5

    Or x = -5, to be exact...

  • RiF (unregistered) in reply to calc.exe
    calc.exe:
    Graham Stewart:
    Bellinghman:
    And that's not a problem for x²-25=0?

    x² - 25 = 0 x² = 25 x = 5

    Or x = -5, to be exact...

    worst. troll. ever.

    /me slaps calc.exe around the head with a large trout

  • Tepsifüles (unregistered) in reply to calc.exe
    calc.exe:
    Graham Stewart:
    Bellinghman:
    And that's not a problem for x²-25=0?

    x² - 25 = 0 x² = 25 x = 5

    Or x = -5, to be exact...

    ... which is why we praise $deity for making the real numbers an ordered field (quite unlike the complex numbers, where 5i and -5i live, or the quaternions, where 5i, 5j, 4i-3j and their ilk live; those are an abomination) and strike the lower-ordered root from our calculations to make sqrt an actual function (albeit well-defined only on the positive reals, or on a complex plane slit along a ray) as well as introduce a bias for positivity in all things.

  • Ilya Ehrenburg (unregistered) in reply to Tepsifüles
    Tepsifüles:
    ... and strike the lower-ordered root from our calculations to make sqrt an actual function (albeit well-defined only on the positive reals, or on a complex plane slit along a ray)
    Or we could do the sensible thing and introduce Riemann Surfaces. No arbitrary choices or restrictions, a wonderful globally defined holomorphic function then.
  • Chris W (unregistered) in reply to Marc B

    Probably because the vendor missed one of the biggest requirements of the application and passed it off as unnecessary. The WTF made it obvious that the product had no value add.

    TRWTF is that you suggested to purchase a faulty product and add scripts to correct its shortcomings when it would be a lot easier (and less expensive) to use the tools you already had.

  • Chris W (unregistered) in reply to Marc B

    Sorry didn't quote the last thing properly,

    Marc B:
    Why didn't he just write a script wrapped around the vendor's program to iteratively feed in each beam size and have it print out the ones that passed the test?

    Probably because the vendor missed one of the biggest requirements of the application and passed it off as unnecessary. The WTF made it obvious that the product had no value add.

    TRWTF is that you suggested to purchase a faulty product and add scripts to correct its shortcomings when it would be a lot easier (and less expensive) to use the tools you already had.

  • Fifth Column (unregistered) in reply to Kermos
    Kermos:
    Column 1 = # of Stocks Column 2 = Price of Stocks Column 3 = Column 1 * Column 2

    Hint: It's called a spreadsheet application. You know, Excel for example?

    No way. Excel has way too many columns, while the user only needs three. All those extra columns are SOOOOO confusing...

  • Dirk Diggler (unregistered) in reply to Vollhorst
    Vollhorst:
    "The square root of 5 is something like Infinity"

    Ah, yes... at least it is close.

    (For sufficiently large values of 5 or small values of infinity)

  • Eric L (unregistered) in reply to Leonardo
    Leonardo:
    As a PE in Brazil, I can tell how it works here. In civil projects, you need the signature of TWO PEs on you project. The idea is that both would calculate all the elements separately and work out any mismatchs. They both share civil and criminal responsability if something goes wrong.

    Law doesn't care how you reached your results, if by divinations using tea leaves or by using a supercoputer. You signed it, it's your ass.

    A former diector of the engineering school I graduated almost went to jail because he signed hydraulic project for a friend, but didn't re-calculate. Turns out that the thing exploded and killed a person. The "friend" lost his license and went to jail for a couple years. The director was reprimanded, suspended as PE for 6 months, paid his ass off in both criminal and civil suits and was sentenced 3 months in jail, commuted to community services for a year.

    Thank god this doesn't happen to to software engineers :D

  • (cs) in reply to John Muller
    John Muller:
    My quick estimate for a starting point for square roots is to take the first half, rounded up, of the whole number digits... in binary.

    It's only the first half if you're big endian.

  • (cs) in reply to Eric L
    Eric L:
    Leonardo:
    As a PE in Brazil, I can tell how it works here. In civil projects, you need the signature of TWO PEs on you project. The idea is that both would calculate all the elements separately and work out any mismatchs. They both share civil and criminal responsability if something goes wrong.

    Law doesn't care how you reached your results, if by divinations using tea leaves or by using a supercoputer. You signed it, it's your ass.

    A former diector of the engineering school I graduated almost went to jail because he signed hydraulic project for a friend, but didn't re-calculate. Turns out that the thing exploded and killed a person. The "friend" lost his license and went to jail for a couple years. The director was reprimanded, suspended as PE for 6 months, paid his ass off in both criminal and civil suits and was sentenced 3 months in jail, commuted to community services for a year.

    Thank god this doesn't happen to to software engineers :D

    I'd be very careful with that statement. Look at the automotive industry. Every single year cars are becoming more and more computer and therefore software controlled.

    Even braking, steering and throttle are beginning to be computer controlled. Throttle by wire is already standard in quite a few cars, my Audi I had for a while had it. Brakes / Steering I know such technology already exists but I'm not sure if it's made it to any production vehicles yet.

    However, if you have ABS or traction control, even if your brakes are hydraulic, they are still influenced by a software at this point in time. The pressure that actually reaches the brakes is all software controlled.

    So there are already plenty of things that Software Engineers can be just as much held accountable for and it's increasing. Imagine a bug in an ABS system that under some weird obscure conditions causes all wheels to lock up while you're travelling down the highway at 70mph with a semi-truck right behind you.

    While there are some safeguards in these systems to prevent problems, such as requiring multiple CPUs from different manufacturers running in parallel, these only protect against defects in the CPUs themselves (if one CPU goes crazy due to some defect it won't match the output of the other CPU). They don't protect against an inherent flaw in the software design that both CPUs are happy to execute.

  • (cs) in reply to Kermos
    Kermos:
    Eric L:
    Leonardo:
    ... They both share civil and criminal responsability if something goes wrong.

    Law doesn't care how you reached your results, if by divinations using tea leaves or by using a supercoputer. You signed it, it's your ass.

    ...was sentenced 3 months in jail, commuted to community services for a year.

    Thank god this doesn't happen to to software engineers :D

    I'd be very careful with that statement....

    Yes indeed. If you are a contract programmer in the UK, you really really need indemnity insurance. It's a pain, and yet another overhead cost, but it covers you against almost anything, including negligence and drunkenness... Handy, that.
  • (cs)

    I remember doing this in school, and created a function called 'slut()' or 'square look-up table'. The teacher was not amused :)

  • (cs) in reply to Riho
    Riho:
    And where leaves that the freedom of speach?

    Same place as always.

    Freedom of speech doesn't mean you can say whatever you want anywhere you want. That's why you can be arrested for creating a panic by yelling "Fire!" in a crowded movie theater when there isn't one.

  • (cs) in reply to havokk
    havokk:
    ...rogorous disciplines of engineering...
    "rogorous" -- a combination of "rigorous" and "rogue"?
  • AverageJoe (unregistered)

    No, this comment isn't worth reading.

  • Mike (unregistered) in reply to Kermos
    Kermos:
    Eric L:
    Leonardo:
    As a PE in Brazil, I can tell how it works here. In civil projects, you need the signature of TWO PEs on you project. The idea is that both would calculate all the elements separately and work out any mismatchs. They both share civil and criminal responsability if something goes wrong.

    Law doesn't care how you reached your results, if by divinations using tea leaves or by using a supercoputer. You signed it, it's your ass.

    A former diector of the engineering school I graduated almost went to jail because he signed hydraulic project for a friend, but didn't re-calculate. Turns out that the thing exploded and killed a person. The "friend" lost his license and went to jail for a couple years. The director was reprimanded, suspended as PE for 6 months, paid his ass off in both criminal and civil suits and was sentenced 3 months in jail, commuted to community services for a year.

    Thank god this doesn't happen to to software engineers :D

    I'd be very careful with that statement. Look at the automotive industry. Every single year cars are becoming more and more computer and therefore software controlled.

    Even braking, steering and throttle are beginning to be computer controlled. Throttle by wire is already standard in quite a few cars, my Audi I had for a while had it. Brakes / Steering I know such technology already exists but I'm not sure if it's made it to any production vehicles yet.

    However, if you have ABS or traction control, even if your brakes are hydraulic, they are still influenced by a software at this point in time. The pressure that actually reaches the brakes is all software controlled.

    So there are already plenty of things that Software Engineers can be just as much held accountable for and it's increasing. Imagine a bug in an ABS system that under some weird obscure conditions causes all wheels to lock up while you're travelling down the highway at 70mph with a semi-truck right behind you.

    While there are some safeguards in these systems to prevent problems, such as requiring multiple CPUs from different manufacturers running in parallel, these only protect against defects in the CPUs themselves (if one CPU goes crazy due to some defect it won't match the output of the other CPU). They don't protect against an inherent flaw in the software design that both CPUs are happy to execute.

    Avionics software development requires an insane amount of documentation and V&V yet still doesn't make me feel safe to fly any more...

  • Gumby (unregistered)

    pseudocode for most applications:

      fb feedback = NULL;
      code released_version = NULL;
    label:
       deploy (released_version, guess_meaning(requirements_document, feedback));
       wait_for_bug_reports();
       feedback = get_bug_report;
     goto label;
    
  • Tom JP (unregistered) in reply to Bluprintz

    The near perfect first guess is 0x5f3759df - ( i >> 1 )

  • Duke of New York (unregistered) in reply to Global Warmer
    Global Warmer:
    Why don't you tell me what the square root of -25 is?
    FileNotFound
  • (cs) in reply to Satanicpuppy
    TopCod3r (Deleted as Troll):

    Ooh... looks like a mod thought that TopCod3r's anti-solutions went a bit too far, this time.

  • 5|i(3_x (unregistered) in reply to JD
    JD:
    Satanicpuppy:
    Heh. Root finding launched me to cult hero status in college, as I managed to be the first person to program my graphing calculator to calculate roots via Newton's Method while showing the work. Made a tedious test question the work of seconds.

    Sure it was cheating, but I was a CS major, and I felt it was "better" for my career to be able to hack together the code on my calculator than it was to actually be able to do the math.

    Finally, a voice of reason. I'm entirely with you my friend; as a CS student who hated maths I also found it a great deal more beneficial to program maths solutions on my graphical calculator than to figure them out by hand. This was many years ago now and since then, I've re-written (in production apps) plenty of the logic that I originally implemented on my calculator. In contrast, I've never had to work out any of those sums by hand at any time in my programming career. So with the power of hindsight I can say with absolute certainty that it was better from an educational standpoint to "cheat" with my calculator than to "do it properly". QED.

    Unfortunately, I don't really have anything relevant to note about today's post. So I'm just going to say thanks for the interactive Javascript root finder - that defnitely added a certain something to the tale for me.

    I used to program Physics equations into my graphing calculator back in High School. I could enter given values and receive answers for the variables. Someone told the teacher but he didn't care. He figured my ability to translate the equations into code was sufficient proof of my understanding--as long as I didn't share :) .

  • Omega Minus (unregistered) in reply to Leonardo
    Leonardo:
    As a PE in Brazil, I can tell how it works here. In civil projects, you need the signature of TWO PEs on you project. The idea is that both would calculate all the elements separately and work out any mismatchs. They both share civil and criminal responsability if something goes wrong.

    Law doesn't care how you reached your results, if by divinations using tea leaves or by using a supercoputer. You signed it, it's your ass.

    A former director of the engineering school I graduated almost went to jail because he signed off on a hydraulic project for a friend, but didn't re-calculate. Turns out that the thing exploded and killed a person. The "friend" lost his license and went to jail for a couple years. The director was reprimanded, suspended as PE for 6 months, paid his ass off in both criminal and civil suits and was sentenced to 3 months in jail, commuted to community services for a year.

    That's not funny. Unless the phrase "going to jail" has humorous connotations in Brazilian that it doesn't have in English. Anyone know?

  • Duke of New York (unregistered) in reply to Riho
    Riho:
    And where leaves that the freedom of speach?
    Hello there! I see that you're new to the internet, and the concept that forum operators can delete comments whenever they please.

    TopCod3r's should be deleted more often.

Leave a comment on “Sticking to the Method”

Log In or post as a guest

Replying to comment #:

« Return to Article