My personal opinion: ordinal numbers can get a th, rd, nd, or st.  That
implies whole numbers only.  If an ordinal is requested, test for a positive
integer; if not an integer, leave alone, otherwise add whichever suffix is
required.

2   ->    2nd
2.2 ->    2.2
NaN ->    NaN
4   ->    4th
-6  ->    -6


MikeA



-----Original Message-----
From: Hannu Krosing
To: Karel Zak - Zakkr
Cc: Oliver Elphick; J. Roeleveld; pgsql-hackers
Sent: 00/01/05 06:00
Subject: Re: [HACKERS] ordinal decimal number

Karel Zak - Zakkr wrote:
> 
> On Wed, 5 Jan 2000, Oliver Elphick wrote:
> 
> > "J. Roeleveld" wrote:
> >   >> Hi,
> >   >>
> >   >> I add to the to_char() routine "ordinal-number" feature, but my
> >   >> English is insufficient for this :-(  (sorry)
> >   >
> >   >There are enough people that speak English, what we don't have
enough
> >   >of on this world are people that know what they can and can't do
:)
> >   >
> >   >> I good know how is it for non-decimal numbers, but if number
has
> >   >> decimal part?
> >   >>
> >   >> Example: 2.6  --> 2.6th
> >   >>             or  2.6  --> 2.6nd
> >   >
> >   >It's:  2.6 --> 2.6th
> >
> > It isn't really possible to have an ordinal with decimal places in
> > English; it sounds very awkward.
> >
> > Ordinals designate placing in a list; a computer example would be an
> > array index.  How can such a number have decimal places?

I guess they are awkward in most languages, except for designating
powers 
where they _could_ be used by extension of their use for integer powers?
 
e raised to the pi-th power ?

btw, should 2.2 be 2.2nd or 2.2th (two point tooth :)

what about rationals 7 2/3 th ?

what about legal float numbers like infinity (is it infinitieth)
and NaN - NaN-th or NaNd :)

for me 2.2nd represents not decimal but hierrachy, so it should be
possible to
have
2.2.2.2nd

>  I implement it to to_char (ordinal with decimal places), but is user
choise
> if use or not use it...

Is your code locale-aware ?

I guess that this is something that could probbaly be found in
localisation
tables,
except perhaps for floats.

------------------
Hannu

************

Wed, 5 Jan 2000 21:38:43 +0200 
"Ansley, Michael" <Michael.Ansley@intec.co.za>
RE: [HACKERS] ordinal decimal number


On Wed, 5 Jan 2000, Ansley, Michael wrote:

> My personal opinion: ordinal numbers can get a th, rd, nd, or st.  That
> implies whole numbers only.  If an ordinal is requested, test for a positive
> integer; if not an integer, leave alone, otherwise add whichever suffix is
> required.
> 
> 2   ->    2nd
> 2.2 ->    2.2
> NaN ->    NaN
> 4   ->    4th
> -6  ->    -6

Well, it is good solution. I implement it. Or exist the other suggestion?

							Karel


Thu, 6 Jan 2000 11:52:55 +0100 (CET)
Karel Zak - Zakkr <zakkr@zf.jcu.cz>
RE: [HACKERS] ordinal decimal number