| Commit message (Expand) | Author | Age | Files | Lines |
| * | Merge remote-tracking branch 'nsz/exp' | Rich Felker | 2012-08-13 | 2 | -40/+35 |
| |\ |
|
| | * | math: fix exp.s on i386 and x86_64 so the exception flags are correct•••exp(inf), exp(-inf), exp(nan) used to raise wrong flags
| nsz | 2012-08-08 | 2 | -40/+35 |
| * | | remove significandl•••this function never existed historically; since the float/double
functions it's based on are nonstandard and deprecated, there's really
no justification for its existence except that glibc has it. it can be
added back if there's ever really a need...
| Rich Felker | 2012-08-13 | 1 | -7/+0 |
| * | | add significand[fl] math functions | Rich Felker | 2012-08-13 | 3 | -0/+21 |
| |/ |
|
| * | fix missing prototype and simplify sincosl on ld64 archs | Rich Felker | 2012-07-02 | 1 | -4/+2 |
| * | fix invalid implicit pointer conversion in ld64 modfl | Rich Felker | 2012-07-02 | 1 | -1/+1 |
| * | math: fix fma bug on x86 (found by Bruno Haible with gnulib)•••The long double adjustment was wrong:
The usual check is
mant_bits & 0x7ff == 0x400
before doing a mant_bits++ or mant_bits-- adjustment since
this is the only case when rounding an inexact ld80 into
double can go wrong. (only in nearest rounding mode)
After such a check the ++ and -- is ok (the mantissa will end
in 0x401 or 0x3ff).
fma is a bit different (we need to add 3 numbers with correct
rounding: hi_xy + lo_xy + z so we should survive two roundings
at different places without precision loss)
The adjustment in fma only checks for zero low bits
mant_bits & 0x3ff == 0
this way the adjusted value is correct when rounded to
double or *less* precision.
(this is an important piece in the fma puzzle)
Unfortunately in this case the -- is not a correct adjustment
because mant_bits might underflow so further checks are needed
and this was the source of the bug.
| nsz | 2012-06-20 | 1 | -2/+10 |
| * | support ld80 pseudo-denormal invalid bit patterns; treat them as nan•••this is silly, but it makes apps that read binary junk and interpret
it as ld80 "safer", and it gets gnulib to stop replacing printf...
| Rich Felker | 2012-06-20 | 1 | -2/+5 |
| * | use fistpll mnemonic instead of fistpq (more widely supported) on x86_64 too•••this was fixed previously on i386 but the corresponding code on x86_64
was missed.
| Rich Felker | 2012-06-02 | 1 | -1/+1 |
| * | math: fix remquo.c when x==-y and a subnormal remainder bug as well•••backported fix from freebsd:
http://svnweb.FreeBSD.org/base?view=revision&revision=233973
| nsz | 2012-05-08 | 3 | -5/+8 |
| * | some assemblers don't like fistpq; use the alt. mnemonic fistpll | Rich Felker | 2012-05-07 | 3 | -3/+3 |
| * | add FORCE_EVAL macro to evaluate float expr for their side effect•••updated nextafter* to use FORCE_EVAL, it can be used in many other
places in the math code to improve readability.
| nsz | 2012-05-06 | 5 | -24/+12 |
| * | fix unused variable warnings in new nextafter/nexttoward code•••apparently initializing a variable is not "using" it but assigning to
it is "using" it. i don't really like this fix, but it's better than
trying to make a bigger cleanup just before a release, and it should
work fine (tested against nsz's math tests).
| Rich Felker | 2012-05-06 | 5 | -6/+12 |
| * | math: nextafter and nexttoward cleanup•••make nexttoward, nexttowardf independent of long double representation.
fix nextafterl: it did not raise underflow flag when the result was 0.
| nsz | 2012-05-06 | 5 | -291/+176 |
| * | math: change the formula used for acos.s•••old: 2*atan2(sqrt(1-x),sqrt(1+x))
new: atan2(fabs(sqrt((1-x)*(1+x))),x)
improvements:
* all edge cases are fixed (sign of zero in downward rounding)
* a bit faster (here a single call is about 131ns vs 162ns)
* a bit more precise (at most 1ulp error on 1M uniform random
samples in [0,1), the old formula gave some 2ulp errors as well)
| nsz | 2012-05-05 | 2 | -20/+16 |
| * | support alternate glibc name pow10 for exp10 | Rich Felker | 2012-05-01 | 3 | -0/+9 |
| * | add C stub for sqrtl (already implemented in asm on i386 and x86_64) | Rich Felker | 2012-04-30 | 1 | -0/+9 |
| * | first try at writing an efficient and "correct" exp10•••this is a nonstandard function so it's not clear what conditions it
should satisfy. my intent is that it be fast and exact for positive
integral exponents when the result fits in the destination type, and
fast and correctly rounded for small negative integral exponents.
otherwise we aim for at most 1ulp error; it seems to differ from pow
by at most 1ulp and it's often 2-5 times faster than pow.
| Rich Felker | 2012-04-30 | 3 | -0/+55 |
| * | fix typo in the x86_64 rounding asm | Rich Felker | 2012-04-29 | 4 | -4/+4 |
| * | new math asm (abs/rounding) for x86_64•••untested
| Rich Felker | 2012-04-29 | 6 | -0/+36 |
| * | math: fix x86 asin accuracy•••use (1-x)*(1+x) instead of (1-x*x) in asin.s
the later can be inaccurate with upward rounding when x is close to 1
| nsz | 2012-04-04 | 2 | -5/+6 |
| * | math: minor cleanups in ceil and floor | nsz | 2012-03-29 | 5 | -10/+7 |
| * | math: remove x86 modf asm•••the int part was wrong when -1 < x <= -0 (+0.0 instead of -0.0)
and the size and performace gain of the asm version was negligible
| nsz | 2012-03-29 | 4 | -111/+0 |
| * | math: rewrite modf.c and clean up modff.c•••cleaner implementation with unions and unsigned arithmetic
| nsz | 2012-03-29 | 2 | -72/+45 |
| * | math: fix modfl.c bug•••modfl(+-inf) was wrong on ld80 because the explicit msb
was not taken into account during inf vs nan check
| nsz | 2012-03-28 | 1 | -1/+1 |
| * | math: fix a regression in powl and do some cleanups•••previously a division was accidentally turned into integer div
(w = -i/NXT;) instead of long double div (w = -i; w /= NXT;)
| nsz | 2012-03-27 | 1 | -12/+11 |
| * | math: add dummy tgamma and tgammaf implementations | nsz | 2012-03-27 | 2 | -0/+32 |
| * | math: remove comment about aliasing lgamma as gamma•••It is probably not worth supporting gamma.
(it was already deprecated in 4.3BSD)
| nsz | 2012-03-27 | 3 | -8/+4 |
| * | math: fix typo in i386 remquof and remquol asm•••(fldl instruction was used instead of flds and fldt)
| nsz | 2012-03-27 | 1 | -5/+5 |
| * | Merge branch 'master' of git://git.etalabs.net/musl | nsz | 2012-03-23 | 2 | -0/+87 |
| |\ |
|
| | * | asm for hypot and hypotf•••special care is made to avoid any inexact computations when either arg
is zero (in which case the exact absolute value of the other arg
should be returned) and to support the special condition that
hypot(±inf,nan) yields inf.
hypotl is not yet implemented since avoiding overflow is nontrivial.
| Rich Felker | 2012-03-23 | 2 | -0/+87 |
| * | | minor rintl.c fix: remove unsupported ldbl format message | nsz | 2012-03-23 | 1 | -2/+0 |
| * | | fix tgammal: don't set the signgam global•••(tgamma must be thread-safe, signgam is for lgamma* functions)
| nsz | 2012-03-23 | 1 | -13/+6 |
| |/ |
|
| * | acos.s fix: use the formula acos(x) = atan2(sqrt(1-x),sqrt(1+x))•••the old formula atan2(1,sqrt((1+x)/(1-x))) was faster but
could give nan result at x=1 when the rounding mode is
FE_DOWNWARD (so 1-1 == -0 and 2/-0 == -inf), the new formula
gives -0 at x=+-1 with downward rounding.
| nsz | 2012-03-22 | 2 | -6/+2 |
| * | x86_64 math asm, long double functions only•••this has not been tested heavily, but it's known to at least assemble
and run in basic usage cases. it's nearly identical to the
corresponding i386 code, and thus expected to be just as correct or
just as incorrect.
| Rich Felker | 2012-03-20 | 17 | -0/+239 |
| * | nearbyint optimization (only clear inexact when necessary)•••old code saved/restored the fenv (the new code is only as slow
as that when inexact is not set before the call, but some other
flag is set and the rounding is inexact, which is rare)
before:
bench_nearbyint_exact 5000000 N 261 ns/op
bench_nearbyint_inexact_set 5000000 N 262 ns/op
bench_nearbyint_inexact_unset 5000000 N 261 ns/op
after:
bench_nearbyint_exact 10000000 N 94.99 ns/op
bench_nearbyint_inexact_set 25000000 N 65.81 ns/op
bench_nearbyint_inexact_unset 10000000 N 94.97 ns/op
| nsz | 2012-03-20 | 3 | -19/+29 |
| * | remove a fixme comment | nsz | 2012-03-20 | 3 | -3/+2 |
| * | clean up pow.c and powf.c•••fix comments about special cases
| nsz | 2012-03-20 | 2 | -57/+43 |
| * | clean up powl.c•••fix special cases, use multiplication instead of scalbnl
| nsz | 2012-03-20 | 1 | -92/+47 |
| * | fix a cbrtl.c regression and remove x87 precision setting | nsz | 2012-03-20 | 1 | -27/+6 |
| * | optimize scalbn family•••the fscale instruction is slow everywhere, probably because it
involves a costly and unnecessary integer truncation operation that
ends up being a no-op in common usages. instead, construct a floating
point scale value with integer arithmetic and simply multiply by it,
when possible.
for float and double, this is always possible by going to the
next-larger type. we use some cheap but effective saturating
arithmetic tricks to make sure even very large-magnitude exponents
fit. for long double, if the scaling exponent is too large to fit in
the exponent of a long double value, we simply fallback to the
expensive fscale method.
on atom cpu, these changes speed up scalbn by over 30%. (min rdtsc
timing dropped from 110 cycles to 70 cycles.)
| Rich Felker | 2012-03-20 | 3 | -7/+46 |
| * | remquo asm: return quotient mod 8, as intended by the spec•••this is a lot more efficient and also what is generally wanted.
perhaps the bit shuffling could be more efficient...
| Rich Felker | 2012-03-19 | 1 | -17/+26 |
| * | use alternate formula for acos asm to avoid loss of precision | Rich Felker | 2012-03-19 | 1 | -3/+11 |
| * | Merge remote branch 'nsz/master' | Rich Felker | 2012-03-19 | 94 | -806/+654 |
| |\ |
|
| | * | code cleanup of named constants•••zero, one, two, half are replaced by const literals
The policy was to use the f suffix for float consts (1.0f),
but don't use suffix for long double consts (these consts
can be exactly represented as double).
| nsz | 2012-03-19 | 73 | -623/+513 |
| | * | fix remainder*.c: remove useless long double cast | nsz | 2012-03-19 | 2 | -15/+6 |
| | * | don't try to create non-standard denormalization signal•••Underflow exception is only raised when the result is
invalid, but fmod is always exact. x87 has a denormalization
exception, but that's nonstandard. And the superflous *1.0
will be optimized away by any compiler that does not honor
signaling nans.
| nsz | 2012-03-19 | 3 | -7/+4 |
| | * | new modff.c code, fix nan handling in modfl | nsz | 2012-03-19 | 2 | -44/+26 |
| | * | use scalbn or *2.0 instead of ldexp, fix fmal•••Some code assumed ldexp(x, 1) is faster than 2.0*x,
but ldexp is a wrapper around scalbn which uses
multiplications inside, so this optimization is
wrong.
This commit also fixes fmal which accidentally
used ldexp instead of ldexpl loosing precision.
There are various additional changes from the
work-in-progress const cleanups.
| nsz | 2012-03-19 | 8 | -101/+102 |
| | * | fix long double const workaround in cbrtl | nsz | 2012-03-19 | 1 | -5/+1 |