summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>1999-06-11 18:31:00 (GMT)
committerFred Drake <fdrake@acm.org>1999-06-11 18:31:00 (GMT)
commit1739d2f9eebb857778187abe2943582ee37b23e1 (patch)
treef5d2bbc355f4e255146e2f8452640b1459d6292b
parent2f9790195b2b47466cdd644556aa36fdf83bd5ab (diff)
downloadcpython-1739d2f9eebb857778187abe2943582ee37b23e1.zip
cpython-1739d2f9eebb857778187abe2943582ee37b23e1.tar.gz
cpython-1739d2f9eebb857778187abe2943582ee37b23e1.tar.bz2
Documentation for the fpformat module by Moshe Zadka
<mzadka@geocities.com>.
-rw-r--r--Doc/lib/libfpformat.tex51
1 files changed, 51 insertions, 0 deletions
diff --git a/Doc/lib/libfpformat.tex b/Doc/lib/libfpformat.tex
new file mode 100644
index 0000000..94e434c
--- /dev/null
+++ b/Doc/lib/libfpformat.tex
@@ -0,0 +1,51 @@
+\section{\module{fpformat} ---
+ Floating point conversions}
+
+\declaremodule{standard}{fpformat}
+\sectionauthor{Moshe Zadka}{mzadka@geocities.com}
+\modulesynopsis{General floating point formatting functions.}
+
+
+The \module{fpformat} module defines functions for dealing with
+floating point numbers representations in 100\% pure
+Python. \strong{Note:} This module is unneeded: everything here could
+be done via the \code{\%} string interpolation operator.
+
+The \module{fpformat} module defines the following functions and an
+exception:
+
+
+\begin{funcdesc}{fix}{x, digs}
+Format \var{x} as \code{[-]ddd.ddd} with \var{digs} digits after the
+point and at least one digit before.
+If \code{\var{digs} <= 0}, the decimal point is suppressed.
+
+\var{x} can be either a number or a string that looks like
+one. \var{digs} is an integer.
+
+Return value is a string.
+\end{funcdesc}
+
+\begin{funcdesc}{sci}{x, digs}
+Format \var{x} as \code{[-]d.dddE[+-]ddd} with \var{digs} digits after the
+point and exactly one digit before.
+If \code{\var{digs} <= 0}, one digit is kept and the point is suppressed.
+
+\var{x} can be either a real number, or a string that looks like
+one. \var{digs} is an integer.
+
+Return value is a string.
+\end{funcdesc}
+
+\begin{excdesc}{NotANumber}
+Exception raised when a string does not look like a number when the
+documentation says it should.
+\end{excdesc}
+
+Example:
+
+\begin{verbatim}
+>>> import fpformat
+>>> fpformat.fix(1.23, 1)
+'1.2'
+\end{verbatim}