<feed xmlns='http://www.w3.org/2005/Atom'>
<title>musl/src/math, branch v0.9.2</title>
<subtitle>musl - an implementation of the standard library for Linux-based systems</subtitle>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/'/>
<entry>
<title>math: fix fma bug on x86 (found by Bruno Haible with gnulib)</title>
<updated>2012-06-20T21:25:58+00:00</updated>
<author>
<name>nsz</name>
<email>nsz@port70.net</email>
</author>
<published>2012-06-20T21:25:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=e5fb6820a42a1f675ba09c15273953e1ace65777'/>
<id>e5fb6820a42a1f675ba09c15273953e1ace65777</id>
<content type='text'>
The long double adjustment was wrong:
The usual check is
  mant_bits &amp; 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 &amp; 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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The long double adjustment was wrong:
The usual check is
  mant_bits &amp; 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 &amp; 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.
</pre>
</div>
</content>
</entry>
<entry>
<title>support ld80 pseudo-denormal invalid bit patterns; treat them as nan</title>
<updated>2012-06-20T19:15:10+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2012-06-20T19:15:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=fad231b9609470e4c51b29b6bcb9abd23b7e9346'/>
<id>fad231b9609470e4c51b29b6bcb9abd23b7e9346</id>
<content type='text'>
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...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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...
</pre>
</div>
</content>
</entry>
<entry>
<title>use fistpll mnemonic instead of fistpq (more widely supported) on x86_64 too</title>
<updated>2012-06-02T20:48:22+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2012-06-02T20:48:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=19e48c5531fda9c4767b99b754cb9345902dd100'/>
<id>19e48c5531fda9c4767b99b754cb9345902dd100</id>
<content type='text'>
this was fixed previously on i386 but the corresponding code on x86_64
was missed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
this was fixed previously on i386 but the corresponding code on x86_64
was missed.
</pre>
</div>
</content>
</entry>
<entry>
<title>math: fix remquo.c when x==-y and a subnormal remainder bug as well</title>
<updated>2012-05-07T22:22:56+00:00</updated>
<author>
<name>nsz</name>
<email>nsz@port70.net</email>
</author>
<published>2012-05-07T22:22:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=3738a96e052603403e085e9a1024289ba3e09188'/>
<id>3738a96e052603403e085e9a1024289ba3e09188</id>
<content type='text'>
backported fix from freebsd:
http://svnweb.FreeBSD.org/base?view=revision&amp;revision=233973
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
backported fix from freebsd:
http://svnweb.FreeBSD.org/base?view=revision&amp;revision=233973
</pre>
</div>
</content>
</entry>
<entry>
<title>some assemblers don't like fistpq; use the alt. mnemonic fistpll</title>
<updated>2012-05-07T22:05:50+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2012-05-07T22:05:50+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=0e195dfaa4902a73179f7ab296d47f01d3518ad3'/>
<id>0e195dfaa4902a73179f7ab296d47f01d3518ad3</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>add FORCE_EVAL macro to evaluate float expr for their side effect</title>
<updated>2012-05-06T19:24:28+00:00</updated>
<author>
<name>nsz</name>
<email>nsz@port70.net</email>
</author>
<published>2012-05-06T19:24:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=6ab8136b4477fd75381c06fa0e7fa93c89c712a1'/>
<id>6ab8136b4477fd75381c06fa0e7fa93c89c712a1</id>
<content type='text'>
updated nextafter* to use FORCE_EVAL, it can be used in many other
places in the math code to improve readability.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
updated nextafter* to use FORCE_EVAL, it can be used in many other
places in the math code to improve readability.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix unused variable warnings in new nextafter/nexttoward code</title>
<updated>2012-05-06T18:48:20+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2012-05-06T18:48:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=4e597feef0595caefa39ab43c813734a1244fa84'/>
<id>4e597feef0595caefa39ab43c813734a1244fa84</id>
<content type='text'>
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).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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).
</pre>
</div>
</content>
</entry>
<entry>
<title>math: nextafter and nexttoward cleanup</title>
<updated>2012-05-06T11:08:59+00:00</updated>
<author>
<name>nsz</name>
<email>nsz@port70.net</email>
</author>
<published>2012-05-06T11:08:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=6cf865dba69bab6346dc268d9173609af36b984e'/>
<id>6cf865dba69bab6346dc268d9173609af36b984e</id>
<content type='text'>
make nexttoward, nexttowardf independent of long double representation.
fix nextafterl: it did not raise underflow flag when the result was 0.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
make nexttoward, nexttowardf independent of long double representation.
fix nextafterl: it did not raise underflow flag when the result was 0.
</pre>
</div>
</content>
</entry>
<entry>
<title>math: change the formula used for acos.s</title>
<updated>2012-05-04T23:11:56+00:00</updated>
<author>
<name>nsz</name>
<email>nsz@port70.net</email>
</author>
<published>2012-05-04T23:11:56+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=f697d66b81912af59128ac1b96bc0e2a4514b758'/>
<id>f697d66b81912af59128ac1b96bc0e2a4514b758</id>
<content type='text'>
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)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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)
</pre>
</div>
</content>
</entry>
<entry>
<title>support alternate glibc name pow10 for exp10</title>
<updated>2012-05-01T04:07:37+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2012-05-01T04:07:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=a917c03706d94564082d5ccff032a3e2c3dad537'/>
<id>a917c03706d94564082d5ccff032a3e2c3dad537</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
