IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 12, 2004, 8:24:32 AM (22 years ago)
Author:
harman
Message:

Added FLT_EPSILON to select functions to align results with that of 64 bit platform

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psMatrixVectorArithmetic.c

    r1440 r1516  
    3030 *  @author Ross Harman, MHPCC
    3131 *
    32  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    33  *  @date $Date: 2004-08-09 23:34:57 $
     32 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     33 *  @date $Date: 2004-08-12 18:24:32 $
    3434 *
    3535 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9090
    9191// Conversion for degrees to radians
    92 #define D2R M_PI/180.0
     92#define D2R M_PIl/180.0
    9393
    9494// Conversion for radians to degrees
    95 #define R2D 180.0/M_PI
     95#define R2D 180.0/M_PIl
    9696
    9797// Division with NAN checking
     
    599599}
    600600
    601 // Preprocessor macro function to create arithmetic function operation name
     601// Preprocessor macro function to create arithmetic function operation name. Functions below that add
     602// FLT_EPSILON are done so to align results with a 64 bit computing architecture
    602603#define UNARY_OP(DIM,OUT,IN,OP)                                                                              \
    603604if(!strncmp(OP, "abs", 3)) {                                                                                 \
     
    627628} else if(!strncmp(OP, "log", 3)) {                                                                          \
    628629    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    629         UNARY_TYPE(DIM,OUT,IN,clog(*i1)/log(10.0));                                                 \
     630        UNARY_TYPE(DIM,OUT,IN,clog(*i1)/log(10.0));                                                          \
    630631    } else {                                                                                                 \
    631632        UNARY_TYPE(DIM,OUT,IN,log10(*i1));                                                                   \
     
    639640} else if(!strncmp(OP, "dsin", 4)) {                                                                         \
    640641    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    641         UNARY_TYPE(DIM,OUT,IN,csin(*i1*D2R));                                                                \
     642        UNARY_TYPE(DIM,OUT,IN,csin(*i1*D2R+FLT_EPSILON));                                                    \
    642643    } else {                                                                                                 \
    643644        UNARY_TYPE(DIM,OUT,IN,sin(*i1*D2R));                                                                 \
     
    676677    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    677678        UNARY_TYPE(DIM,OUT,IN,R2D*casin(*i1));                                                               \
    678     } else {                                                                                                 \
    679         UNARY_TYPE(DIM,OUT,IN,R2D*asin(*i1));                                                                \
     679    } else if(PS_IS_PSELEMTYPE_INT(IN->type)) {                                                              \
     680        UNARY_TYPE(DIM,OUT,IN,(R2D*asin(*i1)+FLT_EPSILON));                                                  \
     681    } else {                                                                                                 \
     682        UNARY_TYPE(DIM,OUT,IN,(R2D*asin(*i1)));                                                              \
    680683    }                                                                                                        \
    681684} else if(!strncmp(OP, "acos", 4)) {                                                                         \
     
    688691    if(PS_IS_PSELEMTYPE_COMPLEX(IN->type)) {                                                                 \
    689692        UNARY_TYPE(DIM,OUT,IN,R2D*cacos(*i1));                                                               \
     693    } else if(PS_IS_PSELEMTYPE_INT(IN->type)) {                                                              \
     694        UNARY_TYPE(DIM,OUT,IN,(R2D*acos(*i1)+FLT_EPSILON));                                                  \
    690695    } else {                                                                                                 \
    691696        UNARY_TYPE(DIM,OUT,IN,R2D*acos(*i1));                                                                \
Note: See TracChangeset for help on using the changeset viewer.