\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#299: Add isqrt() Math Function}
\date{November 24, 2006}
\author{Kevin B. Kenny}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#299}&\textbf{Add isqrt() Math Function}\\\hline
Author&

Kevin B. Kenny \tipmail{kennykb}{acm.org}
\\
Created&Friday, \(\text{24}^{\text{th}}\) November 2006\\
Type&Project\\
Tcl Version&\(8.5\)\\
State&Final\\
Vote&Done\\
Version&\tipversion$Revision: 1.3 $\\
Keywords&Tcl, expression, integer, square root\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This TIP proposes a new \textbf{expr} math function \textbf{isqrt()}.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Background}

With the advent of large integers, Tcl supports taking the square roots of arguments that lie outside the native floating-point range of the machine. The square roots are returned as floating point numbers if possible. This behaviour is correct when floating-point calculations are intended. There are times, however, when an arbitrary-precision square root is wanted. This root cannot be obtained by evaluating \textit{entier(sqrt(\$n))}, because \textit{sqrt(\$n)} has already lost precision.

\section{Proposed Change}

This TIP proposes adding a new math function, \textit{isqrt(\$n)}, that will return the integer part of the square root of \textit{\$n} to arbitrary precision. The argument \textit{\$n} must be numeric and non-negative; it may be either integer or floating-point.

\section{Reference Implementation}

Tcl Feature Request \#1602534 contains a complete reference implementation for the \textit{isqrt} function.

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
