[PATCH] libm/complex: add clog10, clog10f

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


Hi Yaakov,

On Feb 18 10:53, Yaakov Selkowitz wrote:
> 	newlib/
> 	* libc/include/complex.h (clog10, clog10f): Declare.
> 	* libm/complex/Makefile.am (src): Add clog10.c.
> 	(fsrc): Add clog10f.c.
> 	(CHEWOUT_FILES): Add clog10.def.
> 	* libm/complex/Makefile.in: Regenerate.
> 	* libm/complex/clog10.c: New file.
> 	* libm/complex/clog10f.c: New file.
> 	* libm/complex/complex.tex: Add references to clog10 docs.
> 
> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
> ---
> [...]
> +#include <complex.h>
> +#include <math.h>
> +
> +double complex
> +clog10(double complex z)
> +{
> +	double complex w;
> +	double p, rr;
> +
> +	rr = cabs(z);
> +	p = log10(rr);
> +	rr = atan2(cimag(z), creal(z)) * M_IVLN10;
> +	w = p + rr * I;
> +	return w;
> +}
> 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;
> +}

Did you write these functions by yourself or did you fetch them from
some upstream?  If so, where from?

My complex math is next to inexistent, but I took a look into the glibc
man page.  The man page says "clog10(z) is equivalent to clog(z)/log(10)".
The above is equivalent, I take it?


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/9025df9e/attachment.sig>


More information about the Newlib mailing list