-nan(ind) error when C++ code put through visual studio 2017 debugger (on Windows 8)

Hello, I am writing some code in C++ on visual studio 2017 (Windows 8). I put it through the visual studio debugger and my method variable double muaSKbaseline is showing a value of -nan(ind) in the autos area of the debugger when I go through the code line by line with the debugger. Is this bad and if so how to I fix this? The method/function I went through is shown below. Thank you (Sorry about the code not being inline).
1
2
3
4
5
6
7
  
	double getskinBaselineAbs(double IR_wavel) {
		double muaSKbaseline;
		
muaSKbaseline=(7.84e8)*pow(IR_wavel,3.255);																		
		return muaSKbaseline;
	}
Hi,

What is the value of IR_wavel ? Was is initialised ?

What happens if you do the same thing on a calculator, or in a spreadsheet?

If there are limits on the valid value a variable can have, you should check them with code before using them.

Good Luck !!
Last edited on
nan(ind) means "not a number" or "indeterminate".

This problem is most likely because IR_wavel is a NaN or outside the domain of std::pow, i.e., less-than 0.
Please read the documentation for std::pow and make sure that its input is correct.

N.B.: you can return any expression with the correct type:
1
2
3
double getskinBaselineAbs(double IR_wavel) {
  return (7.84e8) * pow(IR_wavel,3.255);
}
Last edited on
The IR_wavel variable is a wavelength floating point value between 650 and 1350 nm that the user chooses. Sorry for the late response
Hi,

The IR_wavel variable is a wavelength floating point value between 650 and 1350 nm that the user chooses. Sorry for the late response


That is the value that variable should have, what actual value does it have in the debugger? Was it initialised?
Topic archived. No new replies allowed.