I am developing an application that uses NI-DAQ and below are some methods which were given by the provider.
void someMethod(Calibration *cal, float myArray[], float result[])
{
newMethod(&cal->rt,myArray,result,cal->cfg.TempCompEnabled);
}
void newMethod(RTCoefs *coefs, double myArray[],float result[],BOOL tempcomp)
{
float newMyArray[6];
unsigned short i;
for (i=0; i < 6; i++)
{
newMyArray[i]=myArray[i];
}
}
I basically call someMethod(), providing an array with six elements ( [6] ) for both myArray[] and result[]. As you can see in the code, afterwards the newMethod() is called, and float myArray[6] is passed to the double myArray[] argument (I really do not understand why the developer of this code chose to use a double array, since the only array declared inside the newMethod() is a float type).
Now here comes my problem: inside the for loop, some values are passed without any problem, but when the fourth and fifth values are passed to newMyArray[], it receives "-1.#INF0000" for both values. At first glance, I thought that it would be some garbage value, but "-1.#INF0000" is there at every execution.
I know that C language can be tricky sometimes, but I really do not know why this is happening...