{"id":19138090,"url":"https://github.com/lemonpi/binc","last_synced_at":"2026-06-09T00:30:20.214Z","repository":{"id":73435283,"uuid":"22272997","full_name":"LemonPi/binc","owner":"LemonPi","description":"Command line calculator for practicing bit manipulation and boolean algebra","archived":false,"fork":false,"pushed_at":"2015-09-11T14:51:15.000Z","size":2864,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-03T13:52:26.406Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/LemonPi.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":"2014-07-25T22:36:32.000Z","updated_at":"2021-09-22T13:20:29.000Z","dependencies_parsed_at":"2023-03-11T15:23:05.231Z","dependency_job_id":null,"html_url":"https://github.com/LemonPi/binc","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/LemonPi%2Fbinc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LemonPi%2Fbinc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LemonPi%2Fbinc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LemonPi%2Fbinc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LemonPi","download_url":"https://codeload.github.com/LemonPi/binc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240217264,"owners_count":19766737,"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":[],"created_at":"2024-11-09T06:41:42.979Z","updated_at":"2026-06-09T00:30:20.184Z","avatar_url":"https://github.com/LemonPi.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"binc\n=======\n\nFast and intuitive command line calculator in C++. (pronounced \"bink\")  \nOffers bitwise operators and multiple (hex, oct, dec) input and display modes.  \nEspecially useful for practicing boolean algebra and bit manipulation.  \n\n[**Online console**](http://johnsonzhong.me/projects/bincalc/tester.html)\n\n### Get started\n 1. clone anywhere `git clone https://github.com/LemonPi/binc.git`\n 2. open command line in directory\n 3. `make` (for windows users, a Cygwin binary exists under bin/)\n 4. (recommended) either put `binc` or a symlink of it in your system path\n\n### Usage\nYou can use binc in shell mode or pipe mode.\n\n#### Shell mode\n```\ncmd\u003e binc\n\u003e my_var = 19\n0000 0000 0000 0000 0000 0000 0001 0011 (19)\n\u003e my_var \u003c\u003c 1\n0000 0000 0000 0000 0000 0000 0010 0110 (38)\n\u003e \\a\n0000 0000 0000 0000 0000 0000 0110 0001 (97)\n\u003e @+3\n0000 0000 0000 0000 0000 0000 0110 0100 (100)\n\u003e hex\n\u003e @\n0000 0000 0000 0000 0000 0000 0110 0100 (64)\n\u003e terse\n\u003e @\n64\n\u003e hist\n19\n97\n100\n\u003e sin(pi); cos(pi)\n0\n-1\n\u003e ln 5\n1.60944\n\u003e exit\n```\n\n#### Pipe mode\n```\ncmd\u003e binc \"1 + 2 * 3; @ / 2\"\n7\n3.5\n\ncmd\u003e binc \u003c math_file\n\u003e 0000 0000 0000 0000 0000 0000 0011 0110 (54)\n\u003e 0000 0000 0000 0000 0000 0000 0110 1100 (108)\n\ncmd\u003e cat math_file\n2 + 52\n@ * 2\n```\nThe output terminates with a newline.\n\n### Operators\n - `* / + - %` basic arithmetic\n - `\u003e\u003e \u003c\u003c` bit shifts\n - `\u0026 | ^ ~` binary logic (^ is XOR, ~ is NOT)\n - `** !` exponent and factorial \n - `@` retrieves last value, `@@` retrieves value 2 values up (not including previous `@`s)\n\n### Functions\nThere are functions that take a single value and return a value (standard math functions)\nand functions that modify binc's state. The code in `core/lookup.cpp` is more up to date\nthan this readme.\n\n#### Math functions\nThese functions take 1 argument and return 1 value `(f: R x R -\u003e R)`\n```\nabs\nceil\nfloor\ntrunc\nround\n\ncos\nsin\ntan\nacos\nasin\natan\ncosh\nsinh\ntanh\nacosh\nasinh\natanh\n\nln     // base e\nlog\nlg     // base 2\nexp\nexp2\n\nsqrt\ncbrt\n```\n\n\n#### Modifiers\nThese functions take no argument and adjust the state of binc,\ntheir effects lasting until another modifier in their group gets called.\n```\nexit\nquit   // same as exit\n\n// change output mode (input is dependent on prefix: 0x = hex, b = binary, 0 = oct, else = dec)\nhex\noct\ndec\n\n// whether to print bits\nterse\nverbose\n\n// whether to have \u003e prompt\nprompt\nnoprompt\n\n// list history\nhist\nhistory\n\n// list functions and modifiers\nfuncs\nunary\nunaries\nprint_unaries\n\nmodifier\nmodifiers\nprint_modifiers\n\n```\n\n### Why binc?\n - no 3rd party dependencies \n - input and output in binary, hex, and oct\n - bit display in verbose mode (no other calculator has this out of the box)\n - change display to hex and oct with a single command \n - instantaneous load (take that Google and Python)\n - can feed pipes and files to\n\n## Detailed Usage\n#### Input\nInput can be in decimal, binary, octal, or hexadecimal:\n```\n\u003e x = 100\n0000 0000 0000 0000 0000 0000 0110 0100 (100)\n\u003e x = b100\n0000 0000 0000 0000 0000 0000 0000 0100 (4)\n\u003e x = 0100\n0000 0000 0000 0000 0000 0000 0100 0000 (64)\n\u003e x = 0x100\n0000 0000 0000 0000 0000 0001 0000 0000 (256)\n```\n\n#### Output\nSimilarly, output can be in dec, bin, oct, or hex:\n```\n\u003e x = 100\n0000 0000 0000 0000 0000 0000 0110 0100 (100)\n\u003e hex\n\u003e x\n0000 0000 0000 0000 0000 0000 0110 0100 (64)\n\u003e oct\n\u003e x\n0000 0000 0000 0000 0000 0000 0110 0100 (144)\n\u003e terse\n\u003e x\n144\n\u003e verbose\n\u003e x\n0000 0000 0000 0000 0000 0000 0110 0100 (144)\n```\n\n#### Character literals\nInstead of treating the character as a variable, take the ASCII value of it\n```\n\u003e a\nerror: a not found\n\u003e \\a\n0000 0000 0000 0000 0000 0000 0110 0001 (141)\n```\n\n#### History\n```\n... some commands\n\u003e hist\n100\n1\n2\n98\n97\n97\n\u003e @\n0000 0000 0000 0000 0000 0000 0110 0001 (97)\n\u003e @@@\n0000 0000 0000 0000 0000 0000 0110 0010 (98)\n\u003e @@@@\n0000 0000 0000 0000 0000 0000 0000 0010 (2)\n```\nNote that querying for previous commands doesn't add to the history.\n\n\n### Tips\n- requires C++11 (makefile builds with g++ by default)\n- exit by `exit`, `quit`, or `Ctrl + C `\n- order of operation: parentheses --\u003e binary ops --\u003e * / --\u003e + -\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemonpi%2Fbinc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemonpi%2Fbinc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemonpi%2Fbinc/lists"}