{"id":28059944,"url":"https://github.com/davidesantangelo/nmri","last_synced_at":"2025-08-20T17:11:42.928Z","repository":{"id":285349268,"uuid":"955170442","full_name":"davidesantangelo/nmri","owner":"davidesantangelo","description":"All the calculation power you need without the bloat. NMRI is a powerful command-line calculator with support for mathematical functions, variables, command history, and memory operations.","archived":false,"fork":false,"pushed_at":"2025-04-05T09:10:47.000Z","size":73,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-12T08:33:28.559Z","etag":null,"topics":["c","calculator","calculator-application","cli"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidesantangelo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-26T08:11:03.000Z","updated_at":"2025-04-05T09:10:27.000Z","dependencies_parsed_at":"2025-03-31T08:35:14.392Z","dependency_job_id":null,"html_url":"https://github.com/davidesantangelo/nmri","commit_stats":null,"previous_names":["davidesantangelo/nmri"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidesantangelo%2Fnmri","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidesantangelo%2Fnmri/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidesantangelo%2Fnmri/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidesantangelo%2Fnmri/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidesantangelo","download_url":"https://codeload.github.com/davidesantangelo/nmri/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253702151,"owners_count":21949927,"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":["c","calculator","calculator-application","cli"],"created_at":"2025-05-12T08:34:02.322Z","updated_at":"2025-05-12T08:34:03.215Z","avatar_url":"https://github.com/davidesantangelo.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NMRI - A Powerful Command-Line Calculator\n\n\u003e **Powerful mathematics in just a few KB: all the calculation power you need without the bloat.**\n\n**NMRI isn't just another calculator** - it's your mathematical ally for the command line. Combining the elegance of simple syntax with the power of advanced mathematics, NMRI puts professional-grade computational power at your fingertips, right in your terminal.\n\n## ✨ Features\n\n- **Complete Mathematical Arsenal**: From basic arithmetic to complex functions—add, subtract, multiply, divide, power, modulo, and more\n- **Percentage Calculations**: Intuitive support for percentage operations (e.g., 100 + 20% = 120)\n- **Scientific Function Suite**: Unlock the full potential of mathematics with trigonometric, logarithmic, and exponential functions\n- **Smart Variable System**: Create and manipulate variables as easily as in your favorite programming language\n- **Rich Built-in Constants**: Access mathematical constants (π, e, φ) and physical constants (c, h, G, Na, k) with simple identifiers\n- **Memory Operations**: Store, recall, and manipulate calculation results with intuitive commands\n- **Command History**: Never lose track of your calculations with full history navigation using arrow keys\n- **Colorful Interface**: Enjoy a visually appealing experience with color-coded outputs for results, errors, and help text\n- **Interactive Experience**: Enjoy a responsive, user-friendly interface designed for both quick calculations and complex mathematical explorations\n- **Comprehensive Logging**: Keep track of your calculation sessions with detailed logging capabilities\n- **Dual-Mode Operation**: Work interactively for exploration or directly evaluate expressions from command line for quick calculations and scripting\n- **Elegant Syntax**: Express complex mathematical ideas with clean, intuitive notation\n\n## Getting Started\n\n### Prerequisites\n\n- GCC or any C compiler\n- Make (optional, for using the Makefile)\n- Terminal with ANSI color support\n\n### Compilation\n\nCompile with the included Makefile:\n\n```bash\nmake\n```\n\nOr manually:\n\n```bash\ngcc -o nmri nmri.c -lm\n```\n\n### Installation\n\nInstall system-wide (requires administrative privileges):\n\n```bash\nsudo make install\n```\n\nThis will install the `nmri` executable to `/usr/local/bin`, making it available system-wide.\n\nYou can also specify a different installation prefix:\n\n```bash\nsudo make install PREFIX=/opt\n```\n\nTo uninstall the calculator:\n\n```bash\nsudo make uninstall\n```\n\nIf you installed with a custom prefix, use the same prefix for uninstalling:\n\n```bash\nsudo make uninstall PREFIX=/opt\n```\n\n## Testing \u0026 Quality Assurance\n\nNMRI comes with a robust test suite that ensures reliability and accuracy:\n\n```bash\nmake test\n```\n\nOur tests verify everything from basic arithmetic to complex expressions and edge cases.\n\n### Starting the Calculator\n\nRun the executable in interactive mode:\n\n```bash\n./nmri\n```\n\nOr, if you've installed it system-wide:\n\n```bash\nnmri\n```\n\n### Command-Line Expression Evaluation\n\nEvaluate expressions directly without entering interactive mode:\n\n```bash\nnmri \"2 + 2\"\n# Output: 4\n\nnmri \"100 + 20%\"\n# Output: 120\n\nnmri \"sin(pi/2)\"\n# Output: 1\n```\n\nThis mode is especially useful for scripts or when you need a quick calculation:\n\n```bash\n# Example in a shell script\nradius=5\narea=$(nmri \"$radius^2 * pi\")\necho \"Area of circle: $area\"\n```\n\n### Basic Operations\n\n```\n■ 2 + 2\n4\n\n■ 5 * (3 + 2)\n25\n\n■ 2^8\n256\n```\n\n### Using Functions\n\n```\n■ sin(pi/2)\n1\n\n■ sqrt(16)\n4\n\n■ log(e)\n1\n```\n\n### Working with Variables\n\n```\n■ x = 5\nx = 5\n\n■ y = 10\ny = 10\n\n■ x + y\n15\n\n■ z = x^2 + y^2\nz = 125\n\n■ sqrt(x^2 + y^2)\n11.18034\n\n■ store pythag\nStored 11.18034 in pythag\n\n■ pythag\n11.18034\n```\n\n### Memory Operations\n\n```\n■ 42\n42\n\n■ m+\nMemory: 42\n\n■ 8\n8\n\n■ m+\nMemory: 50\n\n■ mr\n50\n\n■ mc\nMemory cleared\n```\n\n### Logging\n\n```\n■ log on\nLogging enabled\n\n■ 2 + 2\n4\n\n■ log show\nRecent log entries:\n-------------------\n[2023-05-25 14:32:07] Logging enabled\n[2023-05-25 14:32:12] User input: 2 + 2\n[2023-05-25 14:32:12] Expression result: 2 + 2 = 4\n\n■ log off\nLogging disabled\n```\n\n### Special Commands\n\n- `help` - Display help information\n- `exit` - Exit the calculator\n- `clear` - Clear the screen\n- `history` - Show command history\n- `variables` - List all defined variables\n- `memory` - Show the current memory value\n- `m+` - Add last result to memory\n- `m-` - Subtract last result from memory\n- `mr` - Recall memory value\n- `mc` - Clear memory\n- `store x` - Store last result in variable x\n- `log on` - Enable logging\n- `log off` - Disable logging\n- `log show` - Show recent log entries\n- `log file` - Show current log file path\n\n## Examples\n\n### Percentage Calculations\n\n```\n■ 100 + 20%\n120\n\n■ 50 - 10%\n45\n\n■ 100 * 20%\n20\n\n■ 100 / 20%\n500\n\n■ x = 100\nx = 100\n\n■ x + 30%\n130\n\n■ (100 + 20%) * 50%\n60\n```\n\n### Complex Calculations\n\n```\n■ (2 + 3) * (4 + 5)\n45\n\n■ sin(pi/4)^2 + cos(pi/4)^2\n1\n\n■ x = 2\nx = 2\n\n■ y = 3\ny = 3\n\n■ z = sqrt(x^2 + y^2)\nz = 3.60555\n```\n\n### Using Previous Results and Storage\n\n```\n■ 5 * 5\n25\n\n■ ans + 15\n40\n\n■ store result\nStored 40 in result\n\n■ result / 2\n20\n```\n\n### Built-in Constants\n\n```\n■ pi\n3.14159\n\n■ e\n2.71828\n\n■ phi\n1.61803\n\n■ gamma\n0.577216\n\n■ c\n299792458\n\n■ h\n6.62607e-34\n\n■ Na\n6.02214e+23\n\n■ h * c\n1.986e-25\n\n■ G * 5.97e24 * 70 / (6371e3^2)\n9.81\n\n■ k * Na\n8.314\n```\n\n## Changelog\n\nSee the [CHANGELOG.md](CHANGELOG.md) file for details on version history and updates.\n\n## License\n\nThis project is licensed under the BSD-2-Clause License.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n---\n\n**Repository**: https://github.com/davidesantangelo/nmri\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidesantangelo%2Fnmri","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidesantangelo%2Fnmri","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidesantangelo%2Fnmri/lists"}