Basically, when an endpoint should be returned (eg bc return_endpoints = TRUE and the first point is above the threshold) but return = "x", find_threshold_crosses attempts to find the intersection of a flat line with the threshold, which leads to a divide-by-zero error and NaN being returned.
Basically, when an endpoint should be returned (eg bc return_endpoints = TRUE and the first point is above the threshold) but return = "x", find_threshold_crosses attempts to find the intersection of a flat line with the threshold, which leads to a divide-by-zero error and NaN being returned.