Skip to content

percentile_cont interpolation causes NaN for f16 input #18945

@Jefffrey

Description

@Jefffrey

Describe the bug

(Relies on #18944 being merged so it can accept f16 input)

This interpolation step here seems to cause f16 to go out of bounds (into inf) so we can't calculate percentiles for f16 as it'll always return NaN:

let interpolated = lower_value.add_wrapping(
diff.mul_wrapping(T::Native::usize_as(
(fraction * INTERPOLATION_PRECISION as f64) as usize,
))
.div_wrapping(T::Native::usize_as(INTERPOLATION_PRECISION)),
);

Need to fix this for f16.

To Reproduce

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions