IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 21 years ago

Closed 21 years ago

Last modified 21 years ago

#460 closed defect (fixed)

float vs. double in polynomial functions

Reported by: David.Robbins@… Owned by: Paul Price
Priority: high Milestone:
Component: PSLib SDRS Version: unspecified
Severity: normal Keywords:
Cc:

Description

It appears that the functions formerly 'psDPolynomial?D' and 'psPolynomial?D'
have been merged into one data type. However, the evaluation functions only
use psF64 arguments and return psF64. Shouldn't the psF32 part of psPolynomial
either be dropped or the eval functions changed correspondingly? Also, the
allocators for psPolynomial only take 'int' elements. Shouldn't this also be
changed to unsigned long or at least unsigned int?

Change History (2)

comment:1 by Paul Price, 21 years ago

Cc: jhoblitt@… added
Resolution: fixed
Status: newclosed

The evaluation functions use double precision values as arguments and return so
that the float and double version of the polynomials can be amalgamated into a
single function. We keep the float version around in the interest of speed; the
double in the interest of precision.

I think the allocators should be unsigned, like you say.

typedef struct {

psPolynomialType type; /< Polynomial type
psElemType ctype;
/< Polynomial precision
unsigned int n; /< Number of terms
union {

psF32 *F32; /< Coefficients
psF64 *F64;
/< Coefficients

} coeff;
union {

psF32 *F32; /< Error in coefficients
psF64 *F64;
/< Error in coefficients

} coeffErr;
char *mask; /< Coefficient mask

} psPolynomial1D;

psPolynomial1D *psPolynomial1DAlloc(psPolynomialType type,

psElemType ctype,
unsigned int nX);

(etc)

Also noticed the spline just below has the same issue, so changed to:

typedef struct {

unsigned int n; /< Number of spline pieces
psPolynomial1D spline;
/< Array of n pointers to splines
psVector *knots; /< The boundaries between each spline

piece. Size is n+1.
} psSpline1D;

psSpline1D *psSpline1DAlloc(unsigned int n, unsigned int order, float min, float
max);
psSpline1D *psSpline1DAllocGeneric(const psVector *bounds, unsigned int order);

comment:2 by Paul Price, 21 years ago

Removed the support for both F32 and F64. Now polynomials only contain F64.

Note: See TracTickets for help on using tickets.