Range syntax

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • newbarker@gmail.com

    Range syntax

    I'm looking through the C++ standard and see statements like this:

    yields: the smallest q in
    [p,p+n) such that
    X::eq(*q,c) is true, zero
    otherwise.

    I'm not from a scientific/math background but would like to read more
    about what this "[p,p+n)" syntax is called and how it's defined so
    does anyone have a link to a web page about this please?

    Regards,

    Pete
  • Obnoxious User

    #2
    Re: Range syntax

    On Thu, 16 Oct 2008 08:33:29 -0700, newbarker wrote:
    I'm looking through the C++ standard and see statements like this:
    >
    yields: the smallest q in
    [p,p+n) such that
    X::eq(*q,c) is true, zero
    otherwise.
    >
    I'm not from a scientific/math background but would like to read more
    about what this "[p,p+n)" syntax is called and how it's defined so does
    anyone have a link to a web page about this please?
    >
    Regards,
    >
    Pete
    http://en.wikipedia.org/wiki/Interval_(mathematics)

    --
    OU
    Remember 18th of June 2008, Democracy died that afternoon.

    Comment

    • Juha Nieminen

      #3
      Re: Range syntax

      newbarker@gmail .com wrote:
      I'm not from a scientific/math background but would like to read more
      about what this "[p,p+n)" syntax is called and how it's defined so
      does anyone have a link to a web page about this please?
      The notation of ranges is rather simple: Square brackets are used when
      the extreme values are included in the range, and parentheses when they
      are excluded. They can also be mixed, as in your example.

      "[p, p+n)" means a range of values between p and p+n, including p but
      excluding p+n.

      In theory you could also have (p, p+n] which would mean a range of
      values between p and p+n, excluding p but including p+n. Of course this
      is seldom used when talking about C++.

      Comment

      • Victor Bazarov

        #4
        Re: Range syntax

        newbarker@gmail .com wrote:
        I'm looking through the C++ standard and see statements like this:
        >
        yields: the smallest q in
        [p,p+n) such that
        X::eq(*q,c) is true, zero
        otherwise.
        >
        I'm not from a scientific/math background but would like to read more
        about what this "[p,p+n)" syntax is called and how it's defined so
        does anyone have a link to a web page about this please?
        I don't have a link, but this is a standard Western math notation for a
        range that begins at 'p' *inclusively* and ends on 'p+n' but excludes
        that value.

        V
        --
        Please remove capital 'A's when replying by e-mail
        I do not respond to top-posted replies, please don't ask

        Comment

        • newbarker@gmail.com

          #5
          Re: Range syntax

          Many thanks to all that responded!

          Comment

          • James Kanze

            #6
            Re: Range syntax

            On Oct 16, 5:33 pm, newbar...@gmail .com wrote:
            I'm looking through the C++ standard and see statements like this:
            yields: the smallest q in
            [p,p+n) such that
            X::eq(*q,c) is true, zero
            otherwise.
            I'm not from a scientific/math background but would like to
            read more about what this "[p,p+n)" syntax is called and how
            it's defined so does anyone have a link to a web page about
            this please?
            Victor and Juha have already given the details, but it's worth
            mentionning that this is called a half open interval---an
            interval which includes its end points is closed, one which
            doesn't is open. Also, the notation varies: "[a,b)" (or
            "[a...b)") is almost universal in the anglo-saxon world, but in
            France, I've often seen "[a;b[" or "[a...b[", with the [] being
            used backwards to indicate openness. (Note too the use of ';'
            instead of ','. This is usual in much of the world, where the
            decimal character is a comma, and not a point.)

            --
            James Kanze (GABI Software) email:james.kan ze@gmail.com
            Conseils en informatique orientée objet/
            Beratung in objektorientier ter Datenverarbeitu ng
            9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

            Comment

            • Victor Bazarov

              #7
              Re: Range syntax

              James Kanze wrote:
              On Oct 16, 5:33 pm, newbar...@gmail .com wrote:
              >I'm looking through the C++ standard and see statements like this:
              >
              >yields: the smallest q in
              >[p,p+n) such that
              >X::eq(*q,c) is true, zero
              >otherwise.
              >
              >I'm not from a scientific/math background but would like to
              >read more about what this "[p,p+n)" syntax is called and how
              >it's defined so does anyone have a link to a web page about
              >this please?
              >
              Victor and Juha have already given the details, but it's worth
              mentionning that this is called a half open interval---an
              interval which includes its end points is closed, one which
              doesn't is open. Also, the notation varies: "[a,b)" (or
              "[a...b)") is almost universal in the anglo-saxon world, but in
              France, I've often seen "[a;b[" or "[a...b[", with the [] being
              used backwards to indicate openness. (Note too the use of ';'
              instead of ','. This is usual in much of the world, where the
              decimal character is a comma, and not a point.)
              The use of the inverted bracket to indicate the open end of the interval
              is common in former Soviet Union as well. At least I was taught that
              way... And while the comma *is* the decimal separator, I don't recall
              the use of the semicolon in the interval.

              V
              --
              Please remove capital 'A's when replying by e-mail
              I do not respond to top-posted replies, please don't ask

              Comment

              Working...