Re: [Mingw-w64-public] [PATCH 4/5] RFC: arm: Make sure to at least run a certain number of rounds in 'log' functions

2016-08-08 Thread André Hentschel
Am 08.08.2016 um 15:24 schrieb Martin Storsjö:
> ---
> The value 30 is a blind guesstimate of what's sensible; with that, I
> get log() returning values close to the real values (differing only in
> the third digit or so).
> 
> I'm not sure exactly how the original logic for the number of rounds
> is supposed to work; with any value over 16, it will currently
> run 0 rounds and return 0.
> ---
>  mingw-w64-crt/math/softmath/softmath_private.h | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/mingw-w64-crt/math/softmath/softmath_private.h 
> b/mingw-w64-crt/math/softmath/softmath_private.h
> index 72df747..401f7c6 100644
> --- a/mingw-w64-crt/math/softmath/softmath_private.h
> +++ b/mingw-w64-crt/math/softmath/softmath_private.h
> @@ -61,6 +61,9 @@ static inline double softmath_log(double x)
>  else if (x < 0.0001)
>  aprox = 32768;
>  
> +if (aprox < 30)
> +aprox = 30;
> +
>  for(n = 0; n < aprox; n++)
>  {
>  result += bsd__ieee754_pow((x - 1.0) / (x + 1.0), 2 * n + 1) * (1.0 
> / (2.0 * n + 1.0));
> @@ -82,6 +85,9 @@ static inline float softmath_logf(float x)
>  else if (x < 0.0001)
>  aprox = 32768;
>  
> +if (aprox < 30)
> +aprox = 30;
> +
>  for(n = 0; n < aprox; n++)
>  {
>  result += bsd__ieee754_powf((x - 1.0) / (x + 1.0), 2 * n + 1) * (1.0 
> / (2.0 * n + 1.0));
> 

looks good

--
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


Re: [Mingw-w64-public] [PATCH 4/5] RFC: arm: Make sure to at least run a certain number of rounds in 'log' functions

2016-08-08 Thread Martin Storsjö

On Mon, 8 Aug 2016, Martin Storsjö wrote:


---
The value 30 is a blind guesstimate of what's sensible; with that, I
get log() returning values close to the real values (differing only in
the third digit or so).

I'm not sure exactly how the original logic for the number of rounds
is supposed to work; with any value over 16, it will currently
run 0 rounds and return 0.
---
mingw-w64-crt/math/softmath/softmath_private.h | 6 ++
1 file changed, 6 insertions(+)

diff --git a/mingw-w64-crt/math/softmath/softmath_private.h 
b/mingw-w64-crt/math/softmath/softmath_private.h
index 72df747..401f7c6 100644
--- a/mingw-w64-crt/math/softmath/softmath_private.h
+++ b/mingw-w64-crt/math/softmath/softmath_private.h
@@ -61,6 +61,9 @@ static inline double softmath_log(double x)
else if (x < 0.0001)
aprox = 32768;

+if (aprox < 30)
+aprox = 30;
+
for(n = 0; n < aprox; n++)
{
result += bsd__ieee754_pow((x - 1.0) / (x + 1.0), 2 * n + 1) * (1.0 / 
(2.0 * n + 1.0));


A second solution would possibly be to drop the libmingwex log functions 
altogether - why are they needed? AFAIK, msvcrt.dll has got log 
implemented, at least since quite some time. (Long enough for the ARM 
target at least.)


// Martin--
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public