clamp last to infinity to handle rare imprecision issues (#1532)

This commit is contained in:
Addison Crump 2023-11-03 17:32:48 +01:00 committed by GitHub
parent 2e980ca08d
commit fd98eabfbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,7 +29,7 @@ pub fn calculate_cumulative_distribution_in_place(probabilities: &mut [f32]) ->
} }
// Clamp the end of the vector to account for floating point errors. // Clamp the end of the vector to account for floating point errors.
*last = 1.0_f32; *last = f32::INFINITY;
Ok(()) Ok(())
} }