Keil™, An ARM® Company

Discussion Forum

problems with double variables

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Michaela Doser
Posted
29-Mar-2003 07:32
Toolset
C166
New! 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
}
Read-Only
Author
Jon Ward
Posted
29-Mar-2003 10:44
Toolset
C166
New! RE: problems with double variables
Take a look at the following knowledgebase article.

http://www.keil.com/support/docs/803.htm

Jon
Read-Only
Author
Michaela Doser
Posted
31-Mar-2003 01:49
Toolset
C166
New! thanks again
now it works fine...

Regards

Next Thread | Thread List | Previous Thread Start a Thread | Settings