fix #6651, use promotion in clamp()