Skip to content

Commit

Permalink
change output format
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin8105 committed Feb 27, 2018
1 parent 5f61004 commit 0d66dbd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ import (
func main() {
service := pi.NewService()
service.Start()
go func() {
for i := 0; i < 100; i++ {
time.Sleep(time.Second)
fmt.Println("Result :", service.Result())
}
}()
time.Sleep(time.Minute)
for i := 0; i < 60; i++ {
time.Sleep(time.Second)
fmt.Println("Result :", service.Result())
}
service.Stop()
fmt.Println("Result at the end :", service.Result())
fmt.Println("Result :", service.Result())
}
2 changes: 1 addition & 1 deletion pi.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (s *Service) Result() string {
defer s.m.Unlock()
var out big.Float
out.Mul(s.result, big.NewFloat(4))
return fmt.Sprintf("%s", out.String())
return fmt.Sprintf("%s", out.Text('f', 62))
}

// Stop pi-service
Expand Down

0 comments on commit 0d66dbd

Please sign in to comment.