#460 closed defect (fixed)
float vs. double in polynomial functions
| Reported by: | 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 , 21 years ago
| Cc: | added |
|---|---|
| Resolution: | → fixed |
| Status: | new → closed |
comment:2 by , 21 years ago
Removed the support for both F32 and F64. Now polynomials only contain F64.
Note:
See TracTickets
for help on using tickets.

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 {
} psPolynomial1D;
psPolynomial1D *psPolynomial1DAlloc(psPolynomialType type,
(etc)
Also noticed the spline just below has the same issue, so changed to:
typedef struct {
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);