helene_t Posted January 10, 2008 Report Share Posted January 10, 2008 So now I just spent three days looking for an apparent bug in a statistical procedure, and it turned out to be the wellknown..... Lesson 1 (scientific computing for beginners): Pascal modules store matrices in major row order, while FORTRAN modules store them in major column order. Whenever you build an application of a mixture of Pascal and FORTRAN modules, make sure the matrices are transposed whenever appropriate (and not otherwise!) Why are the most trivial bugs the most difficult to find? Or is it just that it feels so? Quote Link to comment Share on other sites More sharing options...
akhare Posted January 10, 2008 Report Share Posted January 10, 2008 Interesting -- basically, the poor blokes who can't remember that all languages worth writing about start indexing their matrixes with 0 must have had similar experiences :) (pun fully intended; implied language bigotry for humour only). Quote Link to comment Share on other sites More sharing options...
matmat Posted January 10, 2008 Report Share Posted January 10, 2008 funny; i think the same difference exists between C and fortran... or at least i hope it does. that's the bug I 'found' in some design software when i was working on a not-to-be-named large physics project as an undergrad. Quote Link to comment Share on other sites More sharing options...
kfay Posted January 10, 2008 Report Share Posted January 10, 2008 Learning one computer language was hard enough for me. This story reaffirms my decision to avoid that sort of thing. That being said maybe for you finding such a bug is a 'God I'm glad that's over... I'm so dumb' moment but I think it's pretty impressive since such a subtle difference I can only imagine is exceedingly difficult to find. Quote Link to comment Share on other sites More sharing options...
keylime Posted January 11, 2008 Report Share Posted January 11, 2008 Helene, It's quite analogous to us hardware techs, troubleshooting and working for an hour, only to realize that a cable wasn't snuggly into its port thus causing the issue in the first place. Quote Link to comment Share on other sites More sharing options...
Al_U_Card Posted January 11, 2008 Report Share Posted January 11, 2008 Not nearly as embarassing as not knowing that the web-cam is on...... :) Quote Link to comment Share on other sites More sharing options...
P_Marlowe Posted January 14, 2008 Report Share Posted January 14, 2008 <snip>Why are the most trivial bugs the most difficult to find? Or is it just that it feels so? Because if they happen, you are usually tired.If I encounter such an error, I know, I am 3 hoursoverdue. With kind regardsMarlowe Quote Link to comment Share on other sites More sharing options...
mycroft Posted January 14, 2008 Report Share Posted January 14, 2008 my favourite was trying to figure out what was going on in an if check that I had written. I checked and doublechecked the logic, no dice. I even went to the trouble of deleting and rewriting the if statement, again, nothing. I wrote it out on a piece of paper, and took it upstairs to another developer. I put it down in front of him and started explaining what I was doing when I realized that: if (variableA = variableB) {...} is not the same, and doesn't work the same, as:if (variableA == variableB) {...} Now, I'd only been coding in C for 3 years at this point...Apologized to my colleague for wasting his time (to which he said something I've learned to be true a number of times since: "some errors are only clear when you start explaining it to someone else, don't worry about it"), and went back to my desk. Quote Link to comment Share on other sites More sharing options...
goobers Posted January 14, 2008 Report Share Posted January 14, 2008 I once spent 3 hours trying to fix an error before I realized that arrays are zero indexed. I felt like I had failed 4 years of college at that point. Quote Link to comment Share on other sites More sharing options...
P_Marlowe Posted January 14, 2008 Report Share Posted January 14, 2008 my favourite was trying to figure out what was going on in an if check that I had written. I checked and doublechecked the logic, no dice. I even went to the trouble of deleting and rewriting the if statement, again, nothing. I wrote it out on a piece of paper, and took it upstairs to another developer. I put it down in front of him and started explaining what I was doing when I realized that: if (variableA = variableB) {...} is not the same, and doesn't work the same, as:if (variableA == variableB) {...} Now, I'd only been coding in C for 3 years at this point...Apologized to my colleague for wasting his time (to which he said something I've learned to be true a number of times since: "some errors are only clear when you start explaining it to someone else, don't worry about it"), and went back to my desk. It nearly matches my altime favourite: while(variableA == variableB); {...} I was wondering, why the compiler didexecute the body only once, although itwas clear, that the statement still did hold.And I was debbugging the stupid codingseveral hours. With kind regardsMarlowe PS: Wonderfull language, I miss it a bit, ... Quote Link to comment Share on other sites More sharing options...
paulg Posted January 15, 2008 Report Share Posted January 15, 2008 Of course it's software engineers who call support to have their faulty monitor replaced ... only to have the repair man turn up the brightness for them. To my credit I only did this once. p Quote Link to comment Share on other sites More sharing options...
Apollo81 Posted January 15, 2008 Report Share Posted January 15, 2008 my favourite was trying to figure out what was going on in an if check that I had written. I checked and doublechecked the logic, no dice. I even went to the trouble of deleting and rewriting the if statement, again, nothing. I wrote it out on a piece of paper, and took it upstairs to another developer. I put it down in front of him and started explaining what I was doing when I realized that: if (variableA = variableB) {...} is not the same, and doesn't work the same, as:if (variableA == variableB) {...} Now, I'd only been coding in C for 3 years at this point...Apologized to my colleague for wasting his time (to which he said something I've learned to be true a number of times since: "some errors are only clear when you start explaining it to someone else, don't worry about it"), and went back to my desk. One place I used to work had a policy that when writing comparison statements involving a variable and a constant, the constant had to go on the left. Quote Link to comment Share on other sites More sharing options...
mycroft Posted January 15, 2008 Report Share Posted January 15, 2008 One place I used to work had a policy that when writing comparison statements involving a variable and a constant, the constant had to go on the left. We didn't have that policy, but as soon as I saw the rationale somewhere, I started doing that. Wouldn't have helped me that time though. Michael. Quote Link to comment Share on other sites More sharing options...
jtfanclub Posted January 15, 2008 Report Share Posted January 15, 2008 I once spent 3 hours trying to fix an error before I realized that arrays are zero indexed. I felt like I had failed 4 years of college at that point. Except when they aren't, of course.... Was it PASCAL that used to be the exception there? Or GWBASIC? One of them got me on that. Quote Link to comment Share on other sites More sharing options...
helene_t Posted January 15, 2008 Author Report Share Posted January 15, 2008 I once spent 3 hours trying to fix an error before I realized that arrays are zero indexed. I felt like I had failed 4 years of college at that point. Except when they aren't, of course.... Was it PASCAL that used to be the exception there? Or GWBASIC? One of them got me on that. GWBASIC. In Pascal, index origin must be specified explicitly per array. In Basic, default is 1 but you can overwrite it globaly. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.