Where is Rust source for sin() cos()?

Viewed 109

I looked into the source of Rust compiler, looking for the sin() and cos() functions of the f64 type and I cannot find it. It looks like there is just a reference to an intrinsic function, which does not have any body. So, is sin() implemented as a CPU instruction? Please guide me here.

1 Answers

f32::sin compiles to the llvm.sin.f32 intrinsic, which compiles to a call to the sinf function in the C standard library.

cos and tan, and their f64 equivalents, likely do something similar.

Related