How to calculate PI value with acos() function in Go

2 Answers

0 votes
package main

import (
    "fmt"
    "math"
)

func main() {
    pi := math.Acos(-1)
    
    fmt.Printf("pi = %f\n", pi)
}



/*
run:
   
pi = 3.141593
  
*/

 



answered Dec 20, 2024 by avibootz
0 votes
package main

import (
    "fmt"
    "math"
)

func main() {
    pi := 2 * math.Acos(0.0);

    fmt.Printf("pi = %f\n", pi)
}



/*
run:
   
pi = 3.141593
  
*/

 



answered Dec 20, 2024 by avibootz

Related questions

2 answers 117 views
2 answers 121 views
2 answers 141 views
2 answers 136 views
1 answer 134 views
1 answer 124 views
1 answer 232 views
...