[PATCH] libm/complex: add clog10, clog10f

Corinna Vinschen vinschen@redhat.com
Mon Feb 22 09:21:00 GMT 2016


On Feb 18 16:55, Craig Howland wrote:
> 
> 
> On 02/18/2016 11:53 AM, Yaakov Selkowitz wrote:
> >...
> >diff --git a/newlib/libm/complex/clog10f.c b/newlib/libm/complex/clog10f.c
> >new file mode 100644
> >index 0000000..98cf606
> >--- /dev/null
> >+++ b/newlib/libm/complex/clog10f.c
> >@@ -0,0 +1,15 @@
> >+#include <complex.h>
> >+#include <math.h>
> >+
> >+float complex
> >+clog10f(float complex z)
> >+{
> >+	float complex w;
> >+	float p, rr;
> >+
> >+	rr = cabsf(z);
> >+	p = log10f(rr);
> >+	rr = atan2f(cimagf(z), crealf(z)) * M_IVLN10;
> >+	w = p + rr * I;
> >+	return w;
> >+}
> >...
> The rr calculation needs a cast for the constant, otherwise it will use
> double for the multiply:
> 
> 	rr = atan2f(cimagf(z), crealf(z)) * (float) M_IVLN10;
> 
> Craig

Interesting point, yes.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20160222/9c91c5f3/attachment.sig>


More information about the Newlib mailing list