<html><head>
<title>Sexagesimal Numbers in C++</title>
</head>
<body>
<h1>Sexagesimal Numbers in C++</h1>

<p>
ISO/IEC JTC1 SC22 WG21 N2601 = 08-0111 - 2008-04-01
</p>

<p>
Lawrence Crowl, crowl@google.com, Lawrence@Crowl.org 
</p>

<h2>Introduction</h2>

<p>
C++ provides good support for numbers
expressed in octal, decimal, and hexadecimal bases.
However, it does not provide support for numbers
expressed in the sexagesimal (60) base.
This lack of support is surprising given that the sexagesimal base
is the foundation of modern time and angular measures.
Within the sexagesimal base,
time is simply expressed as hours with a radix point.
The "minute" is a "minute hour"
or a 60<sup>th</sup> of an hour.
The "second" is a "second minute hour",
a 60<sup>th</sup> of a minute hour,
or a 3600<sup>th</sup> of an hour.
Likewise, the angular degree is so divided and named.
More pragmatically,
the time and angles can be counted as integral "seconds".
The higher order components, minutes and hours,
will be read directly from the higher order digits.
</p>

<p>
With sexagesimal numbers,
the representation of time needs only three digits,
one for the hour, one for the minute, and one for the second.
Furthermore, no punctuation is necessary.
This economy contrasts markedly with conventional time notation,
which requires six digits and two punctuation marks.
Likewise,
the representation of angles needs only four digits,
two for the degree, one for the minute, and one for the second.
Again, no punctuation is necessary,
and its economy contrasts with seven digits and three punctuation markers
in conventional angular notation.
</p>

<p>
Given the economy of sexagesimal notation,
the direct support for it in C++ is desirable.
</p>

<h2>Solution</h2>

<p>
The straightforward approach to supporting an additional number base
is to extend the existing mechanism for indicating hexadecimal numbers.
Unfortunately,
the number of sexagesimal digits
exceeds the number of decimal digits and lower-case letters.
The obvious workaround is to have upper-case and lower-case letters
represent different digits.
While this workaround does meet the need for digits,
it is inconsistent with the syntax for hexadecimal numbers.
Additionally, the explicit base marker
reduces the advantage in economy of sexagesimal representations.
More importantly,
mapping between digit value and the letter forms is less than obvious,
entailing a significant cognitive burden.
So, extending the hexadecimal approach is not useful.
</p>

<p>
The solution to this notational problem
was well-solved by the Old Babylonian period,
the first half of the second millennium BC
[1] [2] [3] [4].
Rather than adopt an untested and invented number representation,
we propose to represent sexagesimal numbers with historically proven notation,
Babylonian cuneiform numbers.
</p>

<p>
With cuneiform digits, the base of the number is obviously sexagesimal,
and additional marking of the base is unnecessary.
This lack of a base marker preserves the economy of representation
described above.
</p>

<h2>Proposal</h2>

<p>
We propose to use the ISO 10646 [6] [7] [8] standard
to represent cuneiform numbers.
ISO 10646 provide characters to represent cuneiform digits
[9] [10] [11] [12] [13].
However, rather than provide one character per digit,
it provides to characters per digit.
The first character encodes the number of tens
(<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Ten.gif" height=13 width=8>,
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Twenty.gif" height=13 width=12>,
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Thirty.gif" height=13 width=16>,
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Forty.gif" height=22 width=16>, or
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Fifty.gif" height=23 width=15>)
and the second character encodes the number of units
(<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/One.gif" height=12 width=9>,
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Two.gif" height=12 width=15>,
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Three.gif" height=12 width=21>,
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Four.gif" height=18 width=21>,
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Five.gif" height=17 width=21>,
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Six.gif" height=17 width=21>,
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Seven.gif" height=24 width=21>,
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Eight.gif" height=23 width=21>, or
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Nine.gif" height=23 width=21>).
</p>

<p>
The number 
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Ten.gif" height=13 width=12><img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Four.gif" height=18 width=21><img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Fifty.gif" height=23 width=15><img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Six.gif" height=17 width=21>
represents 10&times;60+4&times;60+50+6
which is 896.
</p>

<p>
As is customary in C++,
the cuneiform digits may need to be represented with universal character names.
The example above would be represented as
<code>\U0001230B\U0001243C\U00012410\U0001240B</code>
when the program text must use only the basic character set.
</p>

<p>
The cuneiform digit representation
included no explicit representation for zero units or zero tens.
As such, a digit consisting only of tens
followed by a digit consisting only of units
could be interpreted as a single digit
consisting of both tens and units.
As was customary in some texts [5],
we disambiguate this situation with a vertical colon
in the position of the units.
</p>

<p>
Ancient cuneiform numbers represented a zero digit with an empty space.
As this approach is not compatible with modern usage,
we propose to explicitly represent a zero
with the cuneiform diagonal colon,
as was customary in later texts.
</p>

<p>
Cuneiform numbers often have variant forms.
We propose to include some of those variants,
when they might be important to minimizing either height or widths.
However, we leave out variant forms that might be confusing.
Furthermore, we leave out the <q>ash</q> forms of units,
as there is no present need to standardize them.
</p>

<p>
The current Unicode standard has omitted the character for 'twenty'.
Pending correction of that omission,
we propose to use the "u over u u reversed over u reversed",
which look much like "twenty and twenty reversed".

<p>
While fully developed cuneiform numbers used a place value system,
the radix point was not explicitly marked.
The present proposal is for sexagesimal representation of integers,
and hence needs no radix point.
This view is consistent with current C++ practice,
which does not permit
floating-point values in bases other than decimal.
</p>

<p>
Finally, we leave out the forms for higher-order digits,
as there is no present need to standardize them.
</p>

<h2>Wording</h2>

<p>
All changes apply to 2.13.1 Integer literals [lex.icon].
</p>

<p>
Edit the grammar as follows:
</p>

<blockquote>
<dl>
<dt><var>integer-literal:</var></dt>
<dd><var>decimal-literal</var>
    <var>integer-suffix<sub>opt</sub></var></dd>
<dd><var>octal-literal</var>
    <var>integer-suffix<sub>opt</sub></var></dd>
<dd><var>hexadecimal-literal</var>
    <var>integer-suffix<sub>opt</sub></var></dd>
<dd><ins><var>sexagesimal-literal</var>
    <var>integer-suffix<sub>opt</sub></var></ins></dd>

<dt><ins><var>sexagesimal-literal:</var></ins></dt>
<dd><ins><var>sexagesimal-literal<sub>opt</sub></var>
    <var>sexagesimal-tens</var>
    <var>sexagesimal-units<sub>opt</sub></var></ins></dd>
<dd><ins><var>sexagesimal-upper<sub>opt</sub></var>
    <var>sexagesimal-units</var></ins></dd>
<dd><ins><var>sexagesimal-literal<sub>opt</sub></var>
    <var>sexagesimal-zero</var></ins></dd>

<dt><ins><var>sexagesimal-upper:</var></ins></dt>
<dd><ins><var>sexagesimal-literal<sub>opt</sub></var>
    <var>sexagesimal-tens</var>
    <var>sexagesimal-units</var></ins></dd>
<dd><ins><var>sexagesimal-literal<sub>opt</sub></var>
    <var>sexagesimal-tens</var>
    <var>sexagesimal-colon</var></ins></dd>
<dd><ins><var>sexagesimal-upper<sub>opt</sub></var>
    <var>sexagesimal-units</var></ins></dd>
<dd><ins><var>sexagesimal-literal<sub>opt</sub></var>
    <var>sexagesimal-zero</var></ins></dd>
</blockquote>

<p>
Add the following character rules.
Note that the glyph column will render improperly
(e.g. question marks or bracket-enclosed Arabic digits)
if your browser does not implement the cuneiform glyphs.
The glyphs appear in references [10] and [11].
</p>

<blockquote>
<table>
<tr>
<th>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
<th align=left>extended<br>character</th>
<th align=left>numeric<br>value</th>
<th align=left>HTML<br>glyph</th>
<th align=left>graphical<br>form</th>
</tr>

<tr>
<td colspan=4><var>sexagesimal-units:</var> one of</td>
</tr>
<tr>
<td></td>
<td><code>\U00012079</code></td>
<td align=center>1</td>
<td>&#x12079;</td>
<td>1 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/One.gif" height=12 width=9></td>
</tr>
<tr>
<td></td>
<td><code>\U0001222B</code></td>
<td align=center>2</td>
<td>&#x1222B;</td>
<td>2 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Two.gif" height=12 width=15></td>
</tr>
<tr>
<td></td>
<td><code>\U00012408</code></td>
<td align=center>3</td>
<td>&#x12408;</td>
<td>3 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Three.gif" height=12 width=21></td>
</tr>
<tr>
<td></td>
<td><code>\U00012409</code></td>
<td align=center>4</td>
<td>&#x12409;</td>
<td>2/2</td>
</tr>
<tr>
<td></td>
<td><code>\U0001243C</code></td>
<td align=center>4</td>
<td>&#x1243C;</td>
<td>3/1 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Four.gif" height=18 width=21></td>
</tr>
<tr>
<td></td>
<td><code>\U0001243E</code></td>
<td align=center>4</td>
<td>&#x1243E;</td>
<td>2/1+1</td>
</tr>
<tr>
<td></td>
<td><code>\U0001243F</code></td>
<td align=center>4</td>
<td>&#x1243F;</td>
<td>1/1+2</td>
</tr>
<tr>
<td></td>
<td><code>\U0001240A</code></td>
<td align=center>5</td>
<td>&#x1240A;</td>
<td>3/2 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Five.gif" height=17 width=21></td>
</tr>
<tr>
<td></td>
<td><code>\U0001240B</code></td>
<td align=center>6</td>
<td>&#x1240B;</td>
<td>3/3 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Six.gif" height=17 width=21></td>
</tr>
<tr>
<td></td>
<td><code>\U0001240C</code></td>
<td align=center>7</td>
<td>&#x1240C;</td>
<td>4/3</td>
</tr>
<tr>
<td></td>
<td><code>\U00012442</code></td>
<td align=center>7</td>
<td>&#x12442;</td>
<td>3/3/1 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Seven.gif" height=24 width=21></td>
</tr>
<tr>
<td></td>
<td><code>\U00012443</code></td>
<td align=center>7</td>
<td>&#x12443;</td>
<td>3/3+1</td>
</tr>
<tr>
<td></td>
<td><code>\U0001240D</code></td>
<td align=center>8</td>
<td>&#x1240D;</td>
<td>4/4</td>
</tr>
<tr>
<td></td>
<td><code>\U00012444</code></td>
<td align=center>8</td>
<td>&#x12444;</td>
<td>3/3/2 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Eight.gif" height=23 width=21></td>
</tr>
<tr>
<td></td>
<td><code>\U0001240E</code></td>
<td align=center>9</td>
<td>&#x1240E;</td>
<td>4/4+1</td>
</tr>
<tr>
<td></td>
<td><code>\U00012446</code></td>
<td align=center>9</td>
<td>&#x12446;</td>
<td>3/3/3 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Nine.gif" height=23 width=21></td>
</tr>

<tr><td colspan=4><var>sexagesimal-tens:</var> one of</td>
</tr>
<tr>
<td></td>
<td><code>\U0001230B</code></td>
<td align=center>10</td>
<td>&#x1230B;</td>
<td>1 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Ten.gif" height=13 width=8></td>
</tr>
<tr>
<td></td>
<td><code>\U00012310</code></td>
<td align=center>20</td>
<td>&#x12310;</td>
<td>properly 2 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Twenty.gif" height=13 width=12>, but substituting 1/1+1/1 reversed</td>
</tr>
<tr>
<td></td>
<td><code>\U0001230D</code></td>
<td align=center>30</td>
<td>&#x1230D;</td>
<td>3 <img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Thirty.gif" height=13 width=16></td>
</tr>
<tr>
<td></td>
<td><code>\U0001240F</code></td>
<td align=center>40</td>
<td>&#x1240F;</td>
<td>2/2 (also
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Forty.gif" height=22 width=16>)</td>
</tr>
<tr>
<td></td>
<td><code>\U00012410</code></td>
<td align=center>50</td>
<td>&#x12410;</td>
<td>3/2 (also
<img src="http://it.stlawu.edu/~dmelvill/mesomath/pix/Fifty.gif" height=23 width=15>)</td>
</tr>

<tr>
<td colspan=4><var>sexagesimal-colon:</var></td>
</tr>
<tr>
<td></td>
<td><code>\U00012471</code></td>
<td align=center>0</td>
<td>&#x12471;</td>
<td>1/1 vertical</td>
</tr>

<tr>
<td colspan=4><var>sexagesimal-zero:</var></td>
</tr>
<tr>
<td></td>
<td><code>\U00012472</code></td>
<td align=center>0</td>
<td>&#x12472;</td>
<td>1/1 diagonal</td>
</tr>

</table>
</blockquote>

<p>
Append the following to paragraph 1.
</p>

<blockquote>
A <dfn>sexagesimal</dfn> integer literal (base sixty)
consists of a sequence of sexagesimal digits.
</blockquote>

<h2>References</h2>

<ol>
<li>
"About Cuneiform Writing...",
<a href="http://www.upenn.edu/museum/Games/cuneiform.html">
http://www.upenn.edu/museum/Games/cuneiform.html</a>
</li>
<li>
Duncan J. Melville, "Cuneiform numbers",
<a href="http://it.stlawu.edu/~dmelvill/mesomath/Numbers.html">
http://it.stlawu.edu/~dmelvill/mesomath/Numbers.html</a>
</li>
<li>
"Chapter 1 History of Numbers",
"Section 1.5 The Babylonians",
"Lesson 3 - Larger Numbers",
<a href="http://mathematics.gulfcoast.edu/mgf1107ll/Chap1Sec5Lesson3.htm">
http://mathematics.gulfcoast.edu/mgf1107ll/Chap1Sec5Lesson3.htm</a>
</li>
<li>
"Large Cuneiform Numbers",
<a href="http://www.mathematicsmagazine.com/7-2003/Cueniform_No_7_2003.htm">
http://www.mathematicsmagazine.com/7-2003/Cueniform_No_7_2003.htm</a>
</li>
<li>
O. Neugebauer,
"On a Special Use of the Sign "Zero" in Cuneiform Astronomical Texts",
<a href="http://links.jstor.org/sici?sici=0003-0279(194112)61:4%3C213:OASUOT%3E2.0.CO;2-2">
http://links.jstor.org/
sici?sici=0003-0279(194112)61:4%3C213:OASUOT%3E2.0.CO;2-2</a>
</li>
<li>
ISO/IEC JTC1/SC2/WG2,
<a href="http://std.dkuug.dk/JTC1/SC2/WG2/">
http://std.dkuug.dk/JTC1/SC2/WG2/</a>
</li>
<li>
ISO 10646 2003 Amd 2 2006(E),
<a href="http://standards.iso.org/ittf/PubliclyAvailableStandards/c041419_ISO_IEC_10646_2003_Amd_2_2006(E).zip">
http://standards.iso.org/ittf/
PubliclyAvailableStandards/c041419_ISO_IEC_10646_2003_Amd_2_2006(E).zip</a>
</li>
<li>
Unicode,
<a href="http://www.unicode.org/">
http://www.unicode.org/</a>
</li>
<li>
Unicode 5.0 Chapter 14 Archaic Scripts,
<a href="http://www.unicode.org/versions/Unicode5.0.0/ch14.pdf">
http://www.unicode.org/versions/Unicode5.0.0/ch14.pdf</a>
</li>
<li>
Unicode Cuneiform,
<a href="http://www.unicode.org/charts/PDF/U12000.pdf">
http://www.unicode.org/charts/PDF/U12000.pdf</a>
</li>
<li>
Unicode Cuneiform Numbers and Punctuation,
<a href="http://www.unicode.org/charts/PDF/U12400.pdf">
http://www.unicode.org/charts/PDF/U12400.pdf</a>
</li>
<li>
Wikipedia: Unicode Cuneiform,
<a href="http://en.wikipedia.org/wiki/Unicode_cuneiform">
http://en.wikipedia.org/wiki/Unicode_cuneiform</a>
</li>
<li>
Wikipedia: List of Cuneiform Signs,
<a href="http://en.wikipedia.org/wiki/List_of_cuneiform_signs">
http://en.wikipedia.org/wiki/List_of_cuneiform_signs</a>
</li>
</ol>

</body></html>
