use std::numeric_limits<float>::infinity() rather than INFINITY to try to get compilers to agree on the type