gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

C/C++ > Copying floats

#141479 - Lazy1 - Wed Sep 26, 2007 2:40 am

Why is it that when I try to copy a floating point variable into shared memory the arm9 doesn't read it correctly?

For example, the arm7 wants to print a float value to the console.
I copy the value into a buffer in the main ram, tell the arm9 to print a float, flush the cache and print the value in the shared buffer.

This always comes out as a large negative number.
It's probably something stupid on my end but why is this happening?

#141494 - keldon - Wed Sep 26, 2007 7:44 am

Does the print method support floats?

#141554 - Lazy1 - Wed Sep 26, 2007 10:06 pm

I'm just calling printf on the arm9, something like this:

Code:

printf( "%f", *( ( float* ) IPCBuffer ) );