$Id: math.xsl,v 1.4 2004/10/08 06:37:25 balls Exp $
Ball
Steve
2004
2002
Steve Ball
Math Module
Introduction
This module provides mathematical functions.
Power
Raises a number to a power.
base
The base number. Must be a number.
power
The power to raise the number to. Must be an integer.
Returns base multiplied by itself power times. If the base or power are not numbers or if the power is fractional then an empty string is returned.
1
1
0
Conversion
Converts a hexidecimal value to a decimal value.
value
The hexidecimal number. Must be a number in hexidecimal format.
Returns the value as a decimal string. If the value is not a number then a NaN value is returned.
10
11
12
13
14
15
Ordinal number
Gives the ordinal number of a given counting number. For example, 1 becomes "1st".
number
An integer number.
Returns the number with an ordinal suffix.
th
st
nd
rd
th
Returns an ordinal number
This template returns the ordinal number for a given counting number as a word. For example "first" for 1.
Only handles numbers less than 10000000 (ten million).
number
The counting number.
conjunctive
Whether to add the word "and" to the result, for example "one hundred and first" rather than "one hundred first". Default is "yes".
Returns the ordinal number as a string.
zeroth
and
first
and
second
and
third
and
fourth
and
fifth
and
sixth
and
seventh
and
eighth
and
ninth
and
tenth
and
eleventh
and
twelveth
and
thirteenth
and
fourteenth
and
fifteenth
and
sixteenth
and
seventeenth
and
eighteenth
and
nineteenth
and
twentieth
and
thirtieth
and
fortieth
and
fiftieth
and
sixtieth
and
seventieth
and
eightieth
and
ninetieth
millionth
and
thousandth
and
hundredth
and
and
and
and
Returns a number as a word
This template returns the word for a given integer number, for example "one" for 1.
Only handles numbers less than 10000000 (ten million).
number
The counting number.
conjunctive
Adds the word "and" where appropriate, for example.
Returns the number as a string.
zero
minus
million
million
thousand
thousand
and
hundred
hundred
and
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
sixteen
seventeen
eighteen
nineteen
twenty
thirty
forty
fifty
sixty
seventy
eighty
ninety