JS implementation of C stdlib nextafter