Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,907 questions

51,839 answers

573 users

How to use the cosh() function to get the hyperbolic cosine of a number in Rust

1 Answer

0 votes
fn main() {
    println!("cosh(-1) = {}", f64::cosh(-1.0));
    println!("cosh(1) = {}", f64::cosh(1.0));
    println!("cosh(0) = {}", f64::cosh(0.0));
    println!("cosh(-0) = {}", f64::cosh(-0.0));
    println!("cosh(0.9) = {}", f64::cosh(0.9));
    println!("cosh(PI) = {}", f64::cosh(std::f64::consts::PI));
    println!("cosh(PI * 2) = {}", f64::cosh(std::f64::consts::PI * 2.0));
    println!("cosh(PI / 2) = {}", f64::cosh(std::f64::consts::PI / 2.0));
    println!("cosh(PI / 3) = {}", f64::cosh(std::f64::consts::PI / 3.0));
}

    
    
/*
run:
 
cosh(-1) = 1.5430806348152437
cosh(1) = 1.5430806348152437
cosh(0) = 1
cosh(-0) = 1
cosh(0.9) = 1.4330863854487745
cosh(PI) = 11.591953275521519
cosh(PI * 2) = 267.7467614837482
cosh(PI / 2) = 2.5091784786580567
cosh(PI / 3) = 1.600286857702386
 
*/

 



answered Aug 11, 2024 by avibootz
...