# ordinal

The file builtins\ordinal.e (an autoinclude) contains a small collection of (English only) ordinal number handling routines.

string suffix =

string res =

string res =

These routines are fully supported by

string suffix =

**ord**(atom n) - returns "st", "nd", "rd", or "th". n<=0 always returns "th".string res =

**ordinal**(atom n, bool bJustSpell=false) - returns "first", "second", etc, or "one", "two", etc if bJustSpell is true.string res =

**ordinant**(atom n) - returns ["minus "] "never", "once", "twice", "three times", etc.The ordinal() routine handles numbers up to at least one quadrillion (10^{15}), as well as fractions, to at most ten decimal places.

One trillion is 10^{12}, one billion is 10^{9}, this never returns "millard", and cannot as yet be configured to return such.

For negative numbers the result is simply prefixed with "minus ", otherwise identical to the corresponding positive number result.

These routines are fully supported by

**pwa/p2js**.### Example:

-- Output: -- The -2th or minus second number is minus two. -- The -1th or minus first number is minus one. -- The 0th or zeroth number is zero. -- The 1st or first number is one. -- The 2nd or second number is two. -- The 3rd or third number is three. -- The 4th or fourth number is four. -- The 125th or one hundred and twenty-fifth number is one hundred and twenty-five. -- The 216th or two hundred and sixteenth number is two hundred and sixteen. -- The 343rd or three hundred and forty-third number is three hundred and forty-three. -- The 512th or five hundred and twelfth number is five hundred and twelve. -- The 729th or seven hundred and twenty-ninth number is seven hundred and twenty-nine. -- The 1,000th or one thousandth number is one thousand. -- The 1,331st or one thousand, three hundred and thirty-first number is one thousand, three hundred and thirty-one. -- PI is three point one four one five nine two six five three five -- 1.23 is one point two three -- e occurs twice in feed