Comparing two numbers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lawrence Kirby

    #76
    Re: Comparing two numbers

    On Wed, 19 Jan 2005 14:35:41 +0000, Chris Dollin wrote:

    ....
    [color=blue][color=green]
    >> I counted a, b and c as three items.[/color]
    >
    > Those are the *names* of the items.[/color]

    Correct, the items themselves are the three objects/variables these
    represent.
    [color=blue]
    > The items are 42 and 17.[/color]

    Those are properties of the items. It just happens that two items share
    the same property. That does not make them the same item. I have 3 coins
    in my hand which I will label x, y and z. The fact that x and z are of the
    same denomination does not suddenly mean that I only have 2 coins in my
    hand.
    [color=blue]
    > Otherwise
    > the answer would likely be "c" ...[/color]

    When you use a comparative or superlative form you are comparing a common
    property, usually as defined by the base adjective. The assumption here
    was the property in question "great-ness" was the value, but that may be a
    wrong assumption. If so the fault is in the question for not being clear.

    Lawrence

    Comment

    • CBFalconer

      #77
      Re: Comparing two numbers

      Richard Bos wrote:[color=blue]
      > mwojcik@newsguy .com (Michael Wojcik) wrote:
      >[color=green]
      >> Preferring the comparative when only two items are being compared
      >> is certainly longstanding and widespread among those who advocate
      >> specific usages in English.[/color]
      >
      > Preferring it, yes. Demanding it of others, no. "The greater of the
      > two" is correct. "The greatest of the two" is not wrong.[/color]

      Go ahead. You have my permission (if not blessing) to cavalierly
      use 'greatest' as you wish. Do not misconstrue this as a license
      to use the broken google usenet interface, nor to top-post, nor to
      fail to snip, nor to 'edit' quoted material, nor to use
      'doodspeak', nor to attach binaries. :-) I am sure you have been
      eagerly awaiting this permission.

      --
      "If you want to post a followup via groups.google.c om, don't use
      the broken "Reply" link at the bottom of the article. Click on
      "show options" at the top of the article, then click on the
      "Reply" at the bottom of the article headers." - Keith Thompson


      Comment

      • Michael Wojcik

        #78
        Re: Comparing two numbers


        In article <cso0kj$ksd$1@m alatesta.hpl.hp .com>, Chris Dollin <kers@hpl.hp.co m> writes:[color=blue]
        > Michael Wojcik wrote:[color=green]
        > > In article <csliac$eig$1@m alatesta.hpl.hp .com>, Chris Dollin
        > > <kers@hpl.hp.co m> writes:[color=darkred]
        > >>
        > >> You might accept that as a grammatical constraint; I don't.[/color]
        > >
        > > It's a question of usage, not grammar. No matter of grammar is under
        > > debate. English grammar tells us that "greatest" is the superlative
        > > form of the adjective "great", and that "greater" is the comparative
        > > form. Whether the superlative is properly used for a set of fewer
        > > than three items is a matter of usage.[/color]
        >
        > Well, I'm not convinced, but that's partly because my notion of
        > grammar for natural language is as a description of usage,[/color]

        Exactly. English grammar is descriptive (specifically, of syntax),
        not proscriptive.
        [color=blue]
        > so I'm not making the distinction in the same way you are.[/color]

        Clearly, but that doesn't follow from grammar being a description
        of usage. If grammar describes usage, then an error of grammar
        can only be an error of description, not an "error" in the actual
        use of language in the statement in question.
        [color=blue]
        > I think my position here is that I'd use "greatest" and "greater" without
        > organised preference, for any non-empty collections of items,[/color]

        I wouldn't try to stop you. (I actually do possess a secret doomsday
        weapon with which I could enforce my language preferences on everyone,
        but I don't wield it for trifles.) I prefer the comparative when
        dealing with two items, but the use of the superlative in that context
        is pretty widespread. The comparative for more than two ("he was the
        wittier of the three"?) is, I think, less common, but understanding
        probably won't be dramatically impaired by it.
        [color=blue]
        > but of course I might be empirically wrong[/color]

        In a matter of usage? I'm not sure empiricism applies.
        [color=blue]
        > and in any case my usage has been heavily influenced by mathematics.[/color]

        Where I agree that distinguishing the dual case would be a pointless
        inconvenience.
        [color=blue]
        > *I* am happy to say "all my helicopters are heavily armed" and "our
        > biggest cat is on the bed". (But I might not be so happy to say that
        > to a policeman.)[/color]

        Those cat police are a caution, aren't they?

        --
        Michael Wojcik michael.wojcik@ microfocus.com

        They had forgathered enough of course in all the various times; they had
        again and again, since that first night at the theatre, been face to face
        over their question; but they had never been so alone together as they were
        actually alone - their talk hadn't yet been so supremely for themselves.
        -- Henry James

        Comment

        • Mike Wahler

          #79
          Re: Comparing two numbers

          "Richard Bos" <rlb@hoekstra-uitgeverij.nl> wrote in message
          news:41efa5ac.5 29456729@news.i ndividual.net.. .[color=blue]
          > mwojcik@newsguy .com (Michael Wojcik) wrote:
          >[color=green]
          > > Preferring the comparative when only two items are being compared is
          > > certainly longstanding and widespread among those who advocate
          > > specific usages in English.[/color]
          >
          > Preferring it, yes. Demanding it of others, no. "The greater of the two"
          > is correct. "The greatest of the two" is not wrong.[/color]

          The greatest of 2 is 2.

          Now someone please write a C expression which
          proves this. :-)

          -Mike


          Comment

          • Albert van der Horst

            #80
            Re: Comparing two numbers

            In article <8a6984c70eddf0 d59fc9d38e44703 a2f@localhost.t alkaboutprogram ming.com>,
            purifier <cnbctv18@gmail .com> wrote:[color=blue]
            >It's a real sad thing to know, Sir... I didn't expect that my post would
            >make you think that it was my homework... I'm an Electronics Engineer, but
            >i'm interested a lot in programming... One of my friends asked me this
            >question in a mail. I just pasted that mail here... For your information i
            >even said "Can you please help me solve the problem" Why would I say huh
            >and all kinds of stuff and then ask people to solve the problem? I could
            >have directly given the problem...
            >Anyway, Sorry if i mislead you guys... Thank you for the replies.. Atleast
            >if possible, please give me some ideas...[/color]

            The following is not correct. But there is an idea inside.
            Though it is not correct, it works.

            x = -(a<b);
            y = -!x;
            max = (b&x)|(y&a);

            (You may want to take a course DEC Alpha assembler programming.)
            [color=blue]
            >Thank You
            >[/color]

            --

            Groetjes Albert
            --
            Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
            One man-hour to invent,
            One man-week to implement,
            One lawyer-year to patent.

            Comment

            • Ben Pfaff

              #81
              Re: Comparing two numbers

              rlb@hoekstra-uitgeverij.nl (Richard Bos) writes:
              [color=blue]
              > mwojcik@newsguy .com (Michael Wojcik) wrote:
              >[color=green]
              >> Preferring the comparative when only two items are being compared is
              >> certainly longstanding and widespread among those who advocate
              >> specific usages in English.[/color]
              >
              > Preferring it, yes. Demanding it of others, no. "The greater of the two"
              > is correct. "The greatest of the two" is not wrong.[/color]

              I think the former example is the best usage.
              --
              <g,d&r>

              Comment

              • Mike Wahler

                #82
                Re: Comparing two numbers


                "Albert van der Horst" <albert@spenarn c.xs4all.nl> wrote in message
                news:iamspf.2p4 @spenarnc.xs4al l.nl...[color=blue]
                > In article[/color]
                <8a6984c70eddf0 d59fc9d38e44703 a2f@localhost.t alkaboutprogram ming.com>,[color=blue]
                > purifier <cnbctv18@gmail .com> wrote:[color=green]
                > >It's a real sad thing to know, Sir... I didn't expect that my post would
                > >make you think that it was my homework... I'm an Electronics Engineer,[/color][/color]
                but[color=blue][color=green]
                > >i'm interested a lot in programming... One of my friends asked me this
                > >question in a mail. I just pasted that mail here... For your information[/color][/color]
                i[color=blue][color=green]
                > >even said "Can you please help me solve the problem" Why would I say huh
                > >and all kinds of stuff and then ask people to solve the problem? I could
                > >have directly given the problem...
                > >Anyway, Sorry if i mislead you guys... Thank you for the replies..[/color][/color]
                Atleast[color=blue][color=green]
                > >if possible, please give me some ideas...[/color]
                >
                > The following is not correct. But there is an idea inside.
                > Though it is not correct, it works.
                >
                > x = -(a<b);
                > y = -!x;
                > max = (b&x)|(y&a);
                >
                > (You may want to take a course DEC Alpha assembler programming.)[/color]

                Since I think enough time has passed :-), and I haven't
                seen the 'array method' posted yet, here it is (if the
                inputs are equal, returns the first.):

                int greater(int n1, int n2)
                {
                int a[2] = {n1, n2};
                return a[n1 < n2];
                }

                -Mike


                Comment

                • Albert van der Horst

                  #83
                  Re: Comparing two numbers

                  In article <lnekgi91hp.fsf @nuthaus.mib.or g>,
                  Keith Thompson <kst-u@mib.org> wrote:
                  <SNIP>[color=blue]
                  >
                  >Incidentally , I can think of a reasonable reason to want to find the
                  >greater of two numbers without using certain constructs. Conditional
                  >branches, on some systems, can cause performance problems by messing
                  >with pipelining, instruction caches, and other off-topic stuff. If
                  >performance is sufficiently important, it just might be worthwhile to
                  >micro-optimize such an operation. If you can state the restrictions
                  >in portable C terms (even if the motivation for the restrictions is
                  >off-topic), you might have an interesting question.[/color]

                  Like this?
                  ------------
                  int test(int a, int b)
                  {
                  return a<b? b: a;
                  }
                  int test2(int a, int b)
                  {
                  int c;

                  if (a<b)
                  c=b;
                  else
                  c=a;

                  return c;
                  }
                  -----------------------
                  This is what the gnu c-compiler delivers on DEC alpha
                  (-O3). There is no jump in sight. The code is the same
                  for both functions.

                  For the uninitiated: I have commented the code.[color=blue]
                  >[/color]
                  .file 1 "aap.c"
                  .version "01.01"
                  .set noat
                  gcc2_compiled.:
                  __gnu_compiled_ c:
                  ..text
                  .align 3
                  .globl test
                  .ent test
                  test:
                  $test..ng:
                  .frame $30,0,$26,0
                  .prologue 0
                  cmple $17,$16,$1 r1 = (a<=b);
                  bis $16,$16,$0 r0 = b; (literally r0 = b|b; )
                  cmoveq $1,$17,$0 if (r1) r0 = a;
                  ret $31,($26),1
                  .end test
                  .align 3
                  .globl test2
                  .ent test2
                  test2:
                  $test2..ng:
                  .frame $30,0,$26,0
                  .prologue 0
                  cmple $16,$17,$1
                  bis $17,$17,$0
                  cmoveq $1,$16,$0
                  ret $31,($26),1
                  .end test2
                  .ident "GCC: (GNU) egcs-2.90.27 980315 (egcs-1.0.2 release)"
                  -------------

                  Or is this what you mean by off topic?
                  [color=blue]
                  >--
                  >Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                  >San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
                  >We must do something. This is something. Therefore, we must do this.[/color]



                  --
                  --
                  Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
                  One man-hour to invent,
                  One man-week to implement,
                  One lawyer-year to patent.

                  Comment

                  • Keith Thompson

                    #84
                    Re: Comparing two numbers

                    Albert van der Horst <albert@spenarn c.xs4all.nl> writes:[color=blue]
                    > In article <lnekgi91hp.fsf @nuthaus.mib.or g>,
                    > Keith Thompson <kst-u@mib.org> wrote:
                    > <SNIP>[color=green]
                    >>
                    >>Incidentall y, I can think of a reasonable reason to want to find the
                    >>greater of two numbers without using certain constructs. Conditional
                    >>branches, on some systems, can cause performance problems by messing
                    >>with pipelining, instruction caches, and other off-topic stuff. If
                    >>performance is sufficiently important, it just might be worthwhile to
                    >>micro-optimize such an operation. If you can state the restrictions
                    >>in portable C terms (even if the motivation for the restrictions is
                    >>off-topic), you might have an interesting question.[/color]
                    >
                    > Like this?[/color]
                    [snip example showing generated code with no jumps]

                    Good point; most compilers do a pretty good job of optimizing jumps
                    away if it makes sense to do so for a given processor (and, just as
                    important, not doing so if it doesn't make sense).

                    I'll amend my above statement to say that this kind of
                    micro-optimization might make sense given the above circumstances *if*
                    you don't have a compiler that can do the optimization for you. (That
                    may not be an issue these days.)

                    --
                    Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
                    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
                    We must do something. This is something. Therefore, we must do this.

                    Comment

                    • Chris Dollin

                      #85
                      Re: Comparing two numbers

                      Michael Wojcik wrote:
                      [color=blue]
                      >
                      > In article <cso0kj$ksd$1@m alatesta.hpl.hp .com>, Chris Dollin
                      > <kers@hpl.hp.co m> writes:[/color]
                      [color=blue][color=green]
                      >> I think my position here is that I'd use "greatest" and "greater" without
                      >> organised preference, for any non-empty collections of items,[/color]
                      >
                      > I wouldn't try to stop you. (I actually do possess a secret doomsday
                      > weapon with which I could enforce my language preferences on everyone,
                      > but I don't wield it for trifles.) I prefer the comparative when
                      > dealing with two items, but the use of the superlative in that context
                      > is pretty widespread. The comparative for more than two ("he was the
                      > wittier of the three"?) is, I think, less common, but understanding
                      > probably won't be dramatically impaired by it.
                      >[color=green]
                      >> but of course I might be empirically wrong[/color]
                      >
                      > In a matter of usage? I'm not sure empiricism applies.[/color]

                      Sorry, I mean that I might be empirically wrong about my usage patterns.
                      (Self-observation is tricky, even more subject to selection effects than
                      observation of others.)
                      [color=blue][color=green]
                      >> *I* am happy to say "all my helicopters are heavily armed" and "our
                      >> biggest cat is on the bed". (But I might not be so happy to say that
                      >> to a policeman.)[/color]
                      >
                      > Those cat police are a caution, aren't they?[/color]

                      There appearance can be arresting, also.


                      --
                      Chris "electric hedgehog" Dollin

                      Comment

                      • Mabden

                        #86
                        Re: Comparing two numbers

                        "purifier" <cnbctv18@gmail .com> wrote in message
                        news:5c7ae7523d 10f03532a993af9 5730ce4@localho st.talkaboutpro gramming.com...[color=blue]
                        > Enough of those insults... I'm sorry for bothering you guys... I guess[/color]
                        this[color=blue]
                        > forum is filled with all time intellectuals.. . I already explained[/color]
                        that I'm[color=blue]
                        > an Electronics Engineer just beginning to learn C... Now why would I[/color]
                        lie[color=blue]
                        > about my profession? Come on...there is no reason to... Ok...if it was[/color]
                        one[color=blue]
                        > post insulting me then it's ok but it seems that everyone who posts a[/color]
                        reply[color=blue]
                        > just insults in some or the other way... It is a pity that you guys[/color]
                        are so[color=blue]
                        > rude to beginners like me... Now, how do you want me to prove that i'm[/color]
                        not[color=blue]
                        > asking you to do my homework...? Do you want me to sign a bond or[/color]
                        what?[color=blue]
                        > The only reason i came here was thinking that this is an open forum...[/color]
                        and[color=blue]
                        > thought i could ask for some help... Now, how do i show you my work if[/color]
                        I[color=blue]
                        > didn't even understand the problem... Anyway, I won't bother you guys
                        > again... You can talk all the hi fi stuff...
                        >
                        > And Admin Sir, Let me finally congratulate you in having such a[/color]
                        wonderful[color=blue]
                        > forum... All the above things were my personal opinions because i was[/color]
                        hurt[color=blue]
                        > a lot after posting here but your board is definitely helpful for many
                        > experienced programmers to interact... Keep it up Sir...
                        >
                        > purifier[/color]

                        douche-bag!

                        --
                        Mabden


                        Comment

                        • Mabden

                          #87
                          Re: Comparing two numbers

                          "Mike Wahler" <mkwahler@mkwah ler.net> wrote in message
                          news:5fUHd.1206 $r27.786@newsre ad1.news.pas.ea rthlink.net...[color=blue]
                          >
                          > The greatest of 2 is 2.
                          >[/color]

                          The greatest of 2 is 3, for relatively large values of 2...

                          --
                          Mabden


                          Comment

                          • Mabden

                            #88
                            Re: Comparing two numbers

                            "CBFalconer " <cbfalconer@yah oo.com> wrote in message
                            news:41ED6827.5 2D8F56D@yahoo.c om...[color=blue]
                            > Since all potential homework problems are immeditately rejected or
                            > argued over for a week or so, the mechanism ensures that any
                            > homework answers arrive too late for submission, and thus do not
                            > exacerbate the flood of incompetent programmers.[/color]

                            Except those who research the archives!

                            ....which has never happened, or they would have found last year's crop
                            of "Solve cold fishions without using fish or ions" problems'
                            "solutions" .

                            Ah, reasearch. What ever happened to Rea, anyway?

                            --
                            Mabden


                            Comment

                            • Mabden

                              #89
                              Re: Comparing two numbers

                              "Chris Dollin" <kers@hpl.hp.co m> wrote in message
                              news:csjbo1$cus $1@malatesta.hp l.hp.com...[color=blue]
                              > Kenneth Brody wrote:
                              >[color=green]
                              > > purifier wrote:[color=darkred]
                              > >>
                              > >> The problem is to write a program in 'C' to find the greatest of 2[/color][/color][/color]
                              given[color=blue][color=green][color=darkred]
                              > >> numbers...[/color]
                              > >
                              > > By definition, you cannot find the "greatest" of two things.[/color]
                              >
                              > That's a pretty useless definition, then. Me, I can find the greatest
                              > of *one* thing. It's the greatest of *no* things that's tricky.[/color]

                              What is the greatest thing about pissing on your shoes?

                              The only thing I can think of is me doing it...

                              --
                              Mabden


                              Comment

                              • Dave Thompson

                                #90
                                Re: Comparing two numbers

                                On Tue, 18 Jan 2005 15:58:57 +0000, Chris Dollin <kers@hpl.hp.co m>
                                wrote:
                                [color=blue]
                                > Kenneth Brody wrote:[/color]
                                <snip>[color=blue][color=green]
                                > > By definition, you cannot find the "greatest" of two things.[/color]
                                >
                                > That's a pretty useless definition, then. Me, I can find the greatest
                                > of *one* thing. It's the greatest of *no* things that's tricky.[/color]

                                This is the difference between people and mathematicians. :-)

                                In Fortran MAXVAL of an empty (sub)array produces the identity, -huge,
                                and MINVAL respectively +huge. ISTR APL did essentially the same, but
                                that memory is faint and I have no reference at hand to check.

                                Now, the greatest (or whatever) of a *negative number* of things ...

                                And in those situations where one person says to another "I have a
                                little nothing for you" it definitely isn't no thing and usually is a
                                thing nowhere near least by the relevant metric(s). <G>

                                - David.Thompson1 at worldnet.att.ne t

                                Comment

                                Working...