simon-git: spigot (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sat Aug 31 13:42:28 BST 2019


TL;DR:
  4412fd1 Fix compile warning in match_dyadic_rationals.
  e8f3c5e Core1: move matrix initialisation into the constructor.
  28a4e31 Add 'probit' as yet another name for invPhi.
  d0d2a16 Rename the Bessel function J to BesselJ.
  3421a32 Implement the 'modified Bessel function' I_alpha.
  4de22ff Centralise rounding modes and their names into a new header.
  6bc333e Internal round-to-integer function supporting all rmodes.
  1791406 Expose a full set of round/frac/remainder functions.

Repository:     https://git.tartarus.org/simon/spigot.git
On the web:     https://git.tartarus.org/?p=simon/spigot.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2019-08-31 13:42:28

commit 4412fd1c0b2d28da8784ca8fbac19852b32a7f26
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=4412fd1c0b2d28da8784ca8fbac19852b32a7f26;hp=9658af8a95844a2873ec37b2add908b5d4414e33
Author: Simon Tatham <anakin at pobox.com>
Date:   Fri Aug 30 19:28:17 2019 +0100

    Fix compile warning in match_dyadic_rationals.
    
    Copy-and-paste error gave the templated set_dbits a spurious non-void
    return type, which was never used.

 spigot.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit e8f3c5ecb1abc134a53e22974983372186e372cb
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=e8f3c5ecb1abc134a53e22974983372186e372cb;hp=4412fd1c0b2d28da8784ca8fbac19852b32a7f26
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Aug 28 20:23:53 2019 +0100

    Core1: move matrix initialisation into the constructor.
    
    That way, if the client of a Core1 calls premultiply() before the
    first refine(), the matrix it premultiplied in won't get thrown away
    when refine() subsequently goes into the if (!started) clause.

 spigot.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

commit 28a4e318fcb9a3f42282209d98087a4e5a014507
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=28a4e318fcb9a3f42282209d98087a4e5a014507;hp=e8f3c5ecb1abc134a53e22974983372186e372cb
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Aug 27 21:17:13 2019 +0100

    Add 'probit' as yet another name for invPhi.
    
    Found on Wikipedia: https://en.wikipedia.org/wiki/Probit

 erf.cpp                   | 1 +
 manual.but                | 7 ++++---
 python-doc/api.rst        | 2 ++
 python-module/__init__.py | 2 ++
 python-module/testsuite   | 1 +
 5 files changed, 10 insertions(+), 3 deletions(-)

commit d0d2a16b9c18e3469c287ee4c60651ee88c9d360
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=d0d2a16b9c18e3469c287ee4c60651ee88c9d360;hp=28a4e318fcb9a3f42282209d98087a4e5a014507
Author: Simon Tatham <anakin at pobox.com>
Date:   Sat Aug 31 12:42:53 2019 +0100

    Rename the Bessel function J to BesselJ.
    
    I've decided the previous name was too short and nonspecific.

 hypergeom.cpp             |  2 +-
 manpage.but               |  2 +-
 manual.but                |  2 +-
 python-doc/api.rst        |  2 +-
 python-module/__init__.py |  4 +--
 python-module/testsuite   |  2 +-
 test.sh                   | 88 +++++++++++++++++++++++------------------------
 7 files changed, 51 insertions(+), 51 deletions(-)

commit 3421a32e0725911d9f23c6cd2974c51be459b4f9
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=3421a32e0725911d9f23c6cd2974c51be459b4f9;hp=d0d2a16b9c18e3469c287ee4c60651ee88c9d360
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Aug 27 19:14:55 2019 +0100

    Implement the 'modified Bessel function' I_alpha.
    
    Mathematically, this is obtained by evaluating J_alpha at an imaginary
    instead of real point, and then scaling by i^{-alpha} to bring the
    result back to the positive real axis.
    
    Computationally, it's just a matter of flipping the sign of x^2 in the
    argument to the hypergeometric function we use to evaluate BesselJ. I
    didn't do this originally, because although it looks easy, it would
    have been hard to be sure of it working before I implemented the
    generalised derivative-bounding system for Hg in commit 561484def. But
    now that system is in place, it really is as simple as saying 'this
    function is expressible as an instance of Hg, I have code that
    evaluates Hg, done'.
    
    BesselI is also a good test for an exact real system, because the
    number whose continued fraction coefficients go 0;1,2,3,4,5,... is
    expressible as a ratio of two particular values of it. (Mathworld
    calls this the 'Continued Fraction Constant'.) I've added that ratio
    as a test case, along with its decimal form (checked against OEIS).

 hypergeom.cpp             | 95 ++++++++++++++++++++++++++++-------------------
 manpage.but               |  5 ++-
 manual.but                |  7 ++++
 python-doc/api.rst        |  2 +
 python-module/__init__.py | 21 +++++++++++
 python-module/testsuite   |  1 +
 test.sh                   |  7 ++++
 7 files changed, 98 insertions(+), 40 deletions(-)

commit 4de22ff8362261fc61f888ac3ac5dc7ee8e6273a
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=4de22ff8362261fc61f888ac3ac5dc7ee8e6273a;hp=3421a32e0725911d9f23c6cd2974c51be459b4f9
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Aug 28 20:05:10 2019 +0100

    Centralise rounding modes and their names into a new header.
    
    The new rmode.h defines list macros for the rounding-mode enumeration
    itself, and for the various short abbreviations like 'rne' and 'ru'.
    Several places in the code that repeated those lists now work by
    invoking the list macros. In particular, the C++ side of the Python
    module now uses the list macro of abbreviations to generate a dict of
    them to pass to __init__.py, which means the __format__ method can use
    that dict in place of the previous repetition.
    
    This is partly groundwork for using the same lists in yet more places
    in upcoming commits. But also, centralising the list of abbreviations
    fixes some API/CLI inconsistencies, because it turns out I didn't
    think of the same set of synonyms everywhere. For example, in some
    places, I used 'ri' for 'round towards (the nearer) infinity', and in
    others, 'ra' for 'round away from zero'; in some places I made 'rp'
    and 'rm' (for 'round towards plus/minus infinity') synonyms for 'ru'
    and 'rd', and in others, I forgot. Now the same complete set of
    abbreviations should be available everywhere: on the command line, in
    the Python __format__ method, and in the Python short-named constants
    like spigot.RNA. And the same set will now be reliably available in
    any other context where I reuse that list macro.

 baseout.cpp                |  1 +
 baseout.h                  | 32 ----------------------------
 main.cpp                   | 32 ++++++++++------------------
 python-doc/api.rst         | 40 +++++++++++++++++------------------
 python-module/__init__.py  | 34 ++++++++----------------------
 python-module/internal.cpp |  9 ++++++++
 python-module/testsuite    |  6 ++++++
 rmode.h                    | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 sources.mk                 |  2 +-
 spigot.h                   |  5 +++++
 10 files changed, 114 insertions(+), 99 deletions(-)

commit 6bc333eea4549b7079c5a71eda08c8be6ed03d27
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=6bc333eea4549b7079c5a71eda08c8be6ed03d27;hp=4de22ff8362261fc61f888ac3ac5dc7ee8e6273a
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Aug 28 20:05:26 2019 +0100

    Internal round-to-integer function supporting all rmodes.
    
    So far, not used for anything overt: it's just streamlining things
    behind the scenes. The floor, ceil, frac and remainder functions are
    all now implemented in terms of this general facility, and it's also
    taken over from the previous cumbersome method that Python was using
    to implement its Spigot.to_int() method.

 funcs.h                    |   2 +
 python-module/__init__.py  |   3 +-
 python-module/internal.cpp |  24 +++++
 unary.cpp                  | 215 ++++++++++++++++++++++++++++++++++++---------
 4 files changed, 201 insertions(+), 43 deletions(-)

commit 1791406a56d56a45b8d29a1588f338126ca7c277
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=1791406a56d56a45b8d29a1588f338126ca7c277;hp=6bc333eea4549b7079c5a71eda08c8be6ed03d27
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Aug 29 18:22:21 2019 +0100

    Expose a full set of round/frac/remainder functions.
    
    Thanks to Stu Brady for giving me this idea: we were discussing FP
    remainders in general, and he pointed out that all the commonly used
    semantics can be regarded as computing n - d*round(n/d), where 'round'
    is interpreted according to a particular IEEE 754 rounding mode. The
    IEEE 754 remainder function itself uses IEEE round-to-nearest/even;
    the C fmod() function, which returns a remainder of the same sign as
    the _numerator_, can be regarded as computing exactly the same
    operation except using round-toward-zero; and the operation that
    spigot implements as the 'mod' operator (also seen under the name
    'OpFMod' in SPIR-V), which returns a remainder of the same sign as the
    _denominator_, is yet another case of the same construction using
    round-down.
    
    spigot, of course, implements not only those modes but many others,
    such as round-away-from-zero, and round-to-nearest with assorted other
    tiebreaking rules. So it seems like a no-brainer that the spigot
    expression language should provide a full set of functions that
    operate in _all_ of those rounding modes.
    
    Hence, here, I implement round_rXX() to round to an integer;
    fracpart_rXX() to compute the residual error from that (i.e. it
    returns x - round_rXX(x)); and remainder_rXX which is the complete
    family of functions of the form described above.
    
    While I'm here, I've also provided fmod() as a synonym for
    remainder_rz(), because that's what C calls it and it seemed silly not
    to provide it under such a well-known name.
    
    On the Python side, all of these new functions are exposed under the
    same names they have in the spigot expression language, but also, I've
    provided round(), fracpart() and remainder() which take the rounding
    mode as an extra integer-constant argument, since the Python module
    exposes the enumerated constants anyway.

 manpage.but               |  23 +++++
 manual.but                |  26 ++++++
 python-doc/api.rst        |  94 +++++++++++++++++++
 python-doc/conf.py        |  11 +++
 python-module/__init__.py |  46 ++++++++++
 python-module/testsuite   |  61 +++++++++++-
 test.sh                   | 230 ++++++++++++++++++++++++++++++++++++++++++++++
 unary.cpp                 |  72 ++++++++-------
 8 files changed, 527 insertions(+), 36 deletions(-)



More information about the tartarus-commits mailing list