simbha
07-29-2011, 02:46 PM
Hello,
I am trying to link the NR library with my code and when I compile my code I get the following warning messages:
1>nrutil_nr.h(43) : warning C4244: 'return' : conversion from 'const double' to 'float', possible loss of data
1>nrutil_nr.h(468) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
1>nrutil_nr.h(469) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
1>nrutil_nr.h(470) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
1>nrutil_nr.h(471) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
On looking into the nrutil_nr.h file the problem seems to be in these lines
//some compilers choke on pow(float,double) in single precision. also atan2
inline float pow (float x, double y) {return pow(double(x),y);}
inline float pow (double x, float y) {return pow(x,double(y));}
inline float atan2 (float x, double y) {return atan2(double(x),y);}
inline float atan2 (double x, float y) {return atan2(x,double(y));}
I do understand that these warnings aren't a showstopper but still, what must I do to avoid these warning messages? Please do not ask me to suppress these messages because I these warnings are needed to ensure that I don't lose precision accidentally in my code.
I am using VC++ 2008 express and the CPP_211 legacy routines.
Thanks in advance
I am trying to link the NR library with my code and when I compile my code I get the following warning messages:
1>nrutil_nr.h(43) : warning C4244: 'return' : conversion from 'const double' to 'float', possible loss of data
1>nrutil_nr.h(468) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
1>nrutil_nr.h(469) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
1>nrutil_nr.h(470) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
1>nrutil_nr.h(471) : warning C4244: 'return' : conversion from 'double' to 'float', possible loss of data
On looking into the nrutil_nr.h file the problem seems to be in these lines
//some compilers choke on pow(float,double) in single precision. also atan2
inline float pow (float x, double y) {return pow(double(x),y);}
inline float pow (double x, float y) {return pow(x,double(y));}
inline float atan2 (float x, double y) {return atan2(double(x),y);}
inline float atan2 (double x, float y) {return atan2(x,double(y));}
I do understand that these warnings aren't a showstopper but still, what must I do to avoid these warning messages? Please do not ask me to suppress these messages because I these warnings are needed to ensure that I don't lose precision accidentally in my code.
I am using VC++ 2008 express and the CPP_211 legacy routines.
Thanks in advance