This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problems with double variables

Hi there, i have a problem with a pointer to a double, if i debug the following code the memory-space between two double variables is just 4 Bytes and not 8. Also i have a problem to assign the variables the maximum value that should be possible

Is there a bug in the c166 compiler? Am i just too stupid?

Any help would bee nice.

Regards

void main (void)
{
	//double variables
	double test1;
	double test2;

	//pointer to double
	double  *ptest1;
	double  *ptest2;

	//give some values
	test1=1;
	test2=2;

	//assign ptest1 the address of test1
	ptest1=&test1;
	//assign ptest2 the address of test2
	ptest2=&test2;

	//change nothing
	//(just do see ptest1 in debugger->watch)
	ptest1++;
	ptest1--;

	//change nothing
	//(just do see ptest2 in debugger->watch)
	ptest2++;
	ptest2--;

	//shows 1.#inf in debugger->watch why?
	//maximum should bee +-1.7E-308 to +-1.7E+308
	*ptest1=((3.40E+38)+(1E+38));

	//does not compile error C22 constant to big
//	*ptest2=-1.7E-308;

	while (1);	//stay here
}