Casted float to int explicitly to fix warning
Fixed fn_ptr should have taken floats but took doubles, as advised by JamesA