From 59d321e899ed5a0ba1607c5c2ffc39192feea615 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 7 Jan 2017 23:38:44 +0000 Subject: xint (8jan17) git-svn-id: svn://tug.org/texlive/trunk@42892 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/generic/xint/xint.dtx | 2479 +++++++++++++----------- Master/texmf-dist/source/generic/xint/xint.ins | 4 +- 2 files changed, 1370 insertions(+), 1113 deletions(-) (limited to 'Master/texmf-dist/source/generic/xint') diff --git a/Master/texmf-dist/source/generic/xint/xint.dtx b/Master/texmf-dist/source/generic/xint/xint.dtx index 436aaa3fdbc..b41bba65760 100644 --- a/Master/texmf-dist/source/generic/xint/xint.dtx +++ b/Master/texmf-dist/source/generic/xint/xint.dtx @@ -3,28 +3,28 @@ % Extract all files via "etex xint.dtx" and do "make help" % or follow instructions from extracted README.md. %<*dtx> -\def\xintdtxtimestamp {Time-stamp: <22-12-2016 at 22:59:29 CET>} +\def\xintdtxtimestamp {Time-stamp: <06-01-2017 at 22:41:03 CET>} % %<*drv> %% --------------------------------------------------------------- -\def\xintdocdate {2016/12/22} -\def\xintbndldate{2016/12/22} -\def\xintbndlversion {1.2j} +\def\xintdocdate {2017/01/06} +\def\xintbndldate{2017/01/06} +\def\xintbndlversion {1.2k} % %% README %% CHANGE LOG -%% xint 1.2j -%% 2016/12/22 +%% xint 1.2k +%% 2017/01/06 % -% Source: xint.dtx 1.2j 2016/12/22 (doc 2016/12/22) +% Source: xint.dtx 1.2k 2017/01/06 (doc 2017/01/06) % Author: Jean-Francois Burnol % Info: Expandable operations on big integers, decimals, fractions % License: LPPL 1.3c % %<*!readme&!changes&!dohtmlsh&!dopdfsh&!makefile> %% --------------------------------------------------------------- -%% The xint bundle 1.2j 2016/12/22 -%% Copyright (C) 2013-2016 by Jean-Francois Burnol +%% The xint bundle 1.2k 2017/01/06 +%% Copyright (C) 2013-2017 by Jean-Francois Burnol %%% xintkernel: Paraphernalia for the xint packages %%% xinttools: Expandable and non-expandable utilities %%% xintcore: Expandable arithmetic on big integers @@ -66,11 +66,11 @@ variables: Float computations are possible at an adjustable precision (default 16). - \xintthefloatexpr 123456789^1000.5\relax - -However, only integer and half-integer exponents are currently allowed: -only the `sqrt` is implemented for floating point numbers. It achieves -correct rounding in arbitrary precision. + \xintDigits:=48;\xintthefloatexpr 123456789^1000.5\relax + ->3.63692761822782679930738270515740797370813691938e8095 + +However, only integer and half-integer exponents are currently allowed. +The `sqrt` operation achieves correct rounding in arbitrary precision. It is possible to use the package with Plain as well as with LaTeX. @@ -218,7 +218,7 @@ License =======
-Copyright (C) 2013-2016 by Jean-Francois Burnol +Copyright (C) 2013-2017 by Jean-Francois Burnol This Work may be distributed and/or modified under the conditions of the LaTeX Project Public License version 1.3c. @@ -243,6 +243,64 @@ Makefile.mk.
%
-------------------------------------------------------- %<*changes>------------------------------------------------------- +`1.2k (2017/01/06)` +---- + +### Incompatible changes + + - macro `\xintFloat` which rounds its input to a floating point number + does _not_ print anymore `10.0...0eN` to signal an upwards rounding + to the next power of ten. The mantissa has in all cases except the + zero input exactly one digit before the decimal mark. + + - some floating point computations may differ in the least significant + digits, due to a change in the rounding algorithm applied to macro + arguments expressed as fractions and to an improvement in precision + regarding half-integer powers in expressions. See next. + +### Improvements and new features + + - the initial rounding to the target precision `P` which is applied by + the floating point macros from **xintfrac** to their arguments + achieves the _exact (aka correct) rounding_ even for inputs which are + fractions with more than `P+2` digits in their numerators and + denominators (`>1`.) Hence the computed values depend only on the + arguments as rational numbers and not upon their representatives. + This is not relevant to _expressions_ (**xintexpr**), because the + `\xintfloatexpr` parser sees there `/` as an operator and does not + (apart from special constructs) get to manipulate fractions as such. + + - `\xintnewdummy` is public interface to a `1.2e` macro which serves to + declare any given catcode 11 character as a dummy variable for + expressions (**xintexpr**). This is useful for Unicode engines (the + Latin letters being already all pre-declared as dummy variables.) + + - added `\xintiSqrtR`, there was only `\xintiiSqrtR` alongside + `\xintiSqrt` and `\xintiiSqrt` (**xint**). + + - added non public `\xintLastItem:f:csv` to **xinttools** for faster + `last()` function, and improved `\xintNewExpr` compatibility. Also + `\xintFirstItem:f:csv`. + +### Bug fixes + + - the `1.2f` half-integer powers computed within `\xintfloatexpr` had a + silly rounding to the target precision just _before_ the final + square-root extraction, thus possibly losing some precision. The + `1.2k` implementation keeps guard digits for this final square root + extraction. As for integer exponents, it is guaranteed that the + computed value differs from the exact one by less than `0.52 ulp` + (for inputs having at most `\xinttheDigits` digits.) + + - more regressions from `1.2i` were fixed: `\xintLen` (**xint**, + **xintfrac**) and `\xintDouble` (**xintcore**) had forgotten that + their argument was allowed to be negative. A regression test suite is + now in place and is being slowly expanded to cover more macros. + + - `\xintiiSquareRoot{0}` now produces `{1}{1}`, which fits better the + general documented behaviour of this macro than `11`. + + `1.2j (2016/12/22)` ---- @@ -1952,6 +2010,8 @@ dvipdfmx CHANGES.dvi \DeclareUnicodeCharacter {03B4}{\ensuremath{\delta}}% \fi +\DeclareUnicodeCharacter{03BE}{\ensuremath{\xi}} + \usepackage{multicol} \usepackage{geometry} @@ -2799,6 +2859,7 @@ pdfpagemode=UseOutlines} \xintverbosetrue + \begin{document}\thispagestyle{empty}% \ttzfamily already done \pdfbookmark[1]{Title page}{TOP} % \makeatletter % @ n'est plus actif dans dtx 1.1, ouf! @@ -3162,8 +3223,8 @@ This is release \expandafter|\xintbndlversion|. \begin{enumerate} \item |exp|, |cos|, |sin|, etc... are \emph{yet to be implemented}, \item |NaN|, |+Infty|, |-Infty|, etc... are \emph{yet to be implemented}, -\item powers work currently only with integral \emph{or also - half-integral\NewWith{1.2f}} exponents (but the latter only for float +\item powers work currently only with integral and + half-integral exponents (but the latter only for float expressions), \item \xintname can handle numbers with thousands of digits, but execution times limit the practical range to a few hundreds (if many such computations @@ -3690,45 +3751,32 @@ If you have |xint.dtx|, no internet access and can not use the Makefile method: |etex xint.dtx| extracts all files and among them the |README| as a file with name |README.md|. Further help and options will be found therein. - \subsection {Changes} -The detailed cumulative change log since the initial release is in files -|CHANGES.html| (available on internet via -\href{http://mirrors.ctan.org/macros/generic/xint/CHANGES.html}{this link}). -You can also access it as well as |CHANGES.pdf| locally from typing |texdoc -l -xint| on the command line. - This is release \expandafter|\xintbndlversion| of \expandafter|\xintbndldate|. -Releases |1.2i| and |1.2j| brought principally across-the-board speed -improvements to various token or digits handling routines, and refactored the -documentation somewhat. See |CHANGES.html| or |CHANGES.pdf| for more. +The \xintfracname floating point macros since |1.2f| round their arguments to +the target precision |P| before further processing. This rounding is now exact +(aka correct) in all cases, even with fractions having long numerators and +denominators. -The last major release was |1.2 (2015/10/10)|. It came with a complete rewrite -of the core arithmetic routines. The efficiency for numbers with less than -$20$ or $30$ digits was slightly compromised (for addition/subtraction) but it -got increased for bigger numbers. For multiplication and division the gains were -there for almost all sizes, and became quite noticeable for numbers with -hundreds of digits. The allowable inputs are constrained to have less than -about $19950$ digits ($19968$ for addition, $19959$ for multiplication). +This change has little influence on float expressions, as the +\csbxint{floatexpr} parser handles there the |/| symbol as an operator hence +it does not (except for special constructs) get to see fractions as such. -Among subsequent evolution, we mention here some changes with |1.2f -(2016/03/12)| regarding floating point numbers: -\begin{enumerate}[nosep] - \item functions |factorial|, |binomial|, |pfactorial|. - \item more precise discussion of floating point issues in - \autoref{ssec:floatingpoint}, but the coverage by - \xintfracname of floating point operations is yet to be substantially - extended. - \item the float macros for addition, subtraction, multiplication, division - now first round their two operands to P significant places - (not P+2 as earlier) before doing the actual computation (P is the asked - for precision or \csbxint{theDigits}). The same applies to the float power - and square root operations. - \item \csbxint{FloatSqrt} achieves \emph{correct rounding} in - arbitrary precision. -\end{enumerate} +Half-integer powers |A^x| (only available in float expressions, not via +macros) proceed by an integer power and then a square-root extraction: the +|1.2f| implementation did the latter on an already rounded value, |1.2k| keeps +some of the guard digits to make the computed value |Z| closer to the exact +one: a difference of less than |0.52 ulp(Z)| is guaranteed in all cases. + +Macro |\xintnewdummy| is made a public one, it serves to declare additional +letters as dummy variables in expressions. This is for Unicode engines, +mainly, as all Latin letters are already predefined to act as such. + +See |CHANGES.html| or |CHANGES.pdf| for more (|texdoc --list xint| or on the +internet via +\href{http://mirrors.ctan.org/macros/generic/xint/CHANGES.html}{this link}.) @@ -3893,29 +3941,10 @@ when using variables. -\myitem{9} The power operator |^|, or equvalently |**|. It is left associative: - {\restoreMicroFont|\xinttheiexpr 2^2^3\relax|} evaluates to \xinttheiexpr - 2^2^3\relax, not \xinttheiexpr 2^(2^3)\relax. Note that if the float - precision is too low, iterated powers within |\xintfloatexpr..\relax| may - fail: for example with the default setting |(1+1e-8)^(12^16)| will be - computed with |12^16| approximated from its $16$ most significant digits - but it has $18$ digits (\dtt{={\xintiiPow{12}{16}}}), hence the result is - wrong: - \begingroup - % - \leftedline{$\np{\xintthefloatexpr (1+1e-8)^(12^16)\relax }$} - % - One should code - % - \leftedline{\restoreMicroFont|\xintthe\xintfloatexpr (1+1e-8)^\xintiiexpr 12^16\relax - \relax|} - % - to obtain the correct floating point evaluation - % - \leftedline{$\np{1.00000001}^{12^{16}}\approx\np{\xintthefloatexpr - (1+1e-8)^\xintiiexpr 12^16\relax\relax }$} - % - \endgroup + \myitem{9} The power operator |^|, or equvalently |**|. It is left + associative: {\restoreMicroFont|\xinttheiexpr 2^2^3\relax|} evaluates to + \xinttheiexpr 2^2^3\relax, not \xinttheiexpr 2^(2^3)\relax. See + \csbxint{FloatPower} for additional information. Also at this level the list operators |^[|, |**[|, |]^|, and |]**|. @@ -4048,39 +4077,81 @@ Miscellaneous notes: % attention que listparindent n'est apparemment pas hérité, faut le refaire listparindent=\leftmarginiii] \item[functions with a single (numeric) argument:]\mbox{} -\begin{description} - \myitem{num} truncates to the nearest integer (truncation towards zero). +\begin{description}[listparindent=\leftmarginiii]% il faut le répéter! + \myitem{num} truncates to the nearest integer (truncation towards zero). It + has the same sign as |x|, except of course with |-1