www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2015/07/19/04:18:53

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Subject: Re: djgpp: djgpp/src/libm/math/wf_log2.c
To: "DJGPP List (E-mail)" <djgpp AT delorie DOT com>
References: <201507181716 DOT t6IHGTap023239 AT delorie DOT com>
From: "Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Message-ID: <55AB5D62.7040405@iki.fi>
Date: Sun, 19 Jul 2015 11:18:42 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
Thunderbird/38.1.0
MIME-Version: 1.0
In-Reply-To: <201507181716.t6IHGTap023239@delorie.com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 07/18/2015 08:16 PM, cvs-juan DOT guerrero AT delorie DOT com wrote:
> Update by cvs id: juan.guerrero
> Update of /cvs/djgpp/djgpp/src/libm/math
>
> Added Files:
>        Tag: v2_05_1
> 	wf_log2.c
> Log Message:
> Wrapper function for log2f.

Did You tried to compile it:

Konsole output
[andris AT ap include]$ grep -r log2 *
libm/math.h:extern double log2 __P((double));
libm/math.h:#define log2f(x) (logf (x) / (float) M_LOG2_E)
math.h:double log2(double _x);
math.h:extern float log2f(float);

As result:



> ===================================================================
> RCS file: /cvs/djgpp/djgpp/src/libm/math/wf_log2.c,v
> retrieving revision 1.1.2.2
> diff -p -2 /dev/null -r1.1.2.2
> --- /dev/null	2015-07-02 13:23:02.739999979 -0400
> +++ notify.23223	2015-07-18 13:16:29.811861406 -0400
> @@ -0,0 +1,64 @@
> +/* wf_log2.c -- float version of w_log2.c.
> + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian AT cygnus DOT com.
> + */
> +
> +/*
> + * ====================================================
> + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
> + *
> + * Developed at SunPro, a Sun Microsystems, Inc. business.
> + * Permission to use, copy, modify, and distribute this
> + * software is freely granted, provided that this notice
> + * is preserved.
> + * ====================================================
> + */
> +
> +/*
> + * wrapper log2f(X)
> + */
> +
> +#include "fdlibm.h"
> +#include <libc/ieee.h>
> +
> +#ifdef __STDC__
> +	float log2f(float x)		/* wrapper log2f */
> +#else
> +	float log2f(x)			/* wrapper log2f */
> +	float x;
> +#endif
> +{
> +#ifdef _IEEE_LIBM
> +	return __ieee754_log2f(x);
> +#else
> +	_float_long_union ux;
> +	float z;
> +	
> +	ux.f = x;
> +
> +	z = __ieee754_log2f(x);
> +	if(_LIB_VERSION == _IEEE_ || isnanf(ux.l)) return z;
> +	if(x<=(float)0.0) {
> +	    if(x==(float)0.0)
> +	        /* log2(0) */
> +	        return (float)__kernel_standard((double)x,(double)x,127);
> +	    else
> +	        /* log2(x<0) */
> +	        return (float)__kernel_standard((double)x,(double)x,128);
> +	} else
> +	    return z;
> +#endif
> +}
> +
> +#ifdef _DOUBLE_IS_32BITS
> +
> +#ifdef __STDC__
> +	double log2(double x)
> +#else
> +	double log2(x)
> +	double x;
> +#endif
> +{
> +	return (double) log2f((float) x);
> +}
> +
> +#endif /* defined(_DOUBLE_IS_32BITS) */
>
>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019