Dear Members,
I want to convert uint32_t to float, the code :
unsigned int dat = 2248; float float_val; float_val = (double)(dat); NRF_LOG_INFO( "float_val = %.3f\n", float_val );
It's returning nothing, what is missing here ?
Thanks
Dear Members,
I want to convert uint32_t to float, the code :
unsigned int dat = 2248; float float_val; float_val = (double)(dat); NRF_LOG_INFO( "float_val = %.3f\n", float_val );
It's returning nothing, what is missing here ?
Thanks
Hi,
There is a mistake in your code. your float_val variable is a float (32 bit), but you cast dat to a double (64 bit). So you should fix the fast so that you cast it to a float instead.
Hi,
There is a mistake in your code. your float_val variable is a float (32 bit), but you cast dat to a double (64 bit). So you should fix the fast so that you cast it to a float instead.
Hi Einar,
Thanks for the reply,
I will fix it and keep posted, thanks again