Analog of c++ std::remainder?

Suffice to say from the responses above, rust's standard library does not provide this function. However, rust is typically compiled with libm, which does provide the function. One can link the symbol from that library if they wish.

Playground

mod ffi {
    use std::os::raw::c_float;

    #[link(name = "m")]
    extern {
        pub fn remainderf(from: c_float, to: c_float) -> c_float;
    }
}
fn remainder(from: f32, to: f32) -> f32 {
    unsafe { ffi::remainderf(from, to) }
}

fn main() {
    assert_eq!(remainder(16777216.0, 3.0), 1.0);
}

(this might cause trouble when compiling to certain targets, e.g. embedded? I almost exclusively compile to x86-64 so I would not know)

If somebody really feels that this is something the standard library ought to provide, an issue can be created on the rust repository.