init
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"mcquay.me/ostat"
|
||||
)
|
||||
|
||||
var dots = flag.Bool("dots", false, "print dots")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
ps := ostat.NewPopulationStat()
|
||||
s := bufio.NewScanner(os.Stdin)
|
||||
for s.Scan() {
|
||||
f, err := strconv.ParseFloat(strings.TrimSpace(s.Text()), 64)
|
||||
if err != nil {
|
||||
log.Printf("%+v", err)
|
||||
continue
|
||||
}
|
||||
ps.Push(f)
|
||||
}
|
||||
l, u := ps.CI()
|
||||
fmt.Printf("n: %d, min: %0.0f, avg: %0.4f, max: %0.0f, std: %0.4f, CI: (%f, %f)\n", ps.N(), ps.Min, ps.Mean(), ps.Max, ps.StdDev(), l, u)
|
||||
}
|
||||
Reference in New Issue
Block a user