[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

Range syntax

newbarker

10/16/2008 3:33:00 PM

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
6 Answers

Obnoxious User

10/16/2008 3:45:00 PM

0

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...(mathematics)

--
OU
Remember 18th of June 2008, Democracy died that afternoon.
http://frapedia.se/wiki/Information_...

Juha Nieminen

10/16/2008 3:45:00 PM

0

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++.

Victor Bazarov

10/16/2008 3:54:00 PM

0

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

newbarker

10/16/2008 4:23:00 PM

0

Many thanks to all that responded!

James Kanze

10/17/2008 8:18:00 AM

0

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.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Victor Bazarov

10/17/2008 12:56:00 PM

0

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