AgeCommit message (Collapse)Author
2018-05-10Regenerate OpenBSD bootstrap.libmath-mergeOri Bernstein
2018-05-09Regenerate freebsd bootstrap.Ori Bernstein
2018-05-09FreeBSD and NetBSD also have old assemblers.Ori Bernstein
2018-05-09Merge branch 'master' into libmath-mergeOri Bernstein
2018-05-09Regenerate netbsd bootstrapOri Bernstein
2018-05-09Fix/regenerate OSX bootstrap.Ori Bernstein
2018-05-09Fix our tags when bootstrapping.Ori Bernstein
2018-05-09Turn off fancy stuff when we have an old assembler.Ori Bernstein
2018-05-09Merge remote-tracking branch 'npnth/libmath'Ori Bernstein
2018-05-08Don't specify .comm alignment.Ori Bernstein
It seems to confuse lld.
2018-05-07libjson: allow square brackets in stringsCarlin Bingham
2018-05-06Start of AES GCM work.Ori Bernstein
2018-05-06Make std.writeall api slightly nicer.Ori Bernstein
2018-05-03Finish expm1 using scale2.S. Gilles
2018-05-03Implment scale2.S. Gilles
This is, perhaps, a conforming implementation of scalB, but it is highly probable that, in the future, it will be desireable for scalB to accept arbitrary, exponents, not simply integers. Furthermore, we find scalB a non-intuitive name. Therefore, calling the function ‘scale2’ serves two purposes.
2018-05-02Implement most of expm1. Errors in huge numbers.S. Gilles
[Tan92] finishes off calculation of expm1(f) by range expansion, which involves multiplying a number by 2^M, where M grows roughly linearly with f. If f is very large (say, 0x0x42b17200 in single-precision), M may grow to be as larger than the maximal exponent (in this case, M = 128). If 2^M * P is calculated in the normal way, the intermediate value 2^M is not representable, causing mangled output. However, the result may still be computed: the value P is of magnitude < 1. Therefore, a scalb function will be necessary to perform this multiplication without creating unrepresentable intermediate values={
2018-05-01Escape test failures.Ori Bernstein
This makes things work more good when running tests by hand.
2018-05-01Merge branch 'master' of /git/ori/mcOri Bernstein
2018-04-27Extract slices recursively.Ori Bernstein
This fixes deeply nestedl slices of arrays of slices of arrays.
2018-04-24We don't do PIE yet, let's deal with it later.Ori Bernstein
2018-04-22Improve comments.Ori Bernstein
2018-04-22Add a special exit stack to our thread library.Ori Bernstein
Because OpenBSD wants a valid stack pointer in any code that enters the kernel, unmapping our stack as part of exiting the process is rather unreliable. This change allocates a stack page that we can switch to when a thread is deallocating itself, which keeps the kernel happy.
2018-04-20Fix OpenBSD 6.1 specialization.Ori Bernstein
2018-04-19Put _s in the right spot in ASM files.S. Gilles
2018-04-19Test exp.S. Gilles
We use Tang's implementation, which occasionally is off by 1 ulp. In the double-precision case, this is about par with current libc implementations. Glibc computes expf() in double-precision, so is always (at least, as observed) last-place accurate. We appear to be about on par with musl-libc in the single-precision case. In order to increase accuracy, we could either decrease the interval size (and increase table size), or switch to a different algorithm. Decreasing the interval size is non-trivial, however, as it would require recomputing the entire table, which is non-trivial.
2018-04-19Subnormalize special-case floats in fltXYassem.S. Gilles
If the exponent is the lowest possible representable, then the returned float will actually be subnormal. In this case, we do not have the implied leading 1, so we need to downshift the significand so that it doesn't get lost. We end up losing the least significant bit of the significand, but that's unavoidable.
2018-04-18Implement exp.S. Gilles
2018-04-18Implement Horner's Scheme for polynomial evaluation.S. Gilles
2018-04-18Boilerplate FP control word code for ASM round.S. Gilles
2018-04-18Explicitly type some variables.S. Gilles
This works now, thanks to b433062cdda93b2eb1c4331a953d1ee5fbbd2bb4.
2018-04-18Add round-to-nearest-integer.S. Gilles
As distinct from trunc/floor/ceil, these obey the current rounding mode (round to nearest) and return actual integers.
2018-04-18Merge remote-tracking branch 'ori/master' into HEADS. Gilles
2018-04-17Don't mutate the traits on builtin types.Ori Bernstein
mktylike() should return a generic type based on the builtin, and that means that if we mutate the builtin, we will be adding traits to our literals. This is wrong on multiple levels. First off, it means that '@t :: numeric,integral @t' will now require whatever other types are implemented over literals. And second, it means that if, for example, a trait is implemented for flt64, flt32 literals will also need it.
2018-04-17Remove stray ',' from error message.Ori Bernstein
2018-04-17Merge trait specs if provided.Ori Bernstein
This is a bit ugly, since if there are duplicate specs for a trait, we'll end up duplicating the constraints. On the other hand, since we put them into a set, it's mostly an esthetic issue.
2018-04-16Add missing libcrypto dependencyOri Bernstein
2018-04-15Add support for ragged RSA numbers.Ori Bernstein
- Add a function to extract the top 32 bits regardless of alignment. - Remove ctbitcount from the public API. - Add it to the RSA, and makes it count from the right end of the number. - Remove some trash.
2018-04-15Add first tested RSA implementation.Ori Bernstein
2018-04-15Add big-endian constructor for ctbig.Ori Bernstein
It turns out that many places we use ctbig will want to create them from big endian byte buffers.
2018-04-15Misc fixes to ctbig.Ori Bernstein
- Make equality checks work properly. - Don't mix up endianness in modpow. - Clip everything correctly.
2018-04-13Break out some fpmath functions to utililty file.S. Gilles
2018-04-08Remove dead code/comments.Ori Bernstein
2018-04-08Add a nontrivial modpow test.Ori Bernstein
2018-04-08Make constant time ints package local.Ori Bernstein
They're rather specialized, and a bit tricky to use.
2018-04-08Add support for `-T` option to compile in test mode.Ori Bernstein
Tests can now access hidden declarations.
2018-04-08Constant time modpow.Ori Bernstein
2018-04-05Ensure that we initialize the environment fully.Ori Bernstein
Initially, the thought was that since the function doesn't access any of the environment data, initializing it was a waste of time. This is true -- if the environment is not heapified. But we do often want to heapify the environment, which means that if we have junk in the environment pointer we will think, incorrectly, that there is an environment to duplicate. This leads to crashes. Crashes are a bad thing. This change zeroes out the environment pointer, so that we don't have crashes. This makes mpu happy(er).
2018-03-31Clip top of ints.Ori Bernstein
2018-03-31Fix tests on 9front.Ori Bernstein
The floating point on 9front is strict compared to the environment on other systems. It does not allow for NaN, which makes testing for NaN behavior crashy. We should eventually verify that we generate FPEs on 9front when we generate a nan, but for now, it's simpler just to skip those tests.
2018-03-31Comment out unused tests (oops)Ori Bernstein