{"id":13509518,"url":"https://github.com/sharkdp/insect","last_synced_at":"2025-03-24T03:45:34.541Z","repository":{"id":37849883,"uuid":"83139742","full_name":"sharkdp/insect","owner":"sharkdp","description":"High precision scientific calculator with support for physical units","archived":false,"fork":false,"pushed_at":"2024-10-24T06:01:37.000Z","size":2401,"stargazers_count":3173,"open_issues_count":7,"forks_count":126,"subscribers_count":28,"default_branch":"master","last_synced_at":"2024-10-25T00:26:23.069Z","etag":null,"topics":["calculator","mathematical-expressions","parser","physics","purescript","quantities","terminal-based","units","web-app"],"latest_commit_sha":null,"homepage":"https://numbat.dev/","language":"PureScript","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/sharkdp.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"sharkdp"}},"created_at":"2017-02-25T15:10:45.000Z","updated_at":"2024-10-24T06:01:41.000Z","dependencies_parsed_at":"2023-10-03T04:14:16.851Z","dependency_job_id":"a281d09b-bea7-45e2-893a-0e64dfc30c44","html_url":"https://github.com/sharkdp/insect","commit_stats":{"total_commits":460,"total_committers":33,"mean_commits":13.93939393939394,"dds":0.4478260869565217,"last_synced_commit":"80c0b5a3fc62294d6b6cd5cd56538b1f71d8b6b0"},"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Finsect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Finsect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Finsect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Finsect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharkdp","download_url":"https://codeload.github.com/sharkdp/insect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245206530,"owners_count":20577582,"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","mathematical-expressions","parser","physics","purescript","quantities","terminal-based","units","web-app"],"created_at":"2024-08-01T02:01:08.969Z","updated_at":"2025-03-24T03:45:34.522Z","avatar_url":"https://github.com/sharkdp.png","language":"PureScript","readme":"## Note: Please consider using the follow-up project instead: [Numbat](https://github.com/sharkdp/numbat).\n\nyou can read more about why Insect has been rewritten from scratch [here](https://github.com/sharkdp/numbat/blob/master/assets/reasons-for-rewriting-in-rust.md).\n\n---\n\n\u003c!--\n\n    --- IMPORTANT --- IMPORTANT --- IMPORTANT ---\n\n     Do not edit this README file directly. Edit\n     the files in the `docs` folder instead.\n\n    --- IMPORTANT --- IMPORTANT --- IMPORTANT ---\n\n--\u003e\n\n![insect](web/media/insect.png \"insect - scientific calculator\")\n\nA high-precision scientific calculator with full support for physical units.\n\nContents\n--------\n\n- [Documentation](#documentation)\n- [Reference](#reference)\n- [Pros and cons](#pros-and-cons)\n- [FAQ](#faq)\n- [Terminal version](#terminal-version)\n- [Development](#development)\n- [Maintainers](#maintainers)\n\n## Documentation\n\n- **Evaluate mathematical expressions**:\n\n      1920/16*9\n      2^32\n      sqrt(1.4^2 + 1.5^2) * cos(pi/3)^2\n\n  - **Operators**: addition (`+`), subtraction (`-`), multiplication\n    (`*`, `·`, `×`), division (`/`, `÷`, `per`), exponentiation (`^`,\n    `**`). Full list: see [*Reference*](#reference) below.\n\n  - **Mathematical functions**: `abs`, `acos`, `acosh`,\n    `acot`/`arccotangent`, `acoth`/`archypcotangent`,\n    `acsc`/`arccosecant`, `acsch`/`archypcosecant`, `arcsecant`,\n    `asech`/`archypsecant`, `asin`, `asinh`, `atan2`, `atan`, `atanh`,\n    `ceil`, `cos`, `cosh`, `cot`/`cotangent`, `coth`/`hypcotangent`,\n    `csc`/`cosecant`, `csch`/`hypcosecant`, `exp`, `floor`,\n    `fromCelsius`, `fromFahrenheit`, `gamma`, `ln`, `log10`, `log`,\n    `maximum`, `mean`, `minimum`, `round`, `secant`, `sech`/`hypsecant`,\n    `sin`, `sinh`, `sqrt`, `tan`, `tanh`, `toCelsius`, `toFahrenheit`.\n\n  - **High-precision numeric type** with *30* significant digits that\n    can handle *very* large (or small) exponents like *10^(10^10)*.\n\n  - **Exponential notation**: `6.022e23`.\n\n  - **Hexadecimal, octal and binary number input**:\n\n        0xFFFF\n        0b1011\n        0o32\n        0x2.F\n        0o5p3\n\n- **Physical units**: parsing and handling, including metric prefixes:\n\n      2 min + 30 s\n      40 kg * 9.8 m/s^2 * 150 cm\n      sin(30°)\n\n  - **Supported units**: see [*Reference*](#reference) section below.\n\n  - **Implicit conversions**: `15 km/h * 30 min` evaluates to `7.5 km`.\n\n  - **Useful error messages**:\n\n        \u003e 2 watts + 4 newton meter\n\n        Conversion error:\n          Cannot convert unit N·m (base units: kg·m²·s⁻²)\n                      to unit W (base units: kg·m²·s⁻³)\n\n- **Explicit unit conversions**: the `-\u003e` conversion operator (aliases:\n  `→`, `➞`, `to`):\n\n      60 mph -\u003e m/s\n      500 km/day -\u003e km/h\n      1 mrad -\u003e degree\n      52 weeks -\u003e days\n      5 in + 2 ft -\u003e cm\n      atan(30 cm / 2 m) -\u003e degree\n      6 Mbit/s * 1.5 h -\u003e GB\n\n- **Variable assignments**:\n\n  Example: mass of the earth\n\n      r = 6000km\n      vol = 4/3 * pi * r^3\n      density = 5 g/cm^3\n      vol * density -\u003e kg\n\n  Example: oscillation period of a pendulum\n\n      len = 20 cm\n      2pi*sqrt(len/g0) -\u003e ms\n\n  - **Predefined constants** (type `list` to see them all): speed of\n    light (`c`), Planck's constant (`h_bar`), electron mass\n    (`electronMass`), elementary charge (`elementaryCharge`), magnetic\n    constant (`µ0`), electric constant (`eps0`), Bohr magneton (`µ_B`),\n    Avogadro's constant (`N_A`), Boltzmann constant (`k_B`),\n    gravitational acceleration (`g0`), ideal gas constant (`R`), ...\n\n  - **Last result**: you can use `ans` (answer) or `_` to refer to the\n    result of the last calculation.\n\n- **User-defined functions**:\n\n  Example: kinetic energy\n\n      kineticEnergy(mass, speed) = 0.5 * mass * speed^2 -\u003e kJ\n\n      kineticEnergy(800 kg, 120 km/h)\n\n  Example: barometric formula\n\n      P0 = 1 atm\n      T0 = fromCelsius(15)\n      tempGradient = 0.65 K / 100 m\n\n      pressure(height) = P0 * (1 - tempGradient * height / T0)^5.255 -\u003e hPa\n\n      pressure(1500 m)\n\n- **Sums and products**:\n\n  Syntax:\n\n      sum(\u003cexpression\u003e, \u003cindex-variable\u003e, \u003cfrom\u003e, \u003cto\u003e)\n      product(\u003cexpression\u003e, \u003cindex-variable\u003e, \u003cfrom\u003e, \u003cto\u003e)\n\n  Examples:\n\n      # sum of the first ten squares\n      sum(k^2, k, 1, 10)\n\n      # the factorial of n as the product 1 × 2 × ... × n\n      myFactorial(n) = product(k, k, 1, n)\n\n- **Unicode support**:\n\n      λ = 2 × 300 µm\n      ν = c/λ → GHz\n\n- **And more**: tab completion, command history (arrow keys,\n  `Ctrl`+`R`), pretty printing, syntax highlighting, ...\n\n## Reference\n\n- Operators (ordered by precedence: high to low)\n\n  | Operator                  | Syntax               |\n  |---------------------------|----------------------|\n  | factorial                 | `!`                  |\n  | square, cube, ...         | `²`, `³`, `⁻¹`, ...  |\n  | exponentiation            | `^`, `**`            |\n  | multiplication (implicit) | *whitespace*         |\n  | modulo                    | `%`                  |\n  | division                  | `per`                |\n  | division                  | `/`, `÷`             |\n  | multiplication (explicit) | `*`, `·`, `×`        |\n  | subtraction               | `-`                  |\n  | addition                  | `+`                  |\n  | unit conversion           | `-\u003e`, `→`, `➞`, `to` |\n  | assignment                | `=`                  |\n\n  Note that *implicit* multiplication has a higher precedence than\n  division, i.e. `50 cm / 2 m` will be parsed as `50 cm / (2 m)`.\n\n- Commands\n\n  | Command                  | Syntax             |\n  |--------------------------|--------------------|\n  | help text                | `help`, `?`        |\n  | list of variables        | `list`, `ls`, `ll` |\n  | reset environment        | `reset`            |\n  | clear screen             | `clear`, `cls`     |\n  | copy result to clipboard | `copy`, `cp`       |\n  | quit (CLI)               | `quit`, `exit`     |\n\n- Supported units (remember that you can use tab completion).\n\n  All SI-accepted units support metric prefixes and [binary\n  prefixes](https://en.wikipedia.org/wiki/Binary_prefix) (`MiB`, `GiB`,\n  ...).\n\n  | Unit                                                                         | Syntax                                                                      |\n  |------------------------------------------------------------------------------|-----------------------------------------------------------------------------|\n  | [Ampere](https://en.wikipedia.org/wiki/Ampere)                               | `amperes`, `ampere`, `A`                                                    |\n  | [Ångström](https://en.wikipedia.org/wiki/Ångström)                           | `angstroms`, `angstrom`, `Å`                                                |\n  | [Astronomical unit](https://en.wikipedia.org/wiki/Astronomical_unit)         | `AU`, `au`, `astronomicalunits`, `astronomicalunit`                         |\n  | [Atmosphere](https://en.wikipedia.org/wiki/Atmosphere_(unit))                | `atm`                                                                       |\n  | [Bar](https://en.wikipedia.org/wiki/Bar_(unit))                              | `bars`, `bar`                                                               |\n  | [Barn](https://en.wikipedia.org/wiki/Barn_(unit))                            | `barns`, `barn`                                                             |\n  | [Becquerel](https://en.wikipedia.org/wiki/Becquerel)                         | `becquerels`, `becquerel`, `Bq`                                             |\n  | [Bel](https://en.wikipedia.org/wiki/Decibel)                                 | `bels`, `bel`                                                               |\n  | [Bit](https://en.wikipedia.org/wiki/Bit)                                     | `bits`, `bit`                                                               |\n  | [Bits per second](https://en.wikipedia.org/wiki/Data_rate_units)             | `bps`                                                                       |\n  | [British thermal unit](https://en.wikipedia.org/wiki/British_thermal_unit)   | `BTU`                                                                       |\n  | [Byte](https://en.wikipedia.org/wiki/Byte)                                   | `Bytes`, `bytes`, `Byte`, `byte`, `B`, `Octets`, `octets`, `Octet`, `octet` |\n  | [Calorie](https://en.wikipedia.org/wiki/Calorie)                             | `calories`, `calorie`, `cal`                                                |\n  | [Candela](https://en.wikipedia.org/wiki/Candela)                             | `candelas`, `candela`, `cd`                                                 |\n  | [Coulomb](https://en.wikipedia.org/wiki/Coulomb)                             | `coulombs`, `coulomb`, `C`                                                  |\n  | [Cup](https://en.wikipedia.org/wiki/Cup_(unit))                              | `cups`, `cup`                                                               |\n  | [DPI](https://en.wikipedia.org/wiki/Dots_per_inch)                           | `dpi`                                                                       |\n  | [Day](https://en.wikipedia.org/wiki/Day)                                     | `days`, `day`, `d`                                                          |\n  | [Degree](https://en.wikipedia.org/wiki/Degree_(angle))                       | `degrees`, `degree`, `deg`, `°`                                             |\n  | [Dot](https://en.wikipedia.org/wiki/Dots_per_inch)                           | `dots`, `dot`                                                               |\n  | [Electronvolt](https://en.wikipedia.org/wiki/Electronvolt)                   | `electronvolts`, `electronvolt`, `eV`                                       |\n  | [Euro](https://en.wikipedia.org/wiki/Euro)                                   | `euros`, `euro`, `EUR`, `€`                                                 |\n  | [Farad](https://en.wikipedia.org/wiki/Farad)                                 | `farads`, `farad`, `F`                                                      |\n  | [Fluid ounce](https://en.wikipedia.org/wiki/Fluid_ounce)                     | `fluidounces`, `fluidounce`, `floz`                                         |\n  | [Foot](https://en.wikipedia.org/wiki/Foot_(unit))                            | `feet`, `foot`, `ft`                                                        |\n  | [Fortnight](https://en.wikipedia.org/wiki/Fortnight)                         | `fortnights`, `fortnight`                                                   |\n  | [Frame](https://en.wikipedia.org/wiki/Film_frame)                            | `frames`, `frame`                                                           |\n  | [Frames per second](https://en.wikipedia.org/wiki/Frame_rate)                | `fps`                                                                       |\n  | [Furlong](https://en.wikipedia.org/wiki/Furlong)                             | `furlongs`, `furlong`                                                       |\n  | [Gallon](https://en.wikipedia.org/wiki/Gallon)                               | `gallons`, `gallon`, `gal`                                                  |\n  | [Gauss](https://en.wikipedia.org/wiki/Gauss_(unit))                          | `gauss`                                                                     |\n  | [Gram](https://en.wikipedia.org/wiki/Gram)                                   | `grams`, `gram`, `grammes`, `gramme`, `g`                                   |\n  | [Gray](https://en.wikipedia.org/wiki/Gray_(unit))                            | `grays`, `gray`, `Gy`                                                       |\n  | [Hectare](https://en.wikipedia.org/wiki/Hectare)                             | `hectares`, `hectare`, `ha`                                                 |\n  | [Henry](https://en.wikipedia.org/wiki/Henry_(unit))                          | `henrys`, `henries`, `henry`, `H`                                           |\n  | [Hertz](https://en.wikipedia.org/wiki/Hertz)                                 | `hertz`, `Hz`                                                               |\n  | [Hogshead](https://en.wikipedia.org/wiki/Hogshead)                           | `hogsheads`, `hogshead`                                                     |\n  | [Hour](https://en.wikipedia.org/wiki/Hour)                                   | `hours`, `hour`, `hr`, `h`                                                  |\n  | [Inch](https://en.wikipedia.org/wiki/Inch)                                   | `inches`, `inch`, `in`                                                      |\n  | [Joule](https://en.wikipedia.org/wiki/Joule)                                 | `joules`, `joule`, `J`                                                      |\n  | [Katal](https://en.wikipedia.org/wiki/Katal)                                 | `katals`, `katal`, `kat`                                                    |\n  | [Knot](https://en.wikipedia.org/wiki/Knot_(unit))                            | `knots`, `knot`, `kn`, `kt`                                                 |\n  | [Kelvin](https://en.wikipedia.org/wiki/Kelvin)                               | `kelvins`, `kelvin`, `K`                                                    |\n  | [Light-year](https://en.wikipedia.org/wiki/Light-year)                       | `lightyears`, `lightyear`, `ly`                                             |\n  | [Liter](https://en.wikipedia.org/wiki/Liter)                                 | `liters`, `liter`, `litres`, `litre`, `L`, `l`                              |\n  | [Lumen](https://en.wikipedia.org/wiki/Lumen_(unit))                          | `lumens`, `lumen`, `lm`                                                     |\n  | [Lux](https://en.wikipedia.org/wiki/Lux)                                     | `lux`, `lx`                                                                 |\n  | [Meter](https://en.wikipedia.org/wiki/Meter)                                 | `meters`, `meter`, `metres`, `metre`, `m`                                   |\n  | [Mile](https://en.wikipedia.org/wiki/Mile)                                   | `miles`, `mile`                                                             |\n  | [Miles per hour](https://en.wikipedia.org/wiki/Miles_per_hour)               | `mph`                                                                       |\n  | [Millimeter of mercury](https://en.wikipedia.org/wiki/Millimeter_of_mercury) | `mmHg`                                                                      |\n  | [Minute](https://en.wikipedia.org/wiki/Minute)                               | `minutes`, `minute`, `min`                                                  |\n  | [Molal](https://en.wikipedia.org/wiki/Molality#Unit)                         | `molals`, `molal`                                                           |\n  | [Molar](https://en.wikipedia.org/wiki/Molar_concentration#Units)             | `molars`, `molar`                                                           |\n  | [Mole](https://en.wikipedia.org/wiki/Mole_(unit))                            | `moles`, `mole`, `mol`                                                      |\n  | [Month](https://en.wikipedia.org/wiki/Month)                                 | `months`, `month`                                                           |\n  | [Nautical mile](https://en.wikipedia.org/wiki/Nautical_mile)                 | `M`, `NM`, `nmi`                                                            |\n  | [Newton](https://en.wikipedia.org/wiki/Newton_(unit))                        | `newtons`, `newton`, `N`                                                    |\n  | [Ohm](https://en.wikipedia.org/wiki/Ohm)                                     | `ohms`, `ohm`, `Ω`                                                          |\n  | [Ounce](https://en.wikipedia.org/wiki/Ounce)                                 | `ounces`, `ounce`, `oz`                                                     |\n  | [PPI](https://en.wikipedia.org/wiki/Pixels_per_inch)                         | `ppi`                                                                       |\n  | [Parsec](https://en.wikipedia.org/wiki/Parsec)                               | `parsecs`, `parsec`, `pc`                                                   |\n  | [Parts-per-million](https://en.wikipedia.org/wiki/Parts-per_notation)        | `ppm`                                                                       |\n  | [Parts-per-billion](https://en.wikipedia.org/wiki/Parts-per_notation)        | `ppb`                                                                       |\n  | [Parts-per-trillion](https://en.wikipedia.org/wiki/Parts-per_notation)       | `ppt`                                                                       |\n  | [Parts-per-quadrillion](https://en.wikipedia.org/wiki/Parts-per_notation)    | `ppq`                                                                       |\n  | [Pascal](https://en.wikipedia.org/wiki/Pascal_(unit))                        | `pascals`, `pascal`, `Pa`                                                   |\n  | [Percent](https://en.wikipedia.org/wiki/Parts-per_notation)                  | `percent`, `pct`                                                            |\n  | [Person](https://en.wiktionary.org/wiki/person)                              | `persons`, `person`, `people`                                               |\n  | [Piece](https://en.wiktionary.org/wiki/piece)                                | `pieces`, `piece`                                                           |\n  | [Pint](https://en.wikipedia.org/wiki/Pint)                                   | `pints`, `pint`                                                             |\n  | [Pixel](https://en.wikipedia.org/wiki/Pixel)                                 | `pixels`, `pixel`, `px`                                                     |\n  | [Pound-force](https://en.wikipedia.org/wiki/Pound_%28force%29)               | `pound_force`, `lbf`                                                        |\n  | [Pound](https://en.wikipedia.org/wiki/Pound_(mass))                          | `pounds`, `pound`, `lb`                                                     |\n  | [Psi](https://en.wikipedia.org/wiki/Pounds_per_square_inch)                  | `psi`                                                                       |\n  | [RPM](https://en.wikipedia.org/wiki/RPM)                                     | `RPM`, `rpm`                                                                |\n  | [Radian](https://en.wikipedia.org/wiki/Radian)                               | `radians`, `radian`, `rad`                                                  |\n  | [Rod](https://en.wikipedia.org/wiki/Rod_(unit))                              | `rods`, `rod`                                                               |\n  | [Second](https://en.wikipedia.org/wiki/Second)                               | `seconds`, `second`, `sec`, `s`                                             |\n  | [Siemens](https://en.wikipedia.org/wiki/Siemens_(unit))                      | `siemens`, `S`                                                              |\n  | [Sievert](https://en.wikipedia.org/wiki/Sievert)                             | `sieverts`, `sievert`, `Sv`                                                 |\n  | [Tablespoon](https://en.wikipedia.org/wiki/Tablespoon)                       | `tablespoons`, `tablespoon`, `tbsp`                                         |\n  | [Teaspoon](https://en.wikipedia.org/wiki/Teaspoon)                           | `teaspoons`, `teaspoon`, `tsp`                                              |\n  | [Tesla](https://en.wikipedia.org/wiki/Tesla_(unit))                          | `teslas`, `tesla`, `T`                                                      |\n  | [Thou](https://en.wikipedia.org/wiki/Thousandth_of_an_inch)                  | `thou`, `mils`, `mil`                                                       |\n  | [Tonne](https://en.wikipedia.org/wiki/Tonne)                                 | `tonnes`, `tonne`, `tons`, `ton`, `t`                                       |\n  | [US Dollar](https://en.wikipedia.org/wiki/USD)                               | `dollars`, `dollar`, `USD`, `$`                                             |\n  | [Volt](https://en.wikipedia.org/wiki/Volt)                                   | `volts`, `volt`, `V`                                                        |\n  | [Watt-hour](https://en.wikipedia.org/wiki/Kilowatt_hour)                     | `Wh`                                                                        |\n  | [Watt](https://en.wikipedia.org/wiki/Watt)                                   | `watts`, `watt`, `W`                                                        |\n  | [Weber](https://en.wikipedia.org/wiki/Weber_(unit))                          | `webers`, `weber`, `Wb`                                                     |\n  | [Week](https://en.wikipedia.org/wiki/Week)                                   | `weeks`, `week`                                                             |\n  | [Yard](https://en.wikipedia.org/wiki/Yard)                                   | `yards`, `yard`, `yd`                                                       |\n  | [Gregorian year](https://en.wikipedia.org/wiki/Gregorian_year)               | `years`, `year`                                                             |\n  | [Julian year](https://en.wikipedia.org/wiki/Julian_year_(astronomy))         | `julianYears`, `julianYear`                                                 |\n\n## Pros and cons\n\n**Reasons to use Insect**\n\n- Insect is **open-source**.\n- There is a [web version](https://Insect.sh/) that requires **no\n  installation**.\n- With both browser and terminal versions available, Insect is truly\n  **cross-platform**.\n- Insect has *first-class* support for **physical units**, including\n  metric and binary prefixes. While evaluating your calculation, Insect\n  ensures that you did not accidentally make any mistakes in combining\n  the physical quantities.\n- Insect supports an\n  [**interactive**](https://en.wikipedia.org/wiki/REPL) style with its\n  readline-like interface. There is a saved history that can be browsed\n  by pressing the up and down arrow keys. The history is also searchable\n  via *Ctrl-R*.\n- Insect's syntax is rather strict. The parser does not try to be\n  \"smart\" on syntactically incorrect input, so there shouldn't be any\n  surprises - and you can trust the result of your calculation. The\n  parsed user input is always pretty-printed for a quick double-check.\n- Insect is written in [PureScript](http://www.purescript.org/) and\n  therefore benefits from all the safety guarantees that a strictly\n  typed functional programming language gives you.\n- The source code of\n  [purescript-quantities](https://github.com/sharkdp/purescript-quantities)\n  (the underlying library for physical units) as well as the code of\n  Insect itself is **extensively tested**.\n\n**Reasons to choose an alternative**\n\n- Insect is a scientific calculator. It's not a computer algebra system\n  that solves differential equations or computes integrals. Try\n  *[WolframAlpha](http://www.wolframalpha.com/)* instead.\n- There is no graphical user interface with buttons for each action\n  (*x²*, *1/x*, *DEG/RAD*, etc.).\n  *[Qalculate!](http://qalculate.github.io/)* is a fantastic tool that\n  supports both text as well as graphical input.\n- Insect supports a huge range of physical units: all [SI\n  units](https://en.wikipedia.org/wiki/International_System_of_Units),\n  all non-SI units that are accepted by SI as well as most units of the\n  imperial and US customary systems (and many more). However, if you\n  need something even more comprehensive, try *[GNU\n  units](https://www.gnu.org/software/units/)*.\n- Insect is not a general-purpose programming language. You could try\n  *[Frink](https://frinklang.org/)*.\n- Insect does not have a special mode for hexadecimal, octal, or binary\n  numbers (yet), though it does support inputting them.\n\n## FAQ\n\n- Why are Celsius and Fahrenheit not supported?\n\n  In contrast to the SI unit of temperature, the\n  [Kelvin](https://en.wikipedia.org/wiki/Kelvin), and to all other\n  units, Celsius and Fahrenheit both require an additive offset when\n  converting into and from other temperature units. This additive offset\n  leads to all kinds of ambiguities when performing calculations in\n  these units. Adding two temperatures in Celsius, for example, is only\n  meaningful if one of them is seen as an offset value (rather than as\n  an absolute temperature). Insect is primarily a scientific calculator\n  (as opposed to a unit conversion tool) and therefore focuses on\n  getting physical calculations right.\n\n  Even though *°C* and *°F* are not supported as built-in units, there\n  are helper functions to convert to and from Celsius (and Fahrenheit):\n\n  - `fromCelsius` takes a **scalar value** that represents a temperature\n    in Celsius and returns a corresponding **temperature in Kelvin**:\n\n        \u003e fromCelsius(0)\n\n           = 273.15 K\n\n        \u003e k_B * fromCelsius(23) to meV\n\n           = 25.5202 meV\n\n  - `toCelsius` takes a **temperature in Kelvin** and returns a **scalar\n    value** that represents the corresponding temperature in Celsius:\n\n        \u003e toCelsius(70 K)\n\n           = -203.15\n\n        \u003e toCelsius(25 meV / k_B)\n\n           = 16.963\n\n- Why is `1/2 x` parsed as `1/(2x)`?\n\n  *Implicit* multiplication (without an explicit multiplication sign)\n  has a higher precedence than division (see [operator precedence\n  rules](#reference)). This is by design, in order to parse inputs like\n  `50 cm / 2 m` as `(50 cm) / (2 m)`. If you meant *½ · x*, write\n  `1/2 * x`.\n\n- What is the internal numerical precision?\n\n  By default, Insect shows 6 significant digits in the result of the\n  calculation. However, the internal numerical precision is much higher\n  (30 digits).\n\n- How does the conversion operator work?\n\n  The conversion operator `-\u003e` attempts to convert the physical quantity\n  on its left hand side to the *unit of the expression* on its right\n  hand side. This means that you can write an arbitrary expression on\n  the right hand side (but only the unit part will be extracted). For\n  example:\n\n      # simple unit conversion:\n      \u003e 120 km/h -\u003e mph\n\n        = 74.5645 mi/h\n\n      # expression on the right hand side:\n      \u003e 120 m^3 -\u003e km * m^2\n\n        = 0.12 m²·km\n\n      # convert x1 to the same unit as x2:\n      \u003e x1 = 50 km / h\n      \u003e x2 = 3 m/s -\u003e x1\n\n        x2 = 10.8 km/h\n\n- What is the relation between the units `RPM`, `rad/s`, `deg/s` and\n  `Hz`?\n\n  The unit [`RPM`](https://en.wikipedia.org/wiki/Revolutions_per_minute)\n  (revolutions per minute) is defined via `1 RPM = 1 / minute` where the\n  `1` on the right hand side symbolizes \"1 revolution\".\n\n  As the base unit is the same (`1 / second`), `RPM` can be converted to\n  `rad / s`, `deg / s` or `Hz`. Note, however, that `1 RPM` does *not*\n  equal `2π rad / min` or `360° / min` or `1 Hz`, as some might expect.\n  If you're interested in computing the traversed angle of something\n  that rotates with a given number of revolutions per minute, you need\n  to multiply by `2π rad` or `360°` because:\n\n      1 RPM · (360°/revolution) = (1 revolution / minute) · (360° / revolution) = 360° / minute\n\n## Terminal version\n\nIn addition to the web interface, there is also a command-line version\n(supporting Node.js 10 and later) which can by installed via\n[npm](https://www.npmjs.com/package/insect):\n\n    npm install -g insect\n\nNote that you should almost always never run this as root or with\n`sudo`. If the command fails due to permission issues, [set up a prefix\ndirectory](https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md#install-npm-packages-globally-without-sudo-on-macos-and-linux)\nand call `npm install` as a user instead.\n\nFor Arch Linux, there is an [AUR\npackage](https://aur.archlinux.org/packages/insect/):\n\n    yaourt -S insect\n\nFor macOS, there is a [Homebrew\nformula](https://formulae.brew.sh/formula/insect):\n\n    brew install insect\n\nFor Android, install [Termux](https://termux.com/) from\n[F-Droid](https://f-droid.org/packages/com.termux/). Install Node.js in\nTermux and then install `insect` from npm:\n\n    pkg install nodejs-lts\n    npm install -g insect\n\n## Development\n\nInsect is written in PureScript (see the [Getting\nStarted](https://github.com/purescript/documentation/blob/master/guides/Getting-Started.md)\nguide). First, install all dependencies:\n\n    npm install\n\nTo start the web version:\n\n    npm start\n\nTo build a bundled JavaScript file that you can run from the terminal\n(note that this builds the web version too):\n\n    npm run build\n\nTo run the `index.cjs` file which the previous command creates:\n\n    node index.cjs\n    # Or simply on Un*x\n    ./index.cjs\n\nNote that it's not possible to just move this file anywhere and then run\nit there, since it depends on packages in `node_modules`.\n\nInsect comes with a comprehensive set of [unit tests](test/Main.purs).\nTo run them:\n\n    npm test\n\nNote that Node.js 12 or above is required to work on/build Insect\n(despite Insect itself requiring only Node.js 10 or later to run). If\nyou don't have or want to install Node.js 12 or later, you can use the\nfollowing Dockerfile to build or run Insect on Node.js 18:\n\n``` Dockerfile\nFROM node:18\n\nWORKDIR /usr/src/insect\n\nCOPY . .\n\nRUN npm install \u0026\u0026 \\\n    npm run build\n\nCMD [\"node\", \"index.cjs\"]\n```\n\nAfter creating the image (`docker build -t sharkdp/insect .`), you can\ncreate the container and copy out the build artifacts:\n\n    docker create sharkdp/insect:latest\n    # copy SHA (e.g. 71f0797703e8)\n    docker cp 71f0797703e8:/usr/src/insect/index.cjs .\n    docker cp -r 71f0797703e8:/usr/src/insect/node_modules .\n\nTo directly run Insect inside Docker (paying a heavy startup time\npenalty), you can use:\n\n    docker run -it --rm -v ~/.local/share/insect-history:/root/.local/share/insect-history sharkdp/insect:latest\n\n## Maintainers\n\n- [sharkdp](https://github.com/sharkdp)\n- [mhmdanas](https://github.com/mhmdanas)\n","funding_links":["https://github.com/sponsors/sharkdp"],"categories":["PureScript","Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkdp%2Finsect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharkdp%2Finsect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkdp%2Finsect/lists"}