<feed xmlns='http://www.w3.org/2005/Atom'>
<title>musl/src/complex, branch v1.2.5</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: avoid runtime conversions of floating-point constants</title>
<updated>2022-03-08T21:27:15+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>nsz@port70.net</email>
</author>
<published>2022-02-04T20:04:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=7c0c7a75ec8ecf3eedefc40bb4dae5aaa76d7108'/>
<id>7c0c7a75ec8ecf3eedefc40bb4dae5aaa76d7108</id>
<content type='text'>
gcc-12 with -frounding-mode will do inexact constant conversions at
runtime according to the runtime rounding mode.

in the math library we want constants to be rounding mode independent
so this patch fixes cases where new runtime conversions happen with
gcc-12.

fortunately this only affects two minor cases, the fix uses global
initializers where rounding mode does not apply.

after the patch the same amount of conversions happen with gcc-12 as
with gcc-11.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
gcc-12 with -frounding-mode will do inexact constant conversions at
runtime according to the runtime rounding mode.

in the math library we want constants to be rounding mode independent
so this patch fixes cases where new runtime conversions happen with
gcc-12.

fortunately this only affects two minor cases, the fix uses global
initializers where rounding mode does not apply.

after the patch the same amount of conversions happen with gcc-12 as
with gcc-11.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix potentially wrong-sign zero in cproj functions at infinity</title>
<updated>2022-01-18T22:31:46+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2022-01-18T22:31:46+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=75b3412f3dbda8f1fc6818b8b0cf1d0737c2163c'/>
<id>75b3412f3dbda8f1fc6818b8b0cf1d0737c2163c</id>
<content type='text'>
these are specified to use the sign of the imaginary part of the input
as the sign of zero in the result, but wrongly copied the sign of the
real part.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
these are specified to use the sign of the imaginary part of the input
as the sign of zero in the result, but wrongly copied the sign of the
real part.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix incorrect results for catanf and catanl with some inputs</title>
<updated>2020-02-05T14:40:11+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2020-02-05T14:40:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=11020620813b828917bc31b4636d8a142f7a564a'/>
<id>11020620813b828917bc31b4636d8a142f7a564a</id>
<content type='text'>
catan was fixed in 10e4bd3780050e75b72aac5d85c31816419bb17d but the
same bug in catanf and catanl was overlooked. the patch is completely
analogous.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
catan was fixed in 10e4bd3780050e75b72aac5d85c31816419bb17d but the
same bug in catanf and catanl was overlooked. the patch is completely
analogous.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix cacosh results for arguments with negative imaginary part</title>
<updated>2019-10-14T13:08:22+00:00</updated>
<author>
<name>Michael Morrell</name>
<email>mmorrell@tachyum.com</email>
</author>
<published>2019-10-14T13:07:31+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=aa2d23e57c9c95f0ffeb80cb035e5a5be52d8ef0'/>
<id>aa2d23e57c9c95f0ffeb80cb035e5a5be52d8ef0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>math: move complex math out of libm.h</title>
<updated>2019-04-17T17:03:52+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>nsz@port70.net</email>
</author>
<published>2018-11-29T22:09:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=2d72b58070bc43a727b580a46746e87215a60a33'/>
<id>2d72b58070bc43a727b580a46746e87215a60a33</id>
<content type='text'>
This makes it easier to build musl math code with a compiler that
does not support complex types (tcc) and in general more sensible
factorization of the internal headers.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes it easier to build musl math code with a compiler that
does not support complex types (tcc) and in general more sensible
factorization of the internal headers.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix incorrect results for catan with some inputs</title>
<updated>2018-04-11T19:05:22+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-04-11T19:05:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=10e4bd3780050e75b72aac5d85c31816419bb17d'/>
<id>10e4bd3780050e75b72aac5d85c31816419bb17d</id>
<content type='text'>
the catan implementation from OpenBSD includes a FIXME-annotated
"overflow" branch that produces a meaningless and incorrect
large-magnitude result. it was reachable via three paths,
corresponding to gotos removed by this commit, in order:

1. pure imaginary argument with imaginary component greater than 1 in
   magnitude. this case does not seem at all exceptional and is
   handled (at least with the quality currently expected from our
   complex math functions) by the existing non-exceptional code path.

2. arguments on the unit circle, including the pure-real argument 1.0.
   these are not exceptional except for ±i, which should produce
   results with infinite imaginary component and which lead to
   computation of atan2(±0,0) in the existing non-exceptional code
   path. such calls to atan2() however are well-defined by POSIX.

3. the specific argument +i. this route should be unreachable due to
   the above (2), but subtle rounding effects might have made it
   possible in rare cases. continuing on the non-exceptional code path
   in this case would lead to computing the (real) log of an infinite
   argument, then producing a NAN when multiplying it by I.

for now, remove the exceptional code paths entirely. replace the
multiplication by I with construction of a complex number using the
CMPLX macro so that the NAN issue (3) prevented cannot arise.

with these changes, catan should give reasonably correct results for
real arguments, and should no longer give completely-wrong results for
pure-imaginary arguments outside the interval (-i,+i).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
the catan implementation from OpenBSD includes a FIXME-annotated
"overflow" branch that produces a meaningless and incorrect
large-magnitude result. it was reachable via three paths,
corresponding to gotos removed by this commit, in order:

1. pure imaginary argument with imaginary component greater than 1 in
   magnitude. this case does not seem at all exceptional and is
   handled (at least with the quality currently expected from our
   complex math functions) by the existing non-exceptional code path.

2. arguments on the unit circle, including the pure-real argument 1.0.
   these are not exceptional except for ±i, which should produce
   results with infinite imaginary component and which lead to
   computation of atan2(±0,0) in the existing non-exceptional code
   path. such calls to atan2() however are well-defined by POSIX.

3. the specific argument +i. this route should be unreachable due to
   the above (2), but subtle rounding effects might have made it
   possible in rare cases. continuing on the non-exceptional code path
   in this case would lead to computing the (real) log of an infinite
   argument, then producing a NAN when multiplying it by I.

for now, remove the exceptional code paths entirely. replace the
multiplication by I with construction of a complex number using the
CMPLX macro so that the NAN issue (3) prevented cannot arise.

with these changes, catan should give reasonably correct results for
real arguments, and should no longer give completely-wrong results for
pure-imaginary arguments outside the interval (-i,+i).
</pre>
</div>
</content>
</entry>
<entry>
<title>fix wrong result in casin and many related complex functions</title>
<updated>2018-04-09T17:25:35+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2018-04-09T16:33:17+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=ae2a01da2e388535da243b3d974aef74a3c06ae0'/>
<id>ae2a01da2e388535da243b3d974aef74a3c06ae0</id>
<content type='text'>
the factor of -i noted in the comment at the top of casin.c was
omitted from the actual code, yielding a result rotated 90 degrees and
propagating into errors in other functions defined in terms of casin.

implement multiplication by -i as a rotation of the real and imaginary
parts of the result, rather than by actual multiplication, since the
latter cannot be optimized without knowledge that the operand is
finite. here, the rotation is the actual intent, anyway.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
the factor of -i noted in the comment at the top of casin.c was
omitted from the actual code, yielding a result rotated 90 degrees and
propagating into errors in other functions defined in terms of casin.

implement multiplication by -i as a rotation of the real and imaginary
parts of the result, rather than by actual multiplication, since the
latter cannot be optimized without knowledge that the operand is
finite. here, the rotation is the actual intent, anyway.
</pre>
</div>
</content>
</entry>
<entry>
<title>complex: fix ctanh(+-0+i*nan) and ctanh(+-0+-i*inf)</title>
<updated>2015-05-01T17:37:42+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>nsz@port70.net</email>
</author>
<published>2015-04-21T23:04:11+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=b02eed9c4841913d690a2d0029737d72615384fe'/>
<id>b02eed9c4841913d690a2d0029737d72615384fe</id>
<content type='text'>
These cases were incorrect in C11 as described by
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1886.htm
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These cases were incorrect in C11 as described by
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1886.htm
</pre>
</div>
</content>
</entry>
<entry>
<title>complex: add C11 CMPLX macros and replace cpack with them</title>
<updated>2012-11-13T00:31:49+00:00</updated>
<author>
<name>Szabolcs Nagy</name>
<email>nsz@port70.net</email>
</author>
<published>2012-11-13T00:31:49+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=cfbaba79a2dd380e580a247b8fd36af60c878e8f'/>
<id>cfbaba79a2dd380e580a247b8fd36af60c878e8f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>add creal/cimag macros in complex.h (and use them in the functions defs)</title>
<updated>2012-03-22T19:54:55+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2012-03-22T19:54:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=13e400b3559666b5e584bdf6f8450aad826b43ae'/>
<id>13e400b3559666b5e584bdf6f8450aad826b43ae</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
