Problems with using float malloc()

HI

chip : NRF52832

tool : segger embedded studio

SDK : 17.0.0

I have a problem using malloc().
I simply tested it like this:

#define ds_len 500

float* test_data= (float*)malloc(sizeof(float)*ds_len);

for(i=0; i<ds_len;i++)

{

      test_data[i] = 99;

      sprintf(ch, "%.2lf",test_data[i]);

      println(ch);

}

for(i=0;i<ds_len;i++)

{

      sprintf(ch, "%.2lf",test_data[i]);

      println(ch);

}

I allocated memory as a float, saved the data and read it back.
However, the values of the saved data and the output data are different.

Allocating memory with 'int' works normally.
please check.

Related