avoid using std::cmp::min, for it doesn't support f32...