How can I make a Rust function accept any floating type as an argument

Viewed 5855

I'm looking to write a function that can accept any floating point data, similar to the following form:

fn multiply<F: Float>(floating_point_number: F) -> F {
    floating_point_number * 2
}

But I can't find the syntax for it in the documentation, or a trait that is common to floating point numbers only.

1 Answers
Related