Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 386
ArekBulski Avatar asked Jan 27 '26 10:01

ArekBulski


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.

like image 53
Colonel Thirty Two Avatar answered Jan 29 '26 23:01

Colonel Thirty Two



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!