added constrain function for float and int32 types