back to article Come mobile users, gather round and learn how to add up

Welcome Reg readers, to this week's Who, Me?, in which we gather round to share in another person's painful memories of technical cockups. This week, we meet "Fred", who wrote in to tell us about a time about 15 years ago where a rather basic test was seen a little more widely than planned. At the time, Fred was working for a …

  1. Andy Miller

    Freedom

    Freedom is the freedom to say 2+2=4. f that is granted, all else follows

  2. David Harper 1

    I hope the mobile network wasn't 3

    Advertising 2+2=4 on the 3 network's web site would be a bit awkward :-)

    1. Soruk

      Re: I hope the mobile network wasn't 3

      Don't think so - the article claims the company was bought out shortly afterwards. 3 was started by Hutchison Whampoa - and is still owned by them.

      So, basically Cellnet (Telefonica), Orange (Mannesmann / France Telecom) or one2one (Deutsche Telekom)...

      1. Anonymous Coward
        Anonymous Coward

        Re: I hope the mobile network wasn't 3

        No, it says the company Fred was working for got bought. Not the client phone company.

  3. JassMan Silver badge
    Trollface

    Half of them thought it was fake news.

    Nobody who listens to the likes of ReesMogg, Johnson, Gove, et al believes in experts any more. They just assumed this was a bit of pointless information pumped out by Brussels. Why else would the country be in the mess we are in now.

    1. disgustedoftunbridgewells Silver badge

      Re: Half of them thought it was fake news.

      Please, on behalf of every commentard, I beg of you, please, take your political nonsense and sod off to somewhere other than here.

  4. Anonymous Coward
    Anonymous Coward

    Patronised a customer?

    I might have used writing manual to send coded messages... 'send nudes' being the more childish amongst them....

    Anon because I'm supposed to be more grown up.

    1. Caver_Dave
      Joke

      Re: Patronised a customer?

      I once wrote an idiots guide for my then,

      Dunce level manager.

      It wasn't very subtle.

      On the occasion he did read it,

      The twit didn't notice the left hand column.

      1. Doctor Syntax Silver badge

        Re: Patronised a customer?

        Must stop myself spending the rest of the day tweaking this into a limerick.

        1. Doctor Syntax Silver badge

          Re: Patronised a customer?

          I wrote an idiots guide for my then

          Dunce level manager, Ken.

          It wasn't too subtle;

          Oh no, but I'll

          Take liberties whenever I can.

      2. Major N

        Re: Patronised a customer?

        I once wrote an idiots guide

        For my dunce level manager's eyes

        Though it lacked subtlety,

        When read he didn't see

        The column sat on it's left side

        1. Prst. V.Jeltz Silver badge
          Pint

          Re: Patronised a customer?

          Bravo sir!

          too early for a pint?

        2. DuchessofDukeStreet

          Re: Patronised a customer?

          The problem with that is that I don't think the left side column quite has the same effect now..

      3. Symon Silver badge
        Paris Hilton

        Re: Patronised a customer?

        Didn't Arnie do that once? Oh, yes...

        https://www.theregister.co.uk/2009/10/28/acrostic_arnie/

        1. Major N

          Re: Patronised a customer?

          Hmm, missed the acrostic.. make it half a pint ;)

          I once wrote an idiots guide

          Designed for my manager's eyes

          In subtlety lacking

          Occasionally stacking

          The column sat on it's left side

          1. Anonymous Coward
            Anonymous Coward

            Re: Patronised a customer?

            Oh, fer cryin' out loud! You should all just tell your bosses that Technology is Our Friend and be done with it...

            1. Anonymous Coward
              Anonymous Coward

              Re: Patronised a customer?

              Tell the PHB that technology is our friend? Christ no! I've been there with PHBs told just that, believing it to the hilt and decreeing that "we must be digitised" - without bothering to add that it should actually make sense, be well done and not crap.

              Almost everything turned out crap (but which you wouldn't believe from the self-congratulary emails and in-house Faecebook lookalike page announcements. Talk about the King's New Clothes)

          2. Doctor Syntax Silver badge

            Re: Patronised a customer?

            Nice one. I prefer it to mine.

  5. JulieM Silver badge

    Itchy Chin

    I have a very hard time believing that JavaScript evaluated 2+2 as 4, and not 22.

    JavaScript can subtract, multiply and divide, but the + operator performs string concatenation. If you want to add numbers, you have to negate and subtract instead.

    1. caffeine addict Silver badge

      Re: Itchy Chin

      No, it doesn't.

      console.log(2+2); // 4

      console.log(2+'2'); // 22;

      console.log('2'+2); // 22;

      console.log('2'+'2'); // 22;

      Javascript is dense at times, but it does know the difference between strings and integers.

      1. JulieM Silver badge

        Re: Itchy Chin

        Not as well as some languages, it doesn't:

        $ perl -e 'print 2 + 2;print "\n";' # prints 4

        $ php -r 'print 2 + 2;print "\n";' # prints 4

        $ perl -e 'print 2 + "2";print "\n";' # prints 4

        $ php -r 'print 2 + "2";print "\n";' # prints 4

        $ perl -e 'print "2" + 2;print "\n";' # prints 4

        $ php -r 'print "2" + 2;print "\n";' # prints 4

        $ perl -e 'print "2" + "2";print "\n";' # prints 4

        $ php -r 'print "2" + "2";print "\n";' # prints 4

        1. caffeine addict Silver badge

          Re: Itchy Chin

          PHP treats 0, '0', '0.1', '', false and null as false.

          PHP treats 1, 1, 0.1, 'true', true and 'false' as true.

          Using PHP as a yardstick of handling various types is a terrible idea.

          IMO, "2" + "2" should throw an error in any language and JS should have a more sensible string concatenation operator.

          We have intVal and parseInt for a reason.

          1. vtcodger Silver badge

            Re: Itchy Chin

            In Python 2+2 = 4, "2" + "2" = "22" and "2" + 2 generates an exception "TypeError: cannot concatenate 'str' and 'int' objects" Forgive me, but in what way is that not perfectly reasonable?

            1. caffeine addict Silver badge

              Re: Itchy Chin

              With that exception generation, that sounds pretty reasonable.

              It's "+" across type that make things messy. You could easy have the mess where one would get, or reasonably expect, "2"+2 = 4 and 2+"2"="22".

              1. Anonymous Coward
                Anonymous Coward

                Re: Itchy Chin

                " "2"+2 = 4 and 2+"2"="22". "

                Actually, if it didn't error out, I'd expect "2"+2="22" and 2+"2"=4, taking the type from the first item and processing according to that. But really, the only reasonable thing to do is throw an error - incompatible type, string and int.

                1. caffeine addict Silver badge

                  Re: Itchy Chin

                  I think you rather neatly proved my point...

                2. JulieM Silver badge

                  Re: Itchy Chin

                  But strings and numbers are not necessarily incompatible types. You can always convert a number to a string in order to concatenate it with another string, and you can sometimes convert a string to a number -- depending what characters it contains -- in order to add it to a number. There is no reason, besides mean-spiritedness on the part of the programming language designer, for any modern programming language not to do type conversion automatically if it would not cause an error.

                  The real problem is the misuse of a single operator to perform two distinct operations.

              2. Anonymous Coward Silver badge

                Re: Itchy Chin

                I would've expected a logical type-juggler to use the type of the first element as default, so "2"+2 = "22" and 2+"2"=4

                (Just to show that "reasonably expect" isn't the same between different people)

            2. JulieM Silver badge

              Re: Itchy Chin

              It's not perfectly reasonable because an interpreted language should be smart enough to be able to convert a string that looks sufficiently like a number to a number and then add it to a number; or convert a number to a string and then concatenate it with a string. Perl manages all this just fine (see examples above).

              1. caffeine addict Silver badge

                Re: Itchy Chin

                But what is a suitably obvious number when displayed as a string?

                999?

                01234 567890?

                x6?

                ff0000?

                face?

                0.23?

                1.234,56?

                1,234.56?

                They're all obviously numbers or text strings depending on context. Context which is beyond your programming language, other than if it's wrapped in quote marks or properly typed.

                1. JulieM Silver badge

                  Re: Itchy Chin

                  That still need not be a problem, though:

                  • If the programmer is asking the computer to add strings, then treat them like numbers (and either throw an error if they don't look sufficiently numeric, or evaluate as much as you can in a numeric context and silently ignore the rest) and add them.
                  • If the programmer is asking the computer to concatenate numbers, treat them like strings and concatenate them.

                  1. caffeine addict Silver badge

                    Re: Itchy Chin

                    You're missing the point.

                    In a loosely typed language (like JS, PHP, etc...) how does the computer know if the programmer wants to concatenate of sum two values? It's easy if they are both in quotes or both unquoted decimal strings. If they differ, the computer has absolutely no idea what the programmer intended so has to make a best guess.

                    Hence 2+2=4 and "2"+"2"="22" (including in your original incorrect comment) but varying results between languages for "2"+2 and 2+"2".

                    1. JulieM Silver badge
                      Holmes

                      Re: Itchy Chin

                      In a loosely typed language (like JS, PHP, etc...) how does the computer know if the programmer wants to concatenate of sum two values?
                      Easy ..... If you use an addition operator between the operands, it should try to add their numeric manifestations; but if you use a concatenation operator, it should try to concatenate their string manifestations.

            3. Baldrickk Silver badge

              Re: Itchy Chin

              f'2+2={2+2}'

              I love f-strings

              what about f'{"+".join(str(x) for x in ["2",2])}={sum(int(x) for x in [2, "2"])}' ?

              You know, just for fun.

      2. Prst. V.Jeltz Silver badge

        Re: Itchy Chin

        but it does know the difference between strings and integers.

        VBscript dosen't, I've had to multiply variables by 1 , or add 0 to them , in order to get them treated as integers!

        1. Pascal Monett Silver badge

          Did you use Option Declare ?

          I think not. Which means you were working with Variants - and that is the usual consequence.

      3. itzman

        Re: Itchy Chin

        Javascript is dense at times, but it does know the difference between strings and integers.

        Well no, it doesn't.

        Back in the days of XP I was trying to get some javascript working on firefox and IE.

        They behaved completely differently.

        In the end it turned out that if the numerical stuff was buried in a conditional firefox took it as a number but IE took it as a string.

        It took me hours to find a way to get IE to treat it as a number.

        I HATE weakly typed or non typed languages almost as much as I hate Pascal.

    2. Remy Redert

      Re: Itchy Chin

      It says the text in the banner was 2+2= and the script was used to calculate the answer. It doesn't tell us anything about how the script did this

      1. DJ Smiley

        Re: Itchy Chin

        Ah, they used Sony's magic number generator?

        'return 4'.

      2. 2+2=5 Silver badge
        Devil

        Re: Itchy Chin

        > It says the text in the banner was 2+2= and the script was used to calculate the answer. It doesn't tell us anything about how the script did this

        That's because I've erased that script from the entire Internet. Mwah hah ha.

    3. Robert Carnegie Silver badge

      Re: Itchy Chin

      Possibly most of the internet is now free of servers displaying today's date as January 14th, 19119. (It's a Millennium Bug thing. Ask your legacy team.)

      http://snapahead.freeservers.com/ reports that as of that date "I don't have many mp3z". Right-click to see page source produces a message "I don't want U to steel from me!"

      It's like tasting a madeleine cake.

      1. JulieM Silver badge
        Holmes

        Re: Itchy Chin

        And why do you suppose someone would prefix the year (which, coming from a Unix timestamp, has had 1900 subtracted from it) with "19" -- which was bound to break come the year 2000 -- as opposed to the obvious and future-proof method of just adding 1900 to it? Might this possibly have had anything to do with the relative difficulty of adding numbers versus concatenating strings?

        1. Anonymous Coward Silver badge
          Boffin

          Re: Itchy Chin

          Because for about 28 years people were used to computers returning a 2-digit year.

          When Y2k came about, some people expected 99 to become 00 and others expected it to become 100.

          That is the root of many of the foreseen problems. It also stems from not having much memory/storage so optimising down the digits stored.

          1. JulieM Silver badge

            Re: Itchy Chin

            Only the ones who didn't read the documentation.

            The specification for a struct_tm (on which JavaScript data objects are based directly) is well-known, and it says that the year has had 1900 subtracted -- not reduced modulo 100.

    4. Anonymous Coward
      Anonymous Coward

      I'm a tax accountant

      How much do you want 2+2 to equal?

  6. Anonymous Coward
    Anonymous Coward

    Patronising customers?

    That'll be just about every corporate website then.

    Generally the larger the corporation, the larger the patronisation

    Dont get me started on HR departments, motivation and in-house training sites

    1. Anonymous Coward
      Anonymous Coward

      Re: Patronising customers?

      My small company just got bought by a much larger company. The amount of spam coming from inside the larger company is prodigious. The nonstop (largely inapplicable) training, cheerleading, phishing awareness testing and automated compliance emails are enough to drive one to drink. One wonders how we have been able to flourish without all that "stuff" for so long...

      Anon, because one cant be too careful...

      1. Anonymous Coward
        Anonymous Coward

        Re: Patronising customers?

        I think we work for the same corporate overlords!

        1. Anonymous Coward
          Anonymous Coward

          Re: Patronising customers?

          Me too. Were they a French multinational?

          1. Anonymous Coward
            Anonymous Coward

            Re: Patronising customers?

            Possibly, they're a French subsidiary of an American megacorp.

  7. Chris Miller

    Identical access control on development and production systems? What could possibly go wrong?

  8. Groaning Ninny

    =5?

    It pleased me that at the time this article loaded it showed there were five comments.

  9. Velv Silver badge
    Boffin

    This is why test/development environments and production environments should never be the same network.

    People make mistakes. people pick the wrong boxes. People forget to tell everyone when updates are made. People fuck up. If you put some kind of protection between the people and production you reduce the risk of this type of thing.

    And yet some many businesses, organisations, banks and governments departments are moving back to everything on the same network or in the same cloud. Expect to see a lot more "whoopsie" in the press...

    1. Hans Neeson-Bumpsadese Silver badge

      This is why test/development environments and production environments should never be the same network.

      ...and shouldn't use the same identity provider for SSO

    2. Prst. V.Jeltz Silver badge

      "production environments should never be the same network."

      I dont see how that would help, especially in this situation.

      You could quite easily sign into whichever network , and then go for lunch , then forget which one ...

    3. jmch Silver badge

      "Identical access control on development and production systems? What could possibly go wrong?"

      and

      "This is why test/development environments and production environments should never be the same network."

      It's quite possible and sometimes desirable for developers to be connected to multiple environments at one time eg DEV and QA and/or UAT. It's possible and sometimes desirable to have multiple instances of the same application open at the same time, each pointing to multiple environments, and accessed using different credentials.

      Of course best practice requires checking what environment I'm in before I run any script or execute any code etc, but sometimes it doesn't happen. For me what helps is development environment background that changes colour depending on server environment it's connected to. And even that sometimes fails.

      The only way to be completely sure is for devs to simply not have access to Prod, and have change management to implement stuff in Prod... and that brings it's own host of issues

    4. Nolveys Silver badge
      Mushroom

      This is why test/development environments and production environments should never be the same network.

      That seems to imply that they aren't on the same machine, accessed by the same user account and located in the same directory.

  10. disgustedoftunbridgewells Silver badge
    Paris Hilton

    I do what could have been possibly achieved by performing the calculation for 2+2.

    Paris because she's confused too.

  11. BoldMan

    Well if he used JS to perform the calculation he was lucky he got 4 and not 4.000000000001 - JS does not always do sums well :(

    1. Anonymous Coward
      Anonymous Coward

      I get similar things in Excel all the time - result should be 0, but is 1.23E-18 or similar. Don't check for equality - subtract them, round to 5 decimal places, and see if the result is 0 instead.

    2. JulieM Silver badge

      Better One Innit

      If you can find a book of four-figure mathematical tables somewhere, and someone who still knows how to use them, try to multiply 2 * 2 using logs.

      This is hardly a new problem.

      1. John Brown (no body) Silver badge

        Re: Better One Innit

        "If you can find a book of four-figure mathematical tables somewhere, and someone who still knows how to use them, try to multiply 2 * 2 using logs."

        Oh wow, that's a blast from the past. I'm of the age (in the UK at least) where we learned with books of log tables but ended up using calculators by exam time. Log table books were still provided though, not everyone had calculators. And you still had to show your method/working out so the calculator was little more that a tool to remove the drudgery of the arithmetic and act as a look up table for Log/Sin/Cos/Tan.

        1. Martin
          Happy

          Re: Better One Innit

          I'm old enough to remember log tables and slide rules for my maths exams.

          Nice thing about log tables were the pages of equations at the front of them, and the loads of space for putting any other cribs you wanted to remember. Try putting all that useful info on the back of a calculator.

          1. imanidiot Silver badge

            Re: Better One Innit

            I had all of the equations need and often some example sums in my TI-83 graphing calculator when finishing high school. We couldn't be forbidden from using that as it was an allowed aid by official rules :) Barely used it though, as it turned out I usually just did my homework and actually learned stuff. The programming cable paid for itself and some snacks though. Not all students bothered.

        2. Prosthetic Conscience
          Joke

          Re: Better One Innit

          I'm old enough to remember we had to use the hydrogen line to measure everything as galaxies hadn't formed yet

      2. Vincent Ballard
        Joke

        Re: Better One Innit

        I've just checked with my slide rule, and I get 4. HTH.

        1. JulieM Silver badge

          Re: Better One Innit

          Yes, but a standard 20 or 25cm. slide rule is only accurate to three figures, which cancels out the error.

  12. I am David Jones

    2+2=4?

    What’s wrong with:

    2+2=5 (for very large values of 2)

  13. Zebo-the-Fat

    Aproximate

    Aproximate

    2 + 2 = 3.999999999999.......

    1. Deltics
      Coat

      Re: Aproximate

      That's not really approximation, just inefficient representation.

      0.9999..... == 1.0

      Ergo 3.9999...... == 4

      'Proof' (probably much over-simplified and possibly even not really a 'proof'): If there are infinite 9's after the dp of a value that you wish to increase to the next whole number, then you need infinite 0's before the 1 to be added, but if there are infinite 0's then you can never reach the point where you can place the 1 to be added. If you cannot express the difference then there is no (meaningful) difference, other than the representation.

      By extension I suppose n.0000.....N is always also equal to n.0

      Mines the one with reciprocal ∞ in the pocket.

      1. Robert Carnegie Silver badge

        Re: Aproximate

        Specifically, when you're doing mathematics with infinite decimal places then the difference between 4.0 and 3.99999999... is 0.00000000... which obviously is 0. So 4.0 and 3.99999999... are the same number written two different ways.

        Personally I distrust this infinite stuff, but I'm comfortable imagining someone starting to write out the digits of the number, and never stopping. But there's no question of getting to the end; there isn't an end.

        1. Anonymous Coward
          Anonymous Coward

          Re: Aproximate

          While mathematically speaking, 3.999999.... == 4, using a computer to perform a comparison will indicate a difference. (After all, computers can't do infinite-precision floating point...) So, if your code contains if (x==4), and x=3.99999999999, then the result is 'false', not 'true'. It's always best to round to a couple decimal places beyond the smallest expected difference (if your values are 3.5 to 4.5, round to 3.9999) and THEN do the comparison.

  14. Will Godfrey Silver badge
    Happy

    Test/Error messages.

    The funniest I ever saw was a routine that just consisted of a set of printf statements

    "You shouldn't be able to get here."

    "Well I did!"

    "How?"

    "I don't know. You wrote the code. Where should I have been?"

    And so it went on. I can't remember the rest but ti was hilarious.

    1. Oengus Silver badge

      Re: Test/Error messages.

      Years ago I put some "debug" code in a project I was working on. When I went on 2 weeks leave I told my project manager not to demonstrate the project to the end users as it was unstable and might not work.

      When I got back from leave the PM called me into her office and chewed me out. It turns out she had, against my instructions, demonstrated the incomplete project to the users and it had hit my debug code. It was testing a nested if statement and I was unsure of some of the conditions (the specs were a little vague). When it hit the debug code it displayed on the screen "OK Turkey, how the hell did you get here?". Different branches of the If statements gave different messages so I could determine what was happening.

      Mind you, the PM never again demonstrated any of my projects unless I was there or I had said it was ready for testing.

      1. Doctor Syntax Silver badge

        Re: Test/Error messages.

        If you think this might be a problem just add some code at the beginning which says "See you when I get back from hols." and then exits.

  15. Anonymous Coward
    Anonymous Coward

    Testing gone wrong

    Story told to me by a grizzled engineer (so not my "Who Me?") long ago... a team of developers were setting up a control system for newly installed electronic roadway signs, the kind that span overhead across multiple lanes of highway. Not knowing what the inaugural message should be sent from their enclave in city hall, they opted for "GO [local sports team]!!!". Cue a huge, hours long backup and a visit from a VERY irate city manager later...

    1. Oengus Silver badge

      Re: Testing gone wrong

      Displaying a wrong message bad.

      This sort of thing happening very bad.

      1. Antron Argaiv Silver badge

        Re: Testing gone wrong

        Talk about being in the wrong place at exactly the wrong time.

        Cant stop watching it.

    2. J.G.Harston Silver badge

      Re: Testing gone wrong

      Decades ago I was reviewing somebody's code which had (something like) this:

      switch (intvar & 1)

      case 0: do something; break

      case 1: do something else; break

      otherwise: printf("Something went wrong");

      It took a lot of patient explaining to explain how the 'otherwise' clause would never be executed, and years later I still think it didn't sink in.

      1. 2+2=5 Silver badge

        Re: Testing gone wrong

        Doesn't the 'otherwise' clause, in this case, count as 'defensive programming'? It's there in case someone changes the switch in the future but omits a case.

      2. KittenHuffer

        Re: Testing gone wrong

        I'm in the habit of handling all possible values in a CASE statement ..... and then having an ELSE as well.

        This gets populated with a variant of a Hex error message suck as the famous "Out of cheese" error.

        https://en.wikipedia.org/wiki/Hex_(Discworld)#Messages

        The idea being that if the error ever activates then someone will come and let me know that it happened. Normally with either a big smile or a look of confusion on their face.

      3. MadDrFrank

        Re: Testing gone wrong

        I recall a mainframe ALGOL60 compiler, which for certain syntax errors would print the message

        "IMPOSS HAPPENED ----- LINE ****"

        for some absurdly large number.

    3. Robert Carnegie Silver badge

      Re: Testing gone wrong

      I may be missing the point of the story about electronic road signs. It said GO TEAM all across the city; wouldn't it only be a problem if it said STOP?

  16. Elfoad Regfoad

    The truth will set you free

    Years ago, a friend wrote a program in Pascal that had as its first three lines:

    tmp = TRUE;

    TRUE = FALSE;

    FALSE = TMP;

    I don't know if it did what he expected but it was a bit scary. The rest of the program did some very cool stuff that shouldn't have been possible on the minimal OS on top of a batch system (old CDC Cyber 175).

    1. Down not across Silver badge

      Re: The truth will set you free

      That is unlikely to do anything at all. Unless there is a line missing from the top and that is a constant definition. Variable assignments are done with ':=', and not '=' in pascal. Unless the compiler/interpreter on CDC did some funky stuff.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon

Biting the hand that feeds IT © 1998–2019