cosmopolitan/third_party/python/Modules/_decimal/libmpdec
Justine Tunney 957c61cbbf
Release Cosmopolitan v3.3
This change upgrades to GCC 12.3 and GNU binutils 2.42. The GNU linker
appears to have changed things so that only a single de-duplicated str
table is present in the binary, and it gets placed wherever the linker
wants, regardless of what the linker script says. To cope with that we
need to stop using .ident to embed licenses. As such, this change does
significant work to revamp how third party licenses are defined in the
codebase, using `.section .notice,"aR",@progbits`.

This new GCC 12.3 toolchain has support for GNU indirect functions. It
lets us support __target_clones__ for the first time. This is used for
optimizing the performance of libc string functions such as strlen and
friends so far on x86, by ensuring AVX systems favor a second codepath
that uses VEX encoding. It shaves some latency off certain operations.
It's a useful feature to have for scientific computing for the reasons
explained by the test/libcxx/openmp_test.cc example which compiles for
fifteen different microarchitectures. Thanks to the upgrades, it's now
also possible to use newer instruction sets, such as AVX512FP16, VNNI.

Cosmo now uses the %gs register on x86 by default for TLS. Doing it is
helpful for any program that links `cosmo_dlopen()`. Such programs had
to recompile their binaries at startup to change the TLS instructions.
That's not great, since it means every page in the executable needs to
be faulted. The work of rewriting TLS-related x86 opcodes, is moved to
fixupobj.com instead. This is great news for MacOS x86 users, since we
previously needed to morph the binary every time for that platform but
now that's no longer necessary. The only platforms where we need fixup
of TLS x86 opcodes at runtime are now Windows, OpenBSD, and NetBSD. On
Windows we morph TLS to point deeper into the TIB, based on a TlsAlloc
assignment, and on OpenBSD/NetBSD we morph %gs back into %fs since the
kernels do not allow us to specify a value for the %gs register.

OpenBSD users are now required to use APE Loader to run Cosmo binaries
and assimilation is no longer possible. OpenBSD kernel needs to change
to allow programs to specify a value for the %gs register, or it needs
to stop marking executable pages loaded by the kernel as mimmutable().

This release fixes __constructor__, .ctor, .init_array, and lastly the
.preinit_array so they behave the exact same way as glibc.

We no longer use hex constants to define math.h symbols like M_PI.
2024-02-20 13:27:59 -08:00
..
basearith.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
basearith.h Reduce header complexity 2023-11-28 14:39:42 -08:00
bits.h Reduce header complexity 2023-11-28 14:39:42 -08:00
constants.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
constants.h Reduce header complexity 2023-11-28 14:39:42 -08:00
context.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
convolute.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
convolute.h Make numerous improvements 2021-09-28 01:52:34 -07:00
crt.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
crt.h Reduce header complexity 2023-11-28 14:39:42 -08:00
difradix2.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
difradix2.h Make numerous improvements 2021-09-28 01:52:34 -07:00
fnt.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
fnt.h Make numerous improvements 2021-09-28 01:52:34 -07:00
fourstep.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
fourstep.h Make numerous improvements 2021-09-28 01:52:34 -07:00
io.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
io.h Reduce header complexity 2023-11-28 14:39:42 -08:00
memory.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
mpalloc.h Make numerous improvements 2021-09-28 01:52:34 -07:00
mpdecimal.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
mpdecimal.h Reduce header complexity 2023-11-28 14:39:42 -08:00
notice.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
numbertheory.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
numbertheory.h Make numerous improvements 2021-09-28 01:52:34 -07:00
README.txt python-3.6.zip added from Github 2021-08-09 05:39:42 -07:00
sixstep.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
sixstep.h Reduce header complexity 2023-11-28 14:39:42 -08:00
transpose.c Release Cosmopolitan v3.3 2024-02-20 13:27:59 -08:00
transpose.h Reduce header complexity 2023-11-28 14:39:42 -08:00
typearith.h Reduce header complexity 2023-11-28 14:39:42 -08:00
umodarith.h Reduce header complexity 2023-11-28 14:39:42 -08:00


libmpdec
========

libmpdec is a fast C/C++ library for correctly-rounded arbitrary precision
decimal floating point arithmetic. It is a complete implementation of
Mike Cowlishaw/IBM's General Decimal Arithmetic Specification.


Files required for the Python _decimal module
=============================================

  Core files for small and medium precision arithmetic
  ----------------------------------------------------

    basearith.{c,h}  ->  Core arithmetic in base 10**9 or 10**19.
    bits.h           ->  Portable detection of least/most significant one-bit.
    constants.{c,h}  ->  Constants that are used in multiple files.
    context.c        ->  Context functions.
    io.{c,h}         ->  Conversions between mpd_t and ASCII strings,
                         mpd_t formatting (allows UTF-8 fill character).
    memory.{c,h}     ->  Allocation handlers with overflow detection
                         and functions for switching between static
                         and dynamic mpd_t.
    mpdecimal.{c,h}  ->  All (quiet) functions of the specification.
    typearith.h      ->  Fast primitives for double word multiplication,
                         division etc.

    Visual Studio only:
    ~~~~~~~~~~~~~~~~~~~
      vccompat.h    ->  snprintf <==> sprintf_s and similar things.
      vcstdint.h    ->  stdint.h (included in VS 2010 but not in VS 2008).
      vcdiv64.asm   ->  Double word division used in typearith.h. VS 2008 does
                        not allow inline asm for x64. Also, it does not provide
                        an intrinsic for double word division.

  Files for bignum arithmetic:
  ----------------------------

    The following files implement the Fast Number Theoretic Transform
    used for multiplying coefficients with more than 1024 words (see
    mpdecimal.c: _mpd_fntmul()).

      umodarith.h        ->  Fast low level routines for unsigned modular arithmetic.
      numbertheory.{c,h} ->  Routines for setting up the Number Theoretic Transform.
      difradix2.{c,h}    ->  Decimation in frequency transform, used as the
                             "base case" by the following three files:

        fnt.{c,h}        ->  Transform arrays up to 4096 words.
        sixstep.{c,h}    ->  Transform larger arrays of length 2**n.
        fourstep.{c,h}   ->  Transform larger arrays of length 3 * 2**n.

      convolute.{c,h}    ->  Fast convolution using one of the three transform
                             functions.
      transpose.{c,h}    ->  Transpositions needed for the sixstep algorithm.
      crt.{c,h}          ->  Chinese Remainder Theorem: use information from three
                             transforms modulo three different primes to get the
                             final result.


Pointers to literature, proofs and more
=======================================

  literature/
  -----------

    REFERENCES.txt  ->  List of relevant papers.
    bignum.txt      ->  Explanation of the Fast Number Theoretic Transform (FNT).
    fnt.py          ->  Verify constants used in the FNT; Python demo for the
                        O(N**2) discrete transform.

    matrix-transform.txt -> Proof for the Matrix Fourier Transform used in
                            fourstep.c.
    six-step.txt         -> Show that the algorithm used in sixstep.c is
                            a variant of the Matrix Fourier Transform.
    mulmod-64.txt        -> Proof for the mulmod64 algorithm from
                            umodarith.h.
    mulmod-ppro.txt      -> Proof for the x87 FPU modular multiplication
                            from umodarith.h.
    umodarith.lisp       -> ACL2 proofs for many functions from umodarith.h.


Library Author
==============

  Stefan Krah <skrah@bytereef.org>