{"id":16941131,"url":"https://github.com/greenpau/go-calculator","last_synced_at":"2025-07-30T13:35:20.680Z","repository":{"id":49878597,"uuid":"259653223","full_name":"greenpau/go-calculator","owner":"greenpau","description":"Go package to calculate total, mean (average), median, sorted median, variance, range, min, max, modes, standard deviation, etc.","archived":false,"fork":false,"pushed_at":"2023-11-27T11:18:52.000Z","size":17,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-25T16:57:59.064Z","etag":null,"topics":["golang","math","statistical-analysis","statistical-methods","statistics"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/greenpau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-04-28T14:01:13.000Z","updated_at":"2022-07-27T10:51:00.000Z","dependencies_parsed_at":"2023-12-14T04:45:41.540Z","dependency_job_id":null,"html_url":"https://github.com/greenpau/go-calculator","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"1215b070e68cdd3599afb22cc94a0a3c0be5ad88"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/greenpau/go-calculator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenpau%2Fgo-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenpau%2Fgo-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenpau%2Fgo-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenpau%2Fgo-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/greenpau","download_url":"https://codeload.github.com/greenpau/go-calculator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenpau%2Fgo-calculator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267779359,"owners_count":24143192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","math","statistical-analysis","statistical-methods","statistics"],"created_at":"2024-10-13T21:08:47.538Z","updated_at":"2025-07-30T13:35:20.616Z","avatar_url":"https://github.com/greenpau.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-calculator\n\n\u003ca href=\"https://github.com/greenpau/go-calculator/actions/\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/greenpau/go-calculator/workflows/build/badge.svg?branch=master\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/greenpau/go-calculator\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/godoc-reference-blue.svg\"\u003e\u003c/a\u003e\n![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)\n\nGo package to calculate total, mean (average), median, sorted median,\nvariance, range, min, max, modes, standard deviation, etc.\n\n## Getting Started\n\nFirst, add the library to :\n\n```golang\nimport (\n    \"github.com/greenpau/go-calculator\"\n)\n```\n\nNext, initialize calculator in any of the following ways:\n\n```golang\ncalc, _ := calculator.NewString(\"1, 2, 3, 4.5, 5.4, 6, 7\")\n\nif calc == nil {\n    log.Fatal(\"failed to initialize calculator\")\n}\n\narr := []uint64{1, 2, 3, 4, 5, 6, 7}\ncalc, _ := calculator.NewUint64(arr)\n\narr := []int64{1, 2, 3, 4, 5, 6, 7}\ncalc, _ := calculator.NewInt64(arr)\n\narr := []int{1, 2, 3, 4, 5, 6, 7}\ncalc, _ := calculator.NewInt(arr)\n\narr := []float64{1, 2, 3, 4, 5, 6, 7}\ncalc, _ := calculator.NewFloat64(arr)\n```\n\nNext, calculate total, mean (average), median, mode, range\nusing the `calc` instance:\n\n```golang\ncacl.Total()\ncalc.StandardDeviation()\ncalc.Variance()\ncalc.Range()\ncalc.Max()\ncalc.Min()\ncalc.MaxWithIndices()\ncalc.MinWithIndices()\ncalc.Median(true)\ncalc.Median(false)\ncalc.Mean()\ncalc.Modes()\n```\n\nAlternatively, simply perform all calculations:\n\n```\ncalc.RunAll()\n```\n\nGet the result of the calculations.\n\n```golang\nfmt.Fprintf(os.Stdout, \"Total: %.2f\\n\", calc.Register.Total)\n```\n\nThe `Print()` function helps visualize the data:\n\n```\nData: [554801 61602 763767 277578 167822 617342\n  847743 801166 894535 254904 354657 389371\n  543430]\nTotal: 6528718.000000\nMean: 502209.076923\nMedian: 732542.500000\nSorted Median: 466400.500000\nMax: 894535.000000\nMax Indices: [8]\nMin: 61602.000000\nMin Indices: [1]\nVariance: 69299542922.378693\nStandard Deviation: 0.000000\nModes: []\nMode Repeat Count: 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenpau%2Fgo-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreenpau%2Fgo-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenpau%2Fgo-calculator/lists"}