change the return type of cmp function from int to float