System Workbench for STM32

giving parameters into math function

according to this

trun returns a double not an int. the hard fault could result from the invalid type conversion from double to int.
Ints are 4 byte long (on an STM32) doubles are 8 byte long.

try to do something like that
double intput = 1.4;
double res = truc(input);

does this still result in a hardfault?