GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — quantiles/stream_example_test.go at master · inkloop/quantiles Expand file tree/ Copy pathstream_example_test.goMore file actions 44 lines (36 loc) · 1000 Bytes / Copy pathstream_example_test.goFile metadata and controls44 lines (36 loc) · 1000 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 package quantiles_test import ( "fmt" "github.com/axiomhq/quantiles" ) func Example() { qstream, err := quantiles.New(0.01, 1<<4) if err != nil { panic(err) } for i := 0.0; i < 1e6; i++ { if err := qstream.Push(i, 1.0); err != nil { panic(err) } } fmt.Print("ApproximationError:") fmt.Println(qstream.ApproximationError(1)) fmt.Print("Finalize:") fmt.Println(qstream.Finalize()) fmt.Print("GenerateQuantiles(4):") fmt.Println(qstream.GenerateQuantiles(4)) fmt.Print("GenerateQuantiles(10):") fmt.Println(qstream.GenerateQuantiles(10)) sum, err := qstream.FinalSummary() if err != nil { panic(err) } fmt.Print("GenerateQuantiles(4):") fmt.Println(sum.GenerateQuantiles(4)) // Output: // ApproximationError:0 <nil> // Finalize:<nil> // GenerateQuantiles(4):[0 251865 503730 746595 999999] <nil> // GenerateQuantiles(10):[0 98946 197892 296838 395789 503730 602676 701622 800568 899514 999999] <nil> // GenerateQuantiles(4):[0 251865 503730 746595 999999] } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |