simon-git: spigot (master): Simon Tatham

Commits to Tartarus CVS repository. tartarus-commits at lists.tartarus.org
Wed Dec 31 17:43:30 GMT 2014


TL;DR:
  a576256 Massive refactoring of spigot.cpp.
  d429719 Replace Gosper with a new core for basic arithmetic.
  a8ab5bd Fix exactness hazards in exp,sincos range reduction.
  e330f75 Introduce a misc.cpp source file.
  252ed55 Factor out the parallel sign test from MonotoneInverter.
  cde233c Rewrite spigot_atan2 without exactness hazards.
  c3a53a4 Nail down the semantics of bigint_approxlog2.
  bb5ca10 Rewrite log's range reduction without exactness hazards.
  f008d6c Invent BracketingGenerator, and use it for inversion bounds.
  09d9ade Stop using continued fractions in atan range reducer.
  666e217 Fix broken Newton-Raphson in spigot_erfinv.
  a1659e8 Add a BinaryIntervalSource class.
  e1f3893 Rewrite MonotoneHelper without exactness hazards.
  99fe0b5 Fix GammaWrapper not to have exactness hazards.
  b227227 Reorganise spigot_pow a little bit.
  bd40ce7 Fix monotonicity failure at cos(0).
  2e4d127 Fix abs() to not have an exactness hazard.
  a018646 Fix the remainder functions to not use continued fractions.
  729fe4b Expose the premultiply() method in StaticGenerator.
  c8b3330 Complete rewrite of the SqrtReal class.
  ebc23f0 Rewrite CbrtReal as well.
  f919f9a Update docs for all the fixed exactness hazards.
  eec8f3b Update the references section.
  ef1491e Fix logic errors in bi_internal's left shift.

Repository:     git://git.tartarus.org/simon/spigot.git
On the web:     http://tartarus.org/~simon-git/gitweb/?p=spigot.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2014-12-31 17:43:30

commit a576256ae3c80229cf157781a2395c65cb160b51
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=a576256ae3c80229cf157781a2395c65cb160b51;hp=6f4db186491273b9762906c7750458026fd28117
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 07:43:27 2014 +0000

    Massive refactoring of spigot.cpp.
    
    The previous setup, with a single class called Spigot that did
    everything from matrix-generation to producing output in various
    formats, was poorly thought out, confusing, badly documented in terms
    of which combinations of methods it made sense to use on the same
    object, and insufficiently flexible for some plans I have for the
    future.
    
    I've replaced it with a three-tier system of Sources, Cores and
    Generators, and moved all the various methods into only a subset of
    those classes, so that now the compiler will automatically check that
    you aren't calling a silly combination of methods - because you'd have
    to declare an object of more than one type at once to do so.
    
    All tests still pass.

 Makefile.am       |    6 +-
 algebraic.cpp     |   17 +-
 consts.cpp        |   12 +-
 erf.cpp           |   94 ++---
 exp.cpp           |   51 +--
 gamma.cpp         |   37 +-
 gosper.cpp        |   39 +-
 io.cpp            |   26 +-
 lambertw.cpp      |   93 ++---
 main.cpp          |    6 +-
 monotone.cpp      |   64 ++-
 output.cpp        |  411 +++++++++----------
 python/pyspig.cpp |   30 +-
 python/setup.py   |    1 -
 rational.cpp      |   46 ---
 spigot.cpp        | 1130 ++++++++++++++++++++++++++++++++++++++---------------
 spigot.h          |  363 +++++++++++++----
 sqrt.cpp          |   73 ++--
 trig.cpp          |  102 ++---
 unary.cpp         |   61 +--
 20 files changed, 1679 insertions(+), 983 deletions(-)

commit d429719e351d4d4dd19826129662e8403146dbaf
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=d429719e351d4d4dd19826129662e8403146dbaf;hp=a576256ae3c80229cf157781a2395c65cb160b51
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 13:06:45 2014 +0000

    Replace Gosper with a new core for basic arithmetic.
    
    gosper.cpp has been replaced with arithmetic.cpp, which does
    arithmetic using a Core2 class which takes two Sources rather than
    one, and combines them using the same 8-element matrix as the Gosper
    algorithm did.
    
    In fact, the matrix at the heart of Core2 has exactly the same
    semantics as the one in Gosper did; it's just that now we evolve it by
    directly absorbing spigot matrices rather than continued fraction
    terms. As a result, we avoid the assorted exactness hazards incurred
    by doing arithmetic on inputs (or generating an output) which turned
    out to have a terminating continued fraction.
    
    A new regression test demonstrates the sort of thing I mean: the
    Gosper system would have hung up for ever trying to compute (sqrt(2) -
    sqrt(2)) and never got as far as adding the resulting zero to sqrt(3),
    whereas Core2 is able to keep refining its idea of the subexpression
    to smaller and smaller intervals around zero, and hence the main
    expression can make progress.
    
    The new arithmetic system is unfortunately slower, but you can't have
    everything.

 Makefile.am     |    2 +-
 arithmetic.cpp  |  509 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 gosper.cpp      |  284 -------------------------------
 python/setup.py |    2 +-
 test.sh         |    3 +
 5 files changed, 514 insertions(+), 286 deletions(-)

commit a8ab5bd4d6f7613158b18f093a085dd46188cb43
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=a8ab5bd4d6f7613158b18f093a085dd46188cb43;hp=d429719e351d4d4dd19826129662e8403146dbaf
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 14:15:24 2014 +0000

    Fix exactness hazards in exp,sincos range reduction.
    
    Instead of insisting on finding the correct value of floor(x/10)
    followed by the exact value of (x - something * period), we now look
    for a value _somewhere near_ (x/period), and multiply back up in one
    go. This should avoid a double exactness hazard.
    
    In order to do this, I've introduced get_approximate_approximant(),
    which is like get_approximant() but less precise in its output. The
    old get_approximant has been renamed to get_true_approximant() (and
    had its prototype made more sensible, while I'm at it), but it's also
    entirely unused now, so I might throw it out later. (Or perhaps not -
    the Python module might find it useful.)

 exp.cpp    |   47 ++++++++++++++++++-----------------------------
 spigot.cpp |   29 +++++++++++++++++++++++++----
 spigot.h   |    3 ++-
 trig.cpp   |   38 ++++++++++++++++++--------------------
 4 files changed, 63 insertions(+), 54 deletions(-)

commit e330f750f361105ee32e60c61043e576e851a799
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=e330f750f361105ee32e60c61043e576e851a799;hp=a8ab5bd4d6f7613158b18f093a085dd46188cb43
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 14:46:08 2014 +0000

    Introduce a misc.cpp source file.
    
    This is a place where I can put random utility functions that don't
    belong anywhere very specific.
    
    To begin with, I've seeded it with bigint_print_nl (useful to call
    from gdb, so it's better _not_ to have it declared 'inline' in a
    header file), and debug_print[v] which contains most of the guts of
    what used to be Debuggable::dprintv (so now I can call it from setup
    functions as well as inside classes).

 Makefile.am     |    4 +--
 bi_gmp.h        |    2 --
 bi_internal.h   |    2 --
 misc.cpp        |  101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 python/setup.py |    1 +
 spigot.cpp      |   76 ++---------------------------------------
 spigot.h        |    8 +++++
 7 files changed, 114 insertions(+), 80 deletions(-)

commit 252ed556321481befb422b923080a64d6cd8a7a2
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=252ed556321481befb422b923080a64d6cd8a7a2;hp=e330f750f361105ee32e60c61043e576e851a799
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 14:59:05 2014 +0000

    Factor out the parallel sign test from MonotoneInverter.
    
    I'm going to want to reuse it elsewhere, so let's move it into a handy
    function in misc.cpp which I can easily call from lots of other
    places.

 misc.cpp     |   12 ++++++++
 monotone.cpp |   89 ++++++++++++++++++++++++----------------------------------
 spigot.h     |    4 +++
 3 files changed, 52 insertions(+), 53 deletions(-)

commit cde233ca78edb208ac72cbb14e8abfa0541371cf
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=cde233ca78edb208ac72cbb14e8abfa0541371cf;hp=252ed556321481befb422b923080a64d6cd8a7a2
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 15:18:34 2014 +0000

    Rewrite spigot_atan2 without exactness hazards.
    
    Instead of insisting on the signs of both arguments before doing
    anything, we now start by recognising easy cases, then do a parallel
    sign test (because we only actually need one of the signs at a time,
    in most cases).

 misc.cpp |    6 ++++++
 spigot.h |    2 ++
 trig.cpp |   69 +++++++++++++++++++++++++++++++++++++++++++-------------------
 3 files changed, 56 insertions(+), 21 deletions(-)

commit c3a53a4b3cb0eae95df9a471cb0a0e6664462777
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=c3a53a4b3cb0eae95df9a471cb0a0e6664462777;hp=cde233ca78edb208ac72cbb14e8abfa0541371cf
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 16:12:03 2014 +0000

    Nail down the semantics of bigint_approxlog2.
    
    It really was very approx, previously: it disagreed by 1 between
    bi_gmp and bi_internal, and nothing in the code had noticed or cared
    (because it was only used to allocate about the right amount of space
    for base representations and that sort of thing). But I'm about to
    need more precision than that, so now I've defined it as returning
    max(0, floor(log2(x))) and made sure that both bigint providers agree.
    
    (At least, they agree _now_, with GMP 5.1.3. If the behaviour of
    mpz_sizeinbase changes with other GMP versions, I suppose I'll have to
    faff about in bi_gmp.h with double-checking after I get back the
    result.)

 bi_gmp.h |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

commit bb5ca103e1d5daa9273b93dfb34d6e902946c58d
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=bb5ca103e1d5daa9273b93dfb34d6e902946c58d;hp=c3a53a4b3cb0eae95df9a471cb0a0e6664462777
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 16:14:22 2014 +0000

    Rewrite log's range reduction without exactness hazards.
    
    Now we should manage to reduce anythin to a sensible interval without
    any annoying hangs.

 exp.cpp |   92 ++++++++++++++++++++++++++++-----------------------------------
 1 file changed, 41 insertions(+), 51 deletions(-)

commit f008d6c18a0e769437a085cfbbb62be76560089e
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=f008d6c18a0e769437a085cfbbb62be76560089e;hp=bb5ca103e1d5daa9273b93dfb34d6e902946c58d
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 16:42:05 2014 +0000

    Invent BracketingGenerator, and use it for inversion bounds.
    
    The clients of MonotoneInverter (erfinv and lambertw) were using a
    ConvergentsGenerator to find the initial rational values bounding the
    target, which introduced two exactness hazards: firstly, what if the
    continued fraction of one of the guessed bounds terminated, and
    secondly, what if one of the convergents exactly hit the target by
    mistake so that the sign came out as zero?
    
    Fixed by introducing a new BracketingGenerator, which returns pairs of
    rationals converging to a target from both sides in a much more ad-hoc
    way. We use this to get two approximations at a time to our target
    bound, and then we do a parallel_sign_test to evaluate the target
    function at both approximations against the risk of one of them
    accidentally smacking the target on the nose.

 erf.cpp      |   55 +++++++++++++++++++++++++++-----------
 lambertw.cpp |   84 +++++++++++++++++++++++++++++++++++++++++-----------------
 spigot.cpp   |   62 +++++++++++++++++++++++++++++++++++++++++++
 spigot.h     |   22 +++++++++++++++
 4 files changed, 182 insertions(+), 41 deletions(-)

commit 09d9adee05e691d811b309511e3de8b4a252e602
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=09d9adee05e691d811b309511e3de8b4a252e602;hp=f008d6c18a0e769437a085cfbbb62be76560089e
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 16:58:14 2014 +0000

    Stop using continued fractions in atan range reducer.
    
    Now we test for |x| > 1 using get_approximate_approximant, avoiding
    exactness hazards at the cost of a little precision which didn't
    matter anyway.

 trig.cpp |   32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

commit 666e2176040aa0e3d81d33759dcb29f0f30daa66
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=666e2176040aa0e3d81d33759dcb29f0f30daa66;hp=09d9adee05e691d811b309511e3de8b4a252e602
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 08:10:59 2014 +0000

    Fix broken Newton-Raphson in spigot_erfinv.
    
    I had somehow rendered the derivative of erf(x) as exp(x^2), rather
    than exp(-x^2)/(1/2 sqrt(pi)), leading to some lower bounds never
    being successfully found.

 erf.cpp |    7 +++++--
 test.sh |    2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)

commit a1659e82b260c01321e41e4a095bf02bb0d141da
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=a1659e82b260c01321e41e4a095bf02bb0d141da;hp=666e2176040aa0e3d81d33759dcb29f0f30daa66
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 08:55:58 2014 +0000

    Add a BinaryIntervalSource class.
    
    This takes as input a stream of rational intervals with power-of-2
    denominators, and constructs a spigot matrix stream out of it.

 spigot.cpp |   87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 spigot.h   |   18 +++++++++++++
 2 files changed, 105 insertions(+)

commit e1f3893699479e1ae1e8218960c74f5a21507753
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=e1f3893699479e1ae1e8218960c74f5a21507753;hp=a1659e82b260c01321e41e4a095bf02bb0d141da
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Dec 30 19:58:31 2014 +0000

    Rewrite MonotoneHelper without exactness hazards.
    
    Both its input and output sides now work using BracketingGenerator in
    place of CfracGenerator, and it produces its output as a
    BinaryIntervalSource.

 monotone.cpp |  129 +++++++++++++++++++++++++++++++---------------------------
 1 file changed, 69 insertions(+), 60 deletions(-)

commit 99fe0b5450d7235b422c9ee6dc887a3940a3be7d
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=99fe0b5450d7235b422c9ee6dc887a3940a3be7d;hp=e1f3893699479e1ae1e8218960c74f5a21507753
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 10:04:29 2014 +0000

    Fix GammaWrapper not to have exactness hazards.
    
    GammaWrapper had much the same problem as I just fixed in
    MonotoneHelper, namely that it receives a series of approximations to
    the real output number and has to combine them into a spigot
    representation of the final target, which it was doing by treating
    them as continued fraction series. Now it's doing the same job using
    BracketingGenerator and BinaryIntervalSource, which is suddenly
    becoming my new favourite teamed-up pair of classes.

 gamma.cpp |   64 ++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 31 insertions(+), 33 deletions(-)

commit b227227cc2c7ee25719f32964780bdcf1fc9b9c0
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=b227227cc2c7ee25719f32964780bdcf1fc9b9c0;hp=99fe0b5450d7235b422c9ee6dc887a3940a3be7d
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 11:19:09 2014 +0000

    Reorganise spigot_pow a little bit.
    
    It's not really feasible to fix _all_ the exactness hazards in pow,
    because you'd like pow(something that turns out to be zero, positive
    number) to keep narrowing closer and closer to zero, but that's never
    going to work with an exp+log implementation since the log of that
    value will never complete. So I think that's one hazard that will have
    to remain unfixed and be documented as a known issue.
    
    However, I can at least remove the completely gratuitous retrieval of
    a continued fraction term from a at the start, and while I'm at it,
    add a few extra special cases for 0^x, x^0, x^1 and x^-1.

 exp.cpp |   53 +++++++++++++++++++++++++++++++++++++++--------------
 test.sh |    6 ++++++
 2 files changed, 45 insertions(+), 14 deletions(-)

commit bd40ce7cf17530b8bd0b36c0f2c1887754ac3256
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=bd40ce7cf17530b8bd0b36c0f2c1887754ac3256;hp=b227227cc2c7ee25719f32964780bdcf1fc9b9c0
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 11:25:32 2014 +0000

    Fix monotonicity failure at cos(0).
    
    The class which evaluated cos near zero was receiving the actual input
    value as a parameter, which makes it a wrong thing to pass to
    spigot_monotone, because near zero it's not monotonic! This was
    causing an actual failure, in that sin(pi/2) returned output starting
    0.99999999999272404238... when it ought to have hung due to wanting to
    generate 1.
    
    Fixed by making use of the fact that cos near zero has a Taylor series
    using only even powers of x, hence can be regarded as a function of
    x^2. So we square the input value _before_ passing to spigot_monotone,
    and now the value is monotonic after all.
    
    As a result of this and the MonotoneHelper rewrite, we can now
    evaluate trig expressions that come to things like 0, +1 and -1, with
    the only exactness issue being at output time - i.e. if we then add
    such expressions to an irrational such as sqrt(2), we get perfectly
    good output. Test cases added.

 test.sh  |    3 +++
 trig.cpp |   42 +++++++++++++++++++++++++++---------------
 2 files changed, 30 insertions(+), 15 deletions(-)

commit 2e4d127d1375c1feaa2969cbb701f61b302b2343
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=2e4d127d1375c1feaa2969cbb701f61b302b2343;hp=bd40ce7cf17530b8bd0b36c0f2c1887754ac3256
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 11:47:08 2014 +0000

    Fix abs() to not have an exactness hazard.
    
    Amazingly, it is possible to mess up this very simple function! If you
    implement abs by testing the sign of the input first, then abs(value
    that turns out to be zero) will hang, even if it's a subexpression of
    something that ought to work as a whole, such as the test case I just
    added of abs(thing that turns out to be zero)+sqrt(2).
    
    While I'm here, I also put in a special case for rationals (in
    particular, so that abs(an actually obvious zero) returns 0
    immediately), so I've added a few tests of that too.

 test.sh   |    6 ++++++
 unary.cpp |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++----------
 2 files changed, 61 insertions(+), 10 deletions(-)

commit a018646d3295446416dffcbddc36f5a82c4a772f
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=a018646d3295446416dffcbddc36f5a82c4a772f;hp=2e4d127d1375c1feaa2969cbb701f61b302b2343
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 12:24:47 2014 +0000

    Fix the remainder functions to not use continued fractions.
    
    There's an unavoidable exactness hazard in any remainder operation, in
    the case where the input is on a dividing line. But the implementation
    of ModBase via continued fractions was introducing extra pointless
    exactness hazards when the output turned out to be a rational number
    _not_ on the dividing line.
    
    Fixed by throwing out ModBase completely, and simply finding the right
    integer to subtract and using spigot_mobius to subtract it. In order
    to deal with _detectable_ boundary cases I've arranged for
    StaticGenerator::get_true_approximant to pass through the 'constant'
    return value from iterate_spigot_algorithm; also, since this is
    probably the first time spigot_mobius will have been applied to known
    rationals, I've added a special case to it to do the right thing
    there.

 spigot.cpp |    4 +-
 spigot.h   |    2 +-
 test.sh    |    3 ++
 unary.cpp  |  176 ++++++++++++++++++++----------------------------------------
 4 files changed, 64 insertions(+), 121 deletions(-)

commit 729fe4b5fb74c4a3480033456f345cc713867567
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=729fe4b5fb74c4a3480033456f345cc713867567;hp=a018646d3295446416dffcbddc36f5a82c4a772f
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 14:15:46 2014 +0000

    Expose the premultiply() method in StaticGenerator.
    
    That permits me to throw away SourceGenInner, which StaticGenerator is
    now a superset of.

 spigot.cpp |   75 +++++++++++++++++++-----------------------------------------
 spigot.h   |    9 +++++---
 2 files changed, 30 insertions(+), 54 deletions(-)

commit c8b3330b42b586d2db4bbef113d355e81490ab27
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=c8b3330b42b586d2db4bbef113d355e81490ab27;hp=729fe4b5fb74c4a3480033456f345cc713867567
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 14:08:51 2014 +0000

    Complete rewrite of the SqrtReal class.
    
    The previous version handled input in base 4 and output in base 2,
    with potential exactness hazards on both sides. This still _sort of_
    does that, but it permits half-integer valued digits in both input and
    output (via custom spigot matrices) and hence avoids any exactness
    hazard. In particular, we can generate square roots of numbers which
    are non-obviously dyadic rationals (e.g. sqrt(sin(pi/6))), and also if
    you try to take sqrt of a non-obvious zero and add it to something
    else then the exactness of the zero doesn't cause any difficulty.

 sqrt.cpp |  308 ++++++++++++++++++++++++++++++++++++++++++++++++--------------
 test.sh  |    5 +
 2 files changed, 245 insertions(+), 68 deletions(-)

commit ebc23f00e88ecdea0e4b7f32b34af491b74186cf
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=ebc23f00e88ecdea0e4b7f32b34af491b74186cf;hp=c8b3330b42b586d2db4bbef113d355e81490ab27
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 16:24:37 2014 +0000

    Rewrite CbrtReal as well.
    
    This is very much a clone-and-hack of the rewrite I just did of
    SqrtReal. But somehow it came out looking _nicer_ - mostly because
    cbrt is symmetric about zero, which meant I could use balanced base
    systems for input and output and then a lot of things ended up not
    only conveniently symmetric but also actually _simpler_. I wish I'd
    been able to do that for sqrt now! But I think it wouldn't have gone
    well, because sqrt's need for negative-number detection did make it a
    better idea to put the origin at the bottom of the interval instead of
    in the middle.

 sqrt.cpp |  322 ++++++++++++++++++++++++++++++++++++++++++++++----------------
 test.sh  |    7 ++
 2 files changed, 245 insertions(+), 84 deletions(-)

commit f919f9a7c610f05826af24d67a5df6bf41cf7a50
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=f919f9a7c610f05826af24d67a5df6bf41cf7a50;hp=ebc23f00e88ecdea0e4b7f32b34af491b74186cf
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 16:56:43 2014 +0000

    Update docs for all the fixed exactness hazards.
    
    In my trawl through this week, I know of two hazards that were just
    too hard to fix, but fortunately they're minor corner cases that
    shouldn't cause annoyance in practice. I've documented them.

 TODO.txt    |   60 ----------------------------------
 manpage.but |   13 +++++---
 manual.but  |  105 +++++++++++++++++++++++++----------------------------------
 3 files changed, 53 insertions(+), 125 deletions(-)

commit eec8f3bd0e22b7d9158adee86643be51cbf3ddae
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=eec8f3bd0e22b7d9158adee86643be51cbf3ddae;hp=f919f9a7c610f05826af24d67a5df6bf41cf7a50
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 17:03:03 2014 +0000

    Update the references section.
    
    I no longer use Gosper's algorithm. Also, it's come to my attention
    that the descendant of it in Core2 might match a thing Imperial
    College had already done, so I should add a comment about that.

 manual.but |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

commit ef1491e5b60119e18e79dbe4ae7c2058111629e7
web diff http://tartarus.org/~simon-git/gitweb/?p=spigot.git;a=commitdiff;h=ef1491e5b60119e18e79dbe4ae7c2058111629e7;hp=eec8f3bd0e22b7d9158adee86643be51cbf3ddae
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Dec 31 17:34:27 2014 +0000

    Fix logic errors in bi_internal's left shift.
    
    It was adding rather than subtracting the in-word offset, and also
    failing to preserve the sign on a shifted number.

 bi_internal.h |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)



More information about the tartarus-commits mailing list