{"id":17893358,"url":"https://github.com/techno-coder/calculator","last_synced_at":"2025-03-23T03:32:40.803Z","repository":{"id":118644697,"uuid":"216308004","full_name":"Techno-coder/calculator","owner":"Techno-coder","description":"Multipurpose calculator with coalescing written in Rust","archived":false,"fork":false,"pushed_at":"2019-12-29T07:37:21.000Z","size":146,"stargazers_count":22,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T17:08:01.211Z","etag":null,"topics":["calculator","coalescence","rust"],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/Techno-coder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-20T04:36:34.000Z","updated_at":"2024-02-09T15:07:22.000Z","dependencies_parsed_at":"2023-07-12T07:16:31.577Z","dependency_job_id":null,"html_url":"https://github.com/Techno-coder/calculator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Techno-coder%2Fcalculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Techno-coder%2Fcalculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Techno-coder%2Fcalculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Techno-coder%2Fcalculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Techno-coder","download_url":"https://codeload.github.com/Techno-coder/calculator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245052630,"owners_count":20553161,"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":["calculator","coalescence","rust"],"created_at":"2024-10-28T14:49:38.123Z","updated_at":"2025-03-23T03:32:40.781Z","avatar_url":"https://github.com/Techno-coder.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# calculator\n\n![](examples/example.gif)\n\n```\n\u003e\u003e (10) - 2 + 4;\n[0] 4\n\u003e\u003e 2 * 0x03\n[1] 6\n\u003e\u003e $ ^ $$\n[2] 1296\n\u003e\u003e $2 % 5\n[3] 1\n```\n\n## Installation\n```\n$ cargo install --locked --git https://github.com/Techno-coder/calculator\n```\n\n## Execution\n```\n$ calculator\n```\nBasic mode does not update on each key press and may work better for less\nadvanced terminals.\n```\n$ calculator -b/--basic\n```\nEvaluation mode reads from the standard input pipe and outputs results directly.\n```\n$ echo expression | calculator -e/--evaluation\n```\n\n## Arithmetic Operators\nIn order of precedence:\n* `+` - Add\n* `-` - Minus\n* `*` - Multiply\n* `/` - Divide\n* `%` - Modulo\n* `^` - Power\n\n## Numerical Formats\n* `0x000a` - Hexadecimal\n* `0b1010` - Binary\n* `0o0012` - Octal\n* `1.0` - Floating\n* `1e1` - Scientific\n\n## Variables\n* `$` - Last evaluation result\n* `$$` - Second last evaluation result\n* `$$...$` - Arbitrary position evaluation result\n* `$0` - Variable with identifier `0`\n* `$aa` - Variable with identifier `aa`\n\n## Functions\n```\n\u003e\u003e function argument\n```\nFunctions take the term immediately to the right. \nWhitespace is required after the function name.\n\n* `abs` - Absolute value\n* `sqrt` - Square root\n* `cbrt` - Cube root\n* `ln` - Natural logarithm\n* `log2` - Binary logarithm\n* `log10` - Decimal logarithm\n\n### Trigonometry\n* `sin` - Sine\n* `cos` - Cosine\n* `tan` - Tangent\n* `asin` - Inverse sine\n* `acos` - Inverse cosine\n* `atan` - Inverse tangent\n\nThe trigonometric functions can take and return degrees by appending `'`:\n```\n\u003e\u003e asin' 1\n[0] 90\n```\n\n## Constants\n* `e` - Euler number\n* `pi` - Pi (3.14)\n\n## Coalescence\n* `;` - Coalesce operator\n\nThe coalesce operator combines the previous two terms into a single node.\nThis eliminates the need for parentheses.\n\n```\n\u003e\u003e 10 - 2 + 4;\n```\nis equivalent to:\n```\n\u003e\u003e 10 - (2 + 4)\n```\n\nRepetitions of the coalesce operator will combine more than two terms:\n```\n\u003e\u003e 1 / 1 + 2 + 3;;\n```\nis equivalent to:\n```\n\u003e\u003e 1 / (1 + 2 + 3)\n```\nSometimes a combined term is nested inside another:\n```\n\u003e\u003e 1 / (2 - (3 + 4))\n```\nThis can be achieved by leaving whitespace after the first coalescence:\n```\n\u003e\u003e 1 / 2 - 3 + 4; ;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechno-coder%2Fcalculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechno-coder%2Fcalculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechno-coder%2Fcalculator/lists"}