[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] working SSRP
From: |
Berndt Josef Wulf |
Subject: |
Re: [Discuss-gnuradio] working SSRP |
Date: |
Wed, 22 Dec 2004 10:43:15 +1030 |
User-agent: |
KMail/1.7.1 |
On Wednesday 22 December 2004 08:17, Eric Blossom wrote:
> On Wed, Dec 22, 2004 at 09:04:18AM +1030, Berndt Josef Wulf wrote:
> > G'day,
> >
> > I'm getting an error when running src/tests/test_general
> >
> > !!!FAILURES!!!
> > Test Results:
> > Run: 13 Failures: 1 Errors: 0
> >
> >
> > 1) test: qa_gr_fxpt::t0 (F) line: 40 qa_gr_fxpt.cc
> > equality assertion failed
> > - Expected: 1073741824
> > - Actual : 1073741810
> >
> > I suspect it to be due to rounding errors occuring in float_to_fixed()
> >
> > Anyone else seeing this?
> >
> > cheerio Berndt
>
> A couple of other folks have seen it.
>
> I'll take a look at it in a bit. The problem might be related to
> different values (or precisions) of M_PI in different compiler
> versions. I'll loosen up the tolerance of the check.
FYI:
The following test provides the correct answer on NetBSD with
#define M_PI 3.14159265358979323846 /* pi */
from the math library header file (note the typecast to float).
------------------------ test.c -----------------------------
#include <math.h>
#include <sys/types.h>
static const float TWO_TO_THE_31 = 2147483648.0;
static const float PI = 3.14159265358979323846;
int main(void)
{
printf("result = %ld \n", (int32_t)((float) (M_PI / 2.0 *
TWO_TO_THE_31/PI)));
return 0;
}
------------------------ test.c -----------------------------
husky: {134} ./test
result = 1073741824
cheerio Berndt
pgprPeLxVfrs1.pgp
Description: PGP signature