{"id":13595583,"url":"https://github.com/VladimirMarkelov/rclc","last_synced_at":"2025-04-09T13:32:45.633Z","repository":{"id":62443720,"uuid":"182457276","full_name":"VladimirMarkelov/rclc","owner":"VladimirMarkelov","description":"Mathematical expression calculator with big integers, floats, common fractions, and complex numbers support","archived":false,"fork":false,"pushed_at":"2021-07-14T03:23:44.000Z","size":44,"stargazers_count":28,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-15T00:21:33.636Z","etag":null,"topics":["calculator","cli","command-line","command-line-tool","expression","math","mathematics"],"latest_commit_sha":null,"homepage":"","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/VladimirMarkelov.png","metadata":{"files":{"readme":"README.md","changelog":"changelog","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":"2019-04-20T21:44:52.000Z","updated_at":"2024-06-14T06:53:06.000Z","dependencies_parsed_at":"2022-11-01T22:16:35.658Z","dependency_job_id":null,"html_url":"https://github.com/VladimirMarkelov/rclc","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VladimirMarkelov%2Frclc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VladimirMarkelov%2Frclc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VladimirMarkelov%2Frclc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VladimirMarkelov%2Frclc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VladimirMarkelov","download_url":"https://codeload.github.com/VladimirMarkelov/rclc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213549745,"owners_count":15604020,"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","cli","command-line","command-line-tool","expression","math","mathematics"],"created_at":"2024-08-01T16:01:52.923Z","updated_at":"2024-11-06T18:31:20.223Z","avatar_url":"https://github.com/VladimirMarkelov.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"## RionaCalc\n\nMathematical expression calculator with big integers, floats, common fractions, and complex numbers support. It can be launched in two modes: immediate, when rclc gets an expression, calculates it, prints the result, and exits; and interactive, when rclc displays a prompt and calculates every expression you type.\n\nSuggestions, ideas, pull requests are very welcome. Thank you!\n\n## Why yet another calculator\n\nFrom time to time I need to evaluate an expression that contains values other than float point numbers: common fractions, complex numbers, arbitrary precision integer numbers. But majority of calculators works only with floating point numbers. Even if a calculator supports any of other types of numbers, it often requires switching to special modes. E.g, calculators that supported common fractions required to enter common-fraction mode to use them - in this mode other kinds of numbers are unavailable. Some calculators support complex numbers but do not do it transparently for a user. E.g, its documentation states that complex numbers are supported but a calculator fails on a evaluating square root of negative number with an error \"Invalid argument\". I wanted to have a calculator that allows me to mix any types of numbers in one expression and it is able to detect the correct type of the result and argument. \n\nLesser requirements:\n\n* evaluate trigonometric functions using radians and degrees without turning radians/degrees switch on and off\n* a calculator that works in terminal either in interactive mode or is able to calculate an expression passed in command line and display the result. Yes, `bc` can do it. But its usage seems counterintuitive to me: instead of simple call `bc \"expr\"` it must be launched as `echo \"expr\" | bc`\n* user-defined variables. Though, majority of calculators supports it out of the box\n\nVery simple examples(`ans` - an special variable that holds the result of the last successful evaluation):\n\n```\n\u003e sqrt(-2)  // square root of negative number\n= 0.0+1.4142135623730952i\n\u003e sqr(ans) // square root of a complex number may produce real number\n= -2.0000000000000006\n\u003e 345**12 // big integer in action\n= 2843342266303054544082275390625\n\u003e 1\\2 + 3\\5  // one half and three fifth is one and one tenth\n= 1\\1\\10\n\u003e sqr(3\\5)  // square of a rational number is a rational number\n= 9\\25\n\u003e sin(90°) == sin(pi/2) // degrees and radians mixed in one expression, '°' can be replaced with 'd' for easier typing \n= 1\n```\n\n## Features\n\n* No modes: all types of values can be transparently used in one expression. E.g, `(1\\2 + 3\\5) * 2-3i + sin(30d) + cos(0.25)` - multiply sum of two common fractions - one half and three fifth - by a complex number, add sine of 30 degrees and cosine of 0.25 radians. Spaces are added only for readability, they can be omitted\n* Automatic selection of more appropriate argument type for a function: e.g, `sqrt(-4)` converts float number `-4` into complex one `-4+0i` and then calculates the result `0+2i`. The same is true for calculating logarithm for negative float numbers, and acos and asin for argument greater than `1.0`\n* Automatic adding multiplication sign where it is omitted: e.g, `(1+2)(2+9)` is calculated as `(1+2)*(2+9)`\n* Functions with a single-value argument do not require to enclose its argument into brackets: e.g, `sin cos 2` is calculated as `sin(cos(2))`\n* The final closing brackets can be omitted: e.g, `(1+2)*(2+9` is the same as `(1+2)*(2+9)`\n* Trigonometric functions work with radians and degrees. Bare numbers are treated as radians, degrees requires one or three suffixes. Two degrees formats: `20d30m50s` or `20°30'50\"`. Minutes and seconds can be omitted, in this case degrees can be float number like `30.25d`. So, `sin(pi/2)` == `sin(90°)`\n* Every number can include group separator `_` for readability - it is very useful when using big integers. `3_000.90_23` == `3000.9023`\n* Both `.` and `,` are treated as decimal separators\n* Function argument separator is `;`. If a function receives more arguments than it requires, the trailing arguments are dropped: e.g, `sqrt(11;12;13)` is the same as `sqrt(11)` \n* Regular fractions use `\\` to separate its parts. They can be written with integer part or only with numerator and denominator, e.g `1\\1\\10` == `11\\10`\n* Two complex numbers formats: with marker at the end or in the middle. E.g, `1+2i` == `1+i2`. In addition, `j` can be used instead of `i` - but the calculator outputs always with `i`\n* Hexadecimal(starts with `0x`), octal(starts with `0o`), and binary(starts with `0b`) numbers\n* Basic variable and scripting support allows users to create their own constant libraries and preload them at calculator startup\n* Commands in interactive mode(a very limited set at this moment): `quit` or `exit` close the calculator, and `load \u003cfilename\u003e` - load the file and evaluate lines one by one, skipping comments, the last evaluated result is printed\n* Character `%` can be either a modulo or a percentage operator. It depends on the character position: if `%` is right before the expression end or before closing bracket or before another operator *and* previous operator is one of `+`, `-`, `*`, or `/`, the character is considered a percentage operator\n\nPlease, read the detailed [documentation here](doc.md).\n\n## Installation\n\nThe application can be compiled from source, or installed using cargo:\n\n```shell\n$ cargo install rclc\n```\n\nYou need Rust compiler that supports Rust 2018 edition (Rust 1.31 or newer) to do it. If you want to upgrade existing rclc, execute the following command:\n\n```shell\n$ cargo install rclc --force\n```\n\n### Pre-compiled binaries\n\nFor Windows you can download pre-compiled binaries from [Release page](https://github.com/VladimirMarkelov/rclc/releases).\n\n* Windows binary works on Windows 7 or newer Windows.\n\n### Known issues\n\n- The calculator is not thoroughly tested, bugs may happen. Please, notify me about any issue\n- Float numbers with arbitrary precision are not supported yet - all floats are 64-bit float numbers. I am aware of rust-port of GNU GMP, but I do not want to use it at this moment - I remember having troubles trying to build the library on Windows\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVladimirMarkelov%2Frclc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVladimirMarkelov%2Frclc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVladimirMarkelov%2Frclc/lists"}