>>101592327
You don't need GATs for this. Your problem is probably that the stdlib doesn't provide any traits for numerics, so it's hard to make your code generic over numerical types. You can use the num-traits crate for this. And then it's just
use num_traits::float::Float;
pub fn newtons_method<N, F, G>(
f: F, df: G, x0: N,
) -> N where
N: Float,
F: Fn(N) -> N,
G: Fn(N) -> N,
{
Or with a little bit of syntactic sugar:
use num_traits::float::Float;
pub fn newtons_method<N: Float>(f: impl Fn(N) -> N, df: impl Fn(N) -> N, x0: N) -> N {
(You may also have to make a few changes like replacing "0.0" literals by "N::zero()".)