math.h / complex - issue porting 2002 app to 2003

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I noticed when migrating a 2002 application to 2003 that the system changed
to a different usage for pow(2,-15).
In 2002, it used double pow(double,double).
In 2003, it is using double pow(int,int).
You may note that pow(2,-15) and pow(2.0,-15.0) give different results.
math.h is included.
Is there some way to force studio to not use the complex prototypes?
math.h is the only include file being used. Why is it even linking to the
others?
Is there a project option to control that?
I'd rather not go through and verify every math operation in this code for
prototype changes..
 
Andy said:
Hi,
I noticed when migrating a 2002 application to 2003 that the system changed
to a different usage for pow(2,-15).
In 2002, it used double pow(double,double).
In 2003, it is using double pow(int,int).
You may note that pow(2,-15) and pow(2.0,-15.0) give different results.
math.h is included.
Is there some way to force studio to not use the complex prototypes?
math.h is the only include file being used. Why is it even linking to the
others?
Is there a project option to control that?
I'd rather not go through and verify every math operation in this code for
prototype changes..

The compiler is going to choose the function that has matching argument types, if one is present,
since that's a C++ requirement. If pow(int, int) has been added to <math.h> since 2002 then it's
going to choose that for 2, -15. I don't see how any project options could change the language rules
just for math functions, and I don't see any #ifdefs in the header for excluding the new functions
in C++. I suspect that you're going to have to pass doubles if you want pow(double, double) or
compile it as C instead of C++. My knowledge of 2003 (and 2002) is very limited, however.

DW
 
Back
Top