simon-git: spigot (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Thu Aug 31 18:59:11 BST 2017


TL;DR:
  94190ac baseout.cpp: remove the ebase <= dbase constraint.
  fdb4d9d Add an option to output scientific notation.

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:           2017-08-31 18:59:11

commit 94190ac5af3fc3fe6eb159faae8b9d3156339767
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=94190ac5af3fc3fe6eb159faae8b9d3156339767;hp=8d56cccabfd246f8ec534a0400b263db371fae00
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Aug 31 18:53:41 2017 +0100

    baseout.cpp: remove the ebase <= dbase constraint.
    
    Until now, BaseOutputGenerator was enforcing by assertion that the
    base used for the initial exponent-finding step (that is, the value of
    which you want to identify and divide off an integer power) cannot
    exceed the digit base used for the subsequent mantissa generation.
    
    This was because no output mode I actually implement was violating
    that assumption, and it saved me having to figure out how best to
    handle it. (It's difficult because in that situation you can't
    reliably have just one digit before the decimal point in the mantissa
    - with ebase < dbase you _reduce_ the potential range of that first
    digit, but if ebase > dbase, there's no representation of, say, 42.1
    with ebase=100 and dbase=10 which has exactly one mantissa digit
    before the point.)
    
    But now I'm about to introduce such a mode, which means I do have to
    figure out how to handle it, and I've decided the sensible answer is
    simply to rule that the _first_ output digit - i.e. the 'integer part'
    of the mantissa after ebase^k has been divided off - is in the range
    [1,ebase), and all _subsequent_ digits are in the range [1,dbase).

 baseout.cpp | 33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

commit fdb4d9d333583d8b305e7186fd32203151bd8bee
web diff https://git.tartarus.org/?p=simon/spigot.git;a=commitdiff;h=fdb4d9d333583d8b305e7186fd32203151bd8bee;hp=94190ac5af3fc3fe6eb159faae8b9d3156339767
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Aug 31 18:55:51 2017 +0100

    Add an option to output scientific notation.
    
    Well, a sort of 'reversed' scientific notation, anyway. The usual
    convention of writing things like 4.3 x 10^27, with the mantissa first
    and then an exponent written after the mantissa finishes, has to be
    changed round in the spigot world because the mantissa might _not_
    finish. So instead spigot will write the exponent first, generating
    output in the form "10^27 * 4.3", so that there's scope to add as many
    further mantissa digits as necessary (including an endless stream of
    them) without any more important information being postponed.

 baseout.cpp | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 baseout.h   |  8 ++++++
 main.cpp    | 39 ++++++++++++++++++++++++--
 manpage.but |  8 ++++++
 manual.but  | 13 +++++++++
 test.sh     | 13 +++++++++
 6 files changed, 169 insertions(+), 4 deletions(-)



More information about the tartarus-commits mailing list