Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6936 Discussions

## big difference of kurt between float and double

Beginner
600 Views

I test computing kurtosis by MKL  with float and double , and get strange result as following , why kurt of float and double have such big difference ?

double skew -3.2811 ,kurt 9.3626 ,mean 32.29 ,r2m 1042.57,r3m 33668.46 ,r4m 1087393.04
float skew -3.3029 ,kurt 5.7297 ,mean 32.29 ,r2m 1042.57,r3m 33668.46 ,r4m 1087393.00

``````#define DIM 1
#define N  16
void test_mkl_skew_double()
{
double x[N]= {32.368824, 32.3732567, 32.3706436, 32.3741646, 32.3736801, 32.3755112, 32.3742905, 32.3735313, 32.3738403, 30.9899216, 32.3761978, 32.3737259, 32.3755112, 32.3710899, 32.3742638, 32.3742638};
double mean=0,skew=0,kurt={0},vari=0;
MKL_INT p,n,xst;
int status;
p=DIM;
n=N;
xst=VSL_SS_MATRIX_STORAGE_ROWS;
status = vsldSSNewTask( &task, &p, &n, &xst, x, 0, 0 );
double rm[8]={-1};
status = vsldSSEditTask( task, VSL_SS_ED_SKEWNESS, &skew );
status = vsldSSEditTask( task, VSL_SS_ED_KURTOSIS, &kurt );
MKL_UINT64 mask = VSL_SS_MEAN | VSL_SS_KURTOSIS | VSL_SS_SKEWNESS | VSL_SS_2R_MOM | VSL_SS_3R_MOM | VSL_SS_4R_MOM | VSL_SS_2C_MOM | VSL_SS_3C_MOM | VSL_SS_4C_MOM  ;
printf ("double skew %.4f ,kurt %.4f ,mean %.2f ,r2m %.2f,r3m %.2f ,r4m %.2f\n",skew,kurt,rm[0],rm[1],rm[2],rm[3]);
}
void test_mkl_skew_float()
{
float x[N]= {32.368824, 32.3732567, 32.3706436, 32.3741646, 32.3736801, 32.3755112, 32.3742905, 32.3735313, 32.3738403, 30.9899216, 32.3761978, 32.3737259, 32.3755112, 32.3710899, 32.3742638, 32.3742638};
float mean=0,skew=0,kurt={0},vari=0;
MKL_INT p,n,xst;
int status;
p=DIM;
n=N;
xst=VSL_SS_MATRIX_STORAGE_ROWS;
status = vslsSSNewTask( &task, &p, &n, &xst, x, 0, 0 );
float rm[8]={-1};
status = vslsSSEditTask( task, VSL_SS_ED_SKEWNESS, &skew );
status = vslsSSEditTask( task, VSL_SS_ED_KURTOSIS, &kurt );
MKL_UINT64 mask = VSL_SS_MEAN | VSL_SS_KURTOSIS | VSL_SS_SKEWNESS | VSL_SS_2R_MOM | VSL_SS_3R_MOM | VSL_SS_4R_MOM | VSL_SS_2C_MOM | VSL_SS_3C_MOM | VSL_SS_4C_MOM  ;
printf ("float skew %.4f ,kurt %.4f ,mean %.2f ,r2m %.2f,r3m %.2f ,r4m %.2f\n",skew,kurt,rm[0],rm[1],rm[2],rm[3]);
}
``````
1 Solution
Moderator
573 Views

Hi Roland,

The issue raised by you is reproducible with VSL_SS_METHOD_FAST method parameter.

Meanwhile could you please try changing the method parameter to the function vslSSCompute as shown below?

``````//kurtosis of double datatype
//kurtosis of float datatype
``````

We checked it from our end and could see that the results are same for both float and double kurtosis.

Please refer to the below screenshot and do let us know if it helps in resolving the issue.

Regards,

Vidya.

3 Replies
Moderator
574 Views

Hi Roland,

The issue raised by you is reproducible with VSL_SS_METHOD_FAST method parameter.

Meanwhile could you please try changing the method parameter to the function vslSSCompute as shown below?

``````//kurtosis of double datatype
//kurtosis of float datatype
``````

We checked it from our end and could see that the results are same for both float and double kurtosis.

Please refer to the below screenshot and do let us know if it helps in resolving the issue.

Regards,

Vidya.

Beginner
487 Views

It works ,thankyou very much.

Moderator
402 Views

Thank you for reaching us. This issue is closing and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.