{"id":20687386,"url":"https://github.com/mnogu/go-calculator","last_synced_at":"2025-04-22T15:09:11.802Z","repository":{"id":57596490,"uuid":"307006880","full_name":"mnogu/go-calculator","owner":"mnogu","description":"A scientific calculator CLI (Command Line Interface) tool and library written in Go","archived":false,"fork":false,"pushed_at":"2021-12-23T16:09:51.000Z","size":24,"stargazers_count":30,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-22T15:09:02.527Z","etag":null,"topics":["ast","calculator","cli","golang","recursive-descent-parser","scientific-calculator"],"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/mnogu.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}},"created_at":"2020-10-25T02:05:24.000Z","updated_at":"2024-12-31T04:38:52.000Z","dependencies_parsed_at":"2022-09-26T19:52:51.716Z","dependency_job_id":null,"html_url":"https://github.com/mnogu/go-calculator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnogu%2Fgo-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnogu%2Fgo-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnogu%2Fgo-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnogu%2Fgo-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnogu","download_url":"https://codeload.github.com/mnogu/go-calculator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250264911,"owners_count":21402004,"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","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":["ast","calculator","cli","golang","recursive-descent-parser","scientific-calculator"],"created_at":"2024-11-16T22:57:08.732Z","updated_at":"2025-04-22T15:09:11.776Z","avatar_url":"https://github.com/mnogu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-calculator\n\n## Requirements\n\n* Go 1.14+\n  * for [`math.FMA()`](https://golang.org/pkg/math/#FMA)\n\n## Usage\n\n```\n$ go run cmd/calculator/main.go\ncalculator\u003e (2.5 - 1.35) * 2.0\n2.3\ncalculator\u003e -sin((-1+2.5)*pi)\n1\ncalculator\u003e 180*atan2(log(e), log10(10))/pi\n45\ncalculator\u003e exit\n```\n\nYou can also use `calculator.Calculate()` in your application:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/mnogu/go-calculator\"\n)\n\nfunc main() {\n\tval, err := calculator.Calculate(\"(2.5 - 1.35) * 2.0\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(val) // 2.3\n\n\tval, err = calculator.Calculate(\"-sin((-1+2.5)*pi)\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(val) // 1\n\n\tval, err = calculator.Calculate(\"180*atan2(log(e), log10(10))/pi\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(val) // 45\n}\n```\n\n## References\n\n* [chibicc](https://github.com/rui314/chibicc): A small C compiler","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnogu%2Fgo-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnogu%2Fgo-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnogu%2Fgo-calculator/lists"}