Re: Nokia n900 and Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message
Jerome said...
Program received signal SIGILL, Illegal Instruction.  
0x002ff9b4 in decompress (c=251) at be_decompress.c:75 
75        d = (double)*(float *)string_ptr; 
 

So this has to do with 4-byte floating point numbers but I'm not sure why there would be an error. Thoughts?

Yeah, that seems like it should work. Try adding a float variable to the function:

    float f; 
    .... 
    f = *(float*)string_ptr; 
    d = (double) f; 

Also, does this operation always fail? Try something like the following (stand alone):

// bug.c 
// gcc bug.c -o bug 
#include <stdio.h> 
 
int main(){ 
	char string_ptr[10]; 
	float f; 
	double d; 
	 
	// 3.5 in 32-bit floating point: 
	string_ptr[0] = 0; 
	string_ptr[1] = 0; 
	string_ptr[2] = 96; 
	string_ptr[3] = 64; 
	 
	f = *(float*)string_ptr; 
	d = (double) f; 
	d = (double)*(float*)string_ptr; 
	printf("float: %g  double: %g\n", f, d ); 
	 
	return 0; 
} 

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu