
Show HN: Insect – a high-precision scientific calculator with physical units - sharkdp
https://insect.sh/
======
boramalper
Kudos!

I would _love_ to see two more things:

1\. Propagation of uncertainty.[1] I often yearned for a calculator that
automatically propagated uncertainties for me while writing my (high-school)
lab reports. I think it would be life-saver functionality for many students at
the very least.

2\. _True_ high-precision. I don't know how Insect works under the hood (so
maybe you are already doing it this way) but instead of using _high-precision_
results of the operations, store the operations themselves and calculate the
final result at the end with the desired amount of precision.

I am aware that both requests requires a tremendous amount of change so you
might as well think of them for the next major version! =)

[1]:
[https://en.wikipedia.org/wiki/Propagation_of_uncertainty](https://en.wikipedia.org/wiki/Propagation_of_uncertainty)

~~~
schiffern
Frink is a "napkin math" language that supports units, uncertainty propagation
(keeping track of middle/lower/upper), and exact rational numbers. Named after
Professor Frink from The Simpsons, of course. Also it has an insanely
comprehensive file of units and constants (derived from GNU units and greatly
expanded), so it includes handy things like _earthmass_ , _stefanboltzmann_ ,
etc.

[http://frinklang.org](http://frinklang.org)

[https://frinklang.org/frinkdata/units.txt](https://frinklang.org/frinkdata/units.txt)

~~~
boramalper
Wow, that seems really promising. Thanks!

------
franciscop
Sorry to be the party stopper for a really awesome tool, just wanted to let
you know that you have a dead butterfly as a logo:
[http://emilydamstra.com/news/please-enough-dead-
butterflies/](http://emilydamstra.com/news/please-enough-dead-butterflies/)

~~~
nautilus12
Seriously? Not to be negative but this is even more pedantic than I would
expect from hacker news, and thats saying alot.

~~~
franciscop
Ah it was meant to be a fun fact/"were you aware of?" kind of comment, not
even criticism (;

~~~
nautilus12
It has the ring of a know it all type of pedantic comment. I can safely assume
that butterflys are deformed when they are pinned, I dont have to have a big
expose revealing it as some hidden secret. Hackernews has the habbit of making
disability level OCD seem like some grand hidden nugget that will make
everyone think you are nerding better than everyone else.

~~~
TeMPOraL
Come on. This was an obvious reference to the article that was hot on HN
recently.

Also while you "can safely assume that butterflys are deformed when they are
pinned", you can also safely assume vast majority of the world doesn't know
that, and you can also assume many people might want to reconsider using a
_dead_ butterfly as a symbol once they learn the image doesn't show what they
thought it shows.

AKA regular, friendly, and completely warranted pedantry.

------
lol768
This is pretty cool, it's one of the rare applications I've used where the
things I've tried "just work". For example "10 kg to g", "c", "c to km
s^(-1)", "c to km/s" all work intuitively. It's great it works at the command
line too.

Something I wish I'd had when I was studying Physics.

~~~
olegkikin
All of these things work in Google, btw. Google has one of the best unit
conversion tools, and it's built into the search.

~~~
foota
I've always been frustrated by how Google's unit conversion doesn't integrate
well with its calculator.

~~~
olegkikin
That's why 99% of the time there's no need to use the calculator, just type
your formula straight into the search.

~~~
JetSpiegel
And use a remote server with at least 1RTT of delay to do basic arithmetic.
Big Data indeed.

~~~
olegkikin
It's not so basic though. Google knows the current value of most currencies,
for instance. It's actually more efficient for the central servers to pull
that data and the clients to query once in a while, rather than every single
client (local calculator) to constantly keep all that data up to date. And
that's just the currencies.

~~~
JetSpiegel
How many times in you lifetime does the inches-meters conversion rate will
change?

Currencies I can understand hitting a remote server, but general unit
conversion and basic arithmetic?

------
sharkdp
Hi HN! This has been posted a few months ago (by someone else), but it wasn't
really finished back then. The feedback I got here last time has helped a lot
to improve all sorts of things. Looking forward to your comments!

Old discussion:
[https://news.ycombinator.com/item?id=13909631](https://news.ycombinator.com/item?id=13909631)

~~~
slig
Very well polished. Congrats on finishing it!

I have only one minor issue: the REPL scrolling conflicts with the default
scrolling acceleration on macOS. So just a very small movement on the trackpad
and it scrolls all the way up or down. I believe this is due the "jquery-
mousewheel" plugin [1].

[1]: [https://github.com/jquery/jquery-
mousewheel/issues/36](https://github.com/jquery/jquery-mousewheel/issues/36)

~~~
sharkdp
Thank you very much.

I'll look into this. Thank you for the reference.

------
averagewall
This is exactly what I've been looking for for years. A fast easy calculator
that's as convenient as a physical school calculator but with familiar
programming style input since computers don't have scientific calculator keys.
I can do sqrt(2) much easier than Windows' calculator and it doesn't have the
ridiculous attempt to copy a physical calculator's quirks like pressing equals
twice to re-apply the previous operation or having an "inverse"/"2nd function"
button.

Units is a bonus but really just the calculator is less frustrating than
anything else I've ever seen. Google search is too unpredictable - morphing
into a typical confusing 1970's style keypad design after your first
calculation. I tried a couple of desktop applications and they were no better
either. Come one calculator app designers - stop trying to copy a physical
calculator. Those already have a terrible design and computers don't have the
same constraints or freedoms as them.

Even better, it can act like a desktop Windows app simply by saving the page
in Chrome! Beat that for latency, Google!

~~~
mahmud
Frink has existed for ages.

[https://frinklang.org/](https://frinklang.org/)

------
jclulow
So "megabytes" appears to be the power-of-ten unit, which is generally not
that helpful in practice.

    
    
       ≫ 6 megabytes to bytes
         6 MB -> B
          = 6000000 B
    

Assuming you're sticking with the power-of-ten unit, that means you should
really grow support for the (sigh) "mebibytes" family of units; i.e., what
some folks are retro-actively calling the power-of-two byte unit.

    
    
       ≫ 6 mebibytes to bytes
         6 × mebibytes -> B
         Unknown identifier: mebibytes

~~~
bo1024
I'd call them "MB (megabytes)" and "MMB" (marketing megabytes). Pretty clear.

~~~
fnj
"M" \- "Mega" is an official general purpose SI prefix approved in 1960 which
_always_ stood for a decimal multiplier. Its common usage as a binary
multiplier was limited to counting units of computer memory, and is purely an
approximation to allow convenient speaking of, e.g., a megabyte of RAM instead
of 1.048576 megabytes of RAM. Because it reflects the natural scale of
physical memory.

It is more properly referred to as "MeB" \- "mebi", which became an ISO
standard prefix in 2008.

~~~
Magnap
Just a small correction: the abbreviated form of mebibyte is MiB.

~~~
fnj
Thanks!

------
btown
> high precision
    
    
        ≫ e*1e15
          e × 1000000000000000
           = 2718280000000000
    

Needs a bit of work, I think.

~~~
anowlcalledjosh
Indeed:

    
    
        >>> tan(90 deg)
    
          tan(90°)
    
           = 14444300000000000
    
        >>> tan(pi/2)
    
          tan(pi / 2)
    
           = -70710700000000000000
    
        >>> tan(180 deg)
    
          tan(180°)
    
           = -1.38463e-16
    

tan(90°) and tan(π/2) should both be undefined, but in Insect, they a) have a
value and b) are not even equal.

Weirdly enough, cos(π) and cos(2π) are exactly -1 and 1.

------
raketenolli
Looks nice, but is there a reason it interprets m^2 * Pa correctly

    
    
      ≫ 1 Pa * 2 m^2 / N
        1 Pa × (2 × m^2 / N)
         = 2
    

but doesn't automatically convert a result to N?

    
    
      ≫ 1 Pa * 2 m^2
        1 Pa × 2 × m^2
         = 2 m²·Pa
    

Same with W, J, s and all their relations.

~~~
sharkdp
Thank you for the feedback!

Automatic simplification (as opposed to explicit conversion) is a complex
topic. There are a few simplifications that are already applied, for example:

    
    
      20 L / m^2
       = 0.02 m
    

You are absolutely right, it'd be nice to have "Pa·m²" be converted to "N"
automatically. I've been thinking about simply going through a list of simple,
standardized units (SI units like Newton) while trying to convert the result
into these simple units. However, notice that this is not always what you
want. If someone likes to compute in imperial units, we would rather leave all
quantities in imperial units.

~~~
zem
you could only apply simplifications that minimised the sum of the absolute
value of all the unit exponents. that would be intuitively satisfying, and not
require converting imperial to metric (which would leave the exponents
unchanged)

~~~
sharkdp
Good suggestion, thank you! I was already thinking about some way to measure
"perceived complexity" of a physical unit - this sounds like a very good try
for such a heuristic.

------
semi-extrinsic
Looks really nice!

≫ exp(2*kg/s)

    
    
      exp(2 × (kg / s))
    
      Conversion error:
        Cannot convert quantity of unit kg/s to a scalar
    

Excellent!

Is there any way I can save a list of variables to file and then reload them?

I also would like to vote for supporting imaginary numbers (Issue #47).

~~~
hdivider
Great work indeed. I'd also love to see support for complex numbers. A big
differentiator over other calculators.

------
gvkv
Well done!

Plain and easy to understand interface and excellent use of colour and space.
Two suggestions:

1\. While I doubt it'll be used very much, consider adding calories for
completeness if nothing else:

    
    
      1000 kcal -> joules

or

    
    
      1000 Cal -> joules

You might also throw in cal for just for fun[1]!

2\. Change _Variables_ to _Constants_. I think this is more in keeping with
standard jargon.

[1]: cal is based on the gram while Cal or kcal is based on the kilogram.

~~~
sharkdp
Thank you for the feedback!

1\. Yes, I'll definitely add calories, good suggestion.

2\. Yes, that's probably a good idea. I should distinguish constants and
(user-defined) variables.

------
forgotpwtomain
Hmm, I find the auto-associativity to be a bit weird for example:

≫ 1/12 c

    
    
      1 / (12 × c)
       = 2.7797e-10 s/m

~~~
sharkdp
Thank you very much for the feedback!

This is on purpose (see operator precedence rules:
[https://github.com/sharkdp/insect#reference](https://github.com/sharkdp/insect#reference)).
Implicit multiplication (without an explicit multiplication operator) has a
higher precedence than division in order for something like this to work:

    
    
      tan(15cm/3m)
    
      = tan(15cm/(3m))
    

On the other hand, explicit multiplication has a lower precedence than
division, so you would have to write "1/12*c". I agree that it can be
confusing at times (that's why there is a pretty printer), but I don't want
the language/parser to be whitespace-aware.

~~~
Mateon1
See how GNU units resolves this:

    
    
      1/10 m -> 0.1 / m
      1|10 m -> 0.1 m
      27 ^ 2/3 -> 243
      27 ^ 2|3 -> 9
    

You get the gist of it - a division operator with insane precedence.

~~~
sharkdp
Ha! That's a really neat idea. Thank you for sharing this. I'll consider
adding it.

------
rnhmjoj
I use this tool also:
[http://pythonhosted.org/uncertainties](http://pythonhosted.org/uncertainties)
It comes in pretty handy for a quick calculation with error propagation.

------
eps
If it could deduce density from the material name, it'd useful for volume-to-
mass conversions., e.g.

    
    
       1 cup of butter -> g
    

Not sure if it's quite _scientific_ though... :)

~~~
6502nerdface
Wolfram Alpha can do this:

    
    
      (density of gold) * (average volume of human)
    
      -> 1282 kg
    

And if you do:

    
    
      (density of gold) * (average volume of human) * (price of gold)
    

It will even show you a plot of the time series of its value since the early
20th century.

------
db48x
Looks pretty nice, but no light years? No attoparsecs? You don't even have
hogsheads or fortnights!!!!!1!

Still, it's pretty good.

~~~
sharkdp
Thank you for the feedback. I'm always open for suggestions on new units
([https://github.com/sharkdp/purescript-
quantities](https://github.com/sharkdp/purescript-quantities))!

~~~
NotSammyHagar
Yes, please add light years, parsecs. Perhaps weight of planets in our solar
system, and the sun?

~~~
sharkdp
lightyears and parsecs are here, now.

~~~
NotSammyHagar
Thanks! You could also add speedoflight?

------
scentoni
I like this, but would really like a convert-to-base-units function.

    
    
      ≫ sqrt(1/(eps0 mu0)) ->m/s
        sqrt(1 / (eps0 × mu0)) -> m / s
         = 299833000 m/s
      ≫ sqrt(mu0/eps0) ->ohm
        sqrt(mu0 / eps0) -> Ω
         = 377.031 Ω

~~~
sharkdp
Thank you for the feedback! I'm open for any syntax suggestions.

~~~
scentoni
Maybe something like SI(sqrt(1/(eps0 mu0))) = 299792458 m/s
factor(sqrt(mu0/eps0),ohm) = SI(sqrt(mu0/eps0)/ohm)*ohm = 376.730 Ω

------
navane
I use Python with pint [0] for this. It integrates with numpy. It has support
for uncertainty. You can do all calculations Python can, Python math reads
like ascii math. It also can output to latex.

This can easily run local. If you prefer online repl, it's available on
repl.it [1]. There you can keep your scripts in the cloud for later, with
rudimentary versioning.

[0] [https://github.com/hgrecco/pint](https://github.com/hgrecco/pint) [1]
[https://repl.it](https://repl.it)

------
kwhitefoot
Please everyone in the US (and everywhere else) stop using the word imperial
to describe the US Customary system of units.

The Imperial system uses the same names for many units but the sizes of
several important ones are different.

For instance Insect says:

≫ 1 gal/1litre 1 gal / 1 L = 3.78541

If this gallon were really Imperial then it would say.

≫ 1 gal/1litre 1 gal / 1 L = 4.54609

This is mostly because 1 pint US is 16 fluid ounce US but 1 pint imperial is
20 fluid ounce imperial.

But be careful because 1 fluid ounce imperial is 28.4131 ml, whereas 1 fluid
ounce US is 29.5735 ml.

------
DINKDINK
Needs more temperature scales than just kelvin.

US Engineering units of energy would also be help certain people: such as BTUs
British Thermal Units etc.

~~~
sharkdp
I thought about it for some time and decided not to add Celsius and
Fahrenheit:
[https://github.com/sharkdp/insect/issues/68](https://github.com/sharkdp/insect/issues/68)

They are useful, of course, when it comes to simple unit conversions. But they
lead to all kinds of problems if you start using them in calculations (which
is what Insect is mostly for).

------
eggy
I have been using Frink for over 7 years. Aside from a calculator with a
gazillion units, Frink lets you program in a less verbose Java for other
tasks. Graphics are easy too. I write small apps for calculations I often need
at work with GUIs and input prompts. What makes Insect different? Can you
program apps in it?

------
F_r_k
For those interested on a CLI counterpart, GNU units is more or less the same.
The units definitions file is enormous

------
oskbor
Looks nice! are you relying on mathjs? I think it has some of the same
functionality.

If not, is the conversion logic in an npm package?

~~~
arve0
package.json and bower.json does not include mathjs, so it doesn't seem like
it does rely on mathjs.

~~~
sharkdp
Yes. The underlying unit-conversion library is called
[https://github.com/sharkdp/purescript-
quantities](https://github.com/sharkdp/purescript-quantities) It does not have
a (nice) JavaScript API, so far, as it is written in PureScript - like Insect.

------
gabipurcaru
Shameless plug for my [http://dedo.io/](http://dedo.io/), which is similar to
this this, but with less features, more money-oriented and support for any
custom units, e.g. if bag_weight = 12 kg / bag, then 10 bags * bag_weight is
120kg

~~~
arve0
Here are some more:

[http://mathnotepad.com](http://mathnotepad.com)
[https://arve0.github.io/webcas/](https://arve0.github.io/webcas/)

------
anigbrowl
Nice, but

    
    
      sin (30 rad)
      sin × 30 rad
      Unknown identifier: sin
    

Wouldn't it be great if software evaluated things, and if things didn't made
sense, considered what the possible alternatives were, a bit like semantic
checkers for spelling and grammar in text?

~~~
ksrm

        sin(30 rad)
         = -0.988032

~~~
anigbrowl
I think you've missed my point. I'm saying that it would be nice if
interactive tools were a bit smarter and could guess that the white space was
unwanted. Syntax checking in editors has improved a lot but it should do more
than just suggest long variable names as you're typing them.

------
amelius

        2**100+1-2**100
    

Equals 0?

~~~
effie
It seems it uses approximate floating point arithmetics, with 30 digit
precision.

~~~
kmill
A confusing thing is that the program seems to be using the purescript-
quantity library which uses the purescript-decimals library which is arbitrary
precision numbers, if I followed the dependencies correctly.

The readme also advertises it can deal with 10^(10^10), which it can (doubles
can't deal with this, so it's definitely not just using Javascript doubles).
The part which prints out numbers rounds to 6 places, but I don't see any
place which rounds intermediate results.

Edit: Found where 30 digits comes in. [https://github.com/sharkdp/purescript-
decimals/blob/ad719fc7...](https://github.com/sharkdp/purescript-
decimals/blob/ad719fc73b00837edf9aca5966744b1915b4a650/src/Data/Decimal.js#L3)

------
isatty
Hi Sharkdp, wonderful product. I think that unit and command autocompletion
would be super useful!

~~~
sharkdp
Hi, thank you very much for the feedback. Actually, autocompletion should work
already?

------
wotamRobin
I really like the UI and seeming wealth of different units. It doesn't look
like it supports fluid ounces though.

I tried "4 tbsp to oz" and it interprets oz as mass instead of volume. Google
correctly gives me 2 as the answer.

~~~
sharkdp
Thank you for the feedback. I'm not sure how to support this. I would probably
have to call it "fluid_ounce" / "fl_oz" or "fl.oz." in order to distinguish it
from the unit of mass.

~~~
adrianmonk
Well, the way /usr/bin/units solves it is to allow "floz", "usfloz",
"fluidounce", or "usfluidounce".

Having to learn that you can type "floz" is better than not being able to do
it at all.

(You could also allow "fl oz", "fluid ounce", "fl ounce", etc. if you tweak
your parser a little bit, but that's the deluxe version, and any functionality
at all would be a big improvement.)

~~~
sharkdp
Thank you. I'll add one of those.

------
ourcat
Nice. This is a lot like (in looks and some functionality) the macOs app,
'Numi' (which I love) : [https://numi.io/](https://numi.io/)

~~~
gumby
Numi looks nice! I like the syntax

I use the similar Soulver on my Mac and iOS devices.

~~~
ourcat
Nice.

I probably mostly use Numi for unit conversions, but asked for in a 'human'
way. eg "68 square meters in square feet"

------
toss1
Very nice on first try -- added to my quick toolbar. Great to be able to
intermix metric and SAE units, as there is (very unfortunate) constant use of
both in my field of work.

Any hope of an Android app version soon?

------
kwhitefoot
Interesting.

And it looks useful.

Unfortunately that means you will be inundated with requests for further
improvements. :-)

I see that you have a built in constant for μ0, mu0.

But it evaluates to

    
    
        0.00000125664 N/A²
    

for the ultimate in precision surely it should be expressed as

    
    
        4π×10−7 N/A²
    

At least when I use mu0 in spreadsheets, etc., I always define it that way,
easier to remember too. And sometimes it lets me see that the pi cancels out.

------
BenjaminBini
Found a bug : sin(pi) = 8.62803e-81

~~~
baq
Close enough.

------
dredmorbius
Nice, though I'm still highly partial to GNU Units. In large part as it allows
specifying output units, and not just for conversions.

Note: if you're on MacOS and are using the supplied 'units' utility, that is
BSD, not GNU units. You're going to want to install gunits from Homebrew.

[https://www.gnu.org/software/units/](https://www.gnu.org/software/units/)

~~~
sharkdp
Thank you for the feedback. What do you mean by "specifying output units"?
Insect has the "->" operator which does that:

    
    
      40000 km / c -> ms
    
       = 133.426 ms

~~~
dredmorbius
Ah, I didn't find that. Yes, that's useful.

------
rwallace
Looks good! A lot of things seem to just work.

Can you stop the cursor blinking?

If you do something like pi 1e20, I think it should print out all the digits
it has instead of printing zeros.

------
effie
I tried to convert 1000 rpm (revolutions per minute) to Hertz (periods per
second), but I get

    
    
        Unknown identifier: rpm

~~~
sharkdp
rpm are supported now. Thanks.

------
avip
≫ round(pi * 100000000000000000) = 314159265358979324

≫ round(pi * 1000000000000000000) = 3141590000000000000

(similar comment by @btown down there about e)

~~~
sharkdp
This is only how it is displayed, internal precision is always 30 digits.

Floating point numbers are displayed with 6 significant digits

Integers are displayed with all digits, unless there are more than ~20 digits,
then it is displayed with exponential notation

------
timow1337
Too bad it doesn't support complex numbers

------
Hello71
I'm a little confused as to how this improves on GNU units, which seems to
support far more:

    
    
        $ cat .units
        period(len) units=[m;s] 2pi*sqrt(len/gravity) ; (period/2pi)^2 * gravity
        $ units
        2980 units, 109 prefixes, 97 nonlinear units
        
        You have: period(20cm)
        You want: 
                Definition: 0.89729351 s
        You have: period(20cm)
        You want: ms
                * 897.29351
                / 0.0011144625
        You have: period(2ft)
        You want: ms
                * 1566.5419
                / 0.00063834872
        You have: 5 GiB
        You want: bytes
                * 5.3687091e+09
                / 1.8626451e-10
        You have: 5 hundred million
        You want: 
                Definition: 5e+08
        You have: tempF(100)
        You want: tempC
                37.777778
    

is it supposed to be a competitor? learn how to use a new language? I don't
get it.

I like the idea of keeping units, but I'm not sure this makes things easier:

    
    
        ≫ V * A / J
          V × (A / J)
           = 1 V·A/J
    
        You have: V*A/J
        You want: 
                 Definition: 1 / s

~~~
sharkdp
> I'm a little confused as to how this improves on GNU units, which seems to
> support far more [...]

> is it supposed to be a competitor? learn how to use a new language? I don't
> get it.

No reason to be confused. GNU units is a great tool. qalculate and speedcrunch
are great, too. Insect is just my take at it. Each of these tools has
advantages and disadvantages. As for insect, one of the advantages for me is
that it is platform-agnostic and can be used from anywhere without
installation. The "You have: X; You want: Y" interface is basically replaced
by "X -> Y".

~~~
Hello71
> As for insect, one of the advantages for me is that it is platform-agnostic
> and can be used from anywhere without installation.

wouldn't emscripten work great then? maybe you could add support for
definitions in "units" format?

------
te
I'd love a calculator that can implicitly recognize hh:mm:ss notation and can
answer queries like ...

3:20:36 / 26.2

7:35 * 26.2

------
antrion
Really great tool! Thanks for the hard work. It would also be really nice to
specify custom units, such as

    
    
        ≫ U = 1e-6/60 * kat
        
          U = 1.66667e-8 kat
    

Because now it does this

    
    
        ≫ 1 kat -> U
        
          1 kat -> U
        
           = 1 kat

~~~
sharkdp
Thank you for the feedback. Defining own units does not work currently, but
you can simply divide by your new unit:

    
    
      >>> U = 1e-6/60 * kat
      
        U = 1.66667e-8 kat
      
      >>> 1 kat / U
      
        1 kat / U
      
         = 60000000

------
psuter
Nice tool! Not too obvious from the landing page that there is a terminal
version. Also, some units come with implicit assumptions:

    
    
        ≫ 1 month -> days
          1 month -> d
           = 30.4167 d
        ≫ 1 year -> days
          1 year -> d
           = 365 d

~~~
sharkdp
Thank you for the feedback. I should probably consider adding something like
"Full documentation and terminal version available _here_ ". I hesitated for
quite some while before adding "month" and "year" but these (potentially
confusing) defaults seemed more useful to me compared to leaving them out.

------
pdabbadabba
Very nice! Any plans to add decibel/log-scale units? That would make this even
handier.

~~~
sharkdp
Thank you! "bel" is already supported ("decibel" also, due to the handling of
SI prefixes). Unfortunately, "dB" is parsed as "deci-byte". While this is not
really a useful unit, this is on purpose (see
[https://github.com/sharkdp/insect/issues/67](https://github.com/sharkdp/insect/issues/67))
in order to support "kB", "MB", etc. for "kilobyte", "megabyte", etc.

~~~
alok-g
This is worthy of fixing in my opinion. I do see this as a nuance, but if this
is what the common usage of dB is, it should be supported.

------
raz32dust
"9 min/mile -> km/h" fails since they are different dimensions. However in
reality we do use both of these units to indicate speed. This might be a
stretch but will be good to incorporate if it can be generalized.

------
Animats
That's cute. Are there any phone apps which do that?

Remember Graphing Calculator? That could use such features.

Autodesk Inventor understands units in formulas, but mostly for length and
angle. Everything becomes meters internally.

~~~
Cybiote
There is a version of Frink(lang) for Android. I don't think there's one for
iOS.
[https://play.google.com/store/apps/details?id=frink.android&...](https://play.google.com/store/apps/details?id=frink.android&hl=en)

------
floatboth
There's also a fork (of an older version of this) for binary instead of
physical units:
[https://soupi.github.io/insect/](https://soupi.github.io/insect/)

------
relyks
This is way faster than Wolfram Alpha and much simpler to use for most use
cases :)

------
lwlml
4 mi / min 4 × mi / min Unknown identifier: mi ≫ 4 miles / min 4 mi / min = 4
mi/min

Wut? Looks like some strangeness for the parser.

------
zython
hmmm, I'm a little bit skeptical about this.

I'd be cool to have this as a python script somewhere but I am not quite sure
wether I would visit this site whenever I need to calculate some physical
units, especially since google already covers most of my needs

dont get me wrong, I think otherwise it looks and feels great and is easy to
use but I dont know who will use this.

~~~
sharkdp
Thank you for the feedback. Fair point: Google's unit conversion is really
good. For me, there's mainly two things that stand out compared to using a
Google search:

* The REPL: I wanted an interactive terminal-style calculator where I could press Arrow-Up and easily change a few things. It also lets me define my own variables and use them in my calculations. It saves the history so I can come back and press Ctrl-R to find a recent calculation.

* Combination of Web- and terminal version. I often work in the terminal instead of the browser where I can easily use the CLI version of insect.

------
snissn
cool! Quick minor suggestion, would be cool to support words for numbers like
five kilometers or five million seconds!

~~~
sharkdp
Thank you. Same request is tracked here:
[https://github.com/sharkdp/insect/issues/86](https://github.com/sharkdp/insect/issues/86)

------
Quiark
I tried to enter

    
    
      3 5
    

which was interpreted as 3 * 5. Seems a bit risky to me :) Otherwise looks
neat.

~~~
sharkdp
Thank you for the feedback. That is intentional. Whitespace (or even lack
thereof, as in "2x") is implicit multiplication. Otherwise, you'd have to
write multiplication signs everywhere:

    
    
      2*sin(5*cm/(2*m))

~~~
Quiark
Yes, whitespace as multiplication between number and unit or variable will be
expected as multiplication but you can consider warning users about whitespace
between two number literals because that could be just a typo.

------
alok-g
It's not working on my Android, Dolphin browser. I am unable to type anything
on the prompt.

------
rikkus

      ≫ 1 mile / 2 km
        1 mi / 2 km
         = 0.804672
    

Great, but it would be nice to show the result's unit.

    
    
      ≫ 1/2km
        1 / 2 km
         = 0.5 km⁻¹
    

It's been a long while since I did any real maths, so I'm slightly stumped as
to why the -1 exponent is there.

~~~
sharkdp
In your first example, the result of the calculation is dimensionless (length
divided by length), so it does not require any unit. It's a scalar value.

In your second example, the input gets parsed as "1/(2km)" which is equal to
"0.5 km⁻¹". If you wanted half a kilometer, you'd have to enter "1/2*km"

------
Pfhreak
Great tool. I would love to see computing units -- gb/s, etc.

~~~
sharkdp
They are already supported. There is "B" or "byte" for byte and "bit" for bit.
SI-prefixes are case-sensitive, so "G" is for giga, "M" for mega, "m" for
milli.

    
    
      >>> 6 Mbit/s * 1.5 hours to GB
    
        (6 Mbit / s) × 1.5 h -> GB
    
         = 4.05 GB

------
jkh1
First thing I tried: >> 2 min 35 s + 3 min 54 s = 13920 s²

~~~
sharkdp
whitespace is multiplication. If you use explicit addition, it should work:

    
    
      2 min + 35 s + 3 min + 54 s
    
       = 6.48333 min

------
Zenst
≫ pi pi = 3.14159

High-precision!

------
sonium
Needs more energy units then Joules

~~~
sharkdp
calories are supported now.

------
jk2323
Nice. But no RPN? I pass!

------
ASipos
I tried e ^ (i * pi)

------
linker3000
Fails at the first fundamental test:

    
    
      Meaning of life
    
          Meaning × of × life
    
          Unknown identifier: Meaning

~~~
sharkdp
Oh no :-)

Quick workaround:

≫ Meaning = 6

≫ of = 1

≫ life = 7

~~~
alok-g
Hmmm, I now wish Douglas Adams had chosen 56.

Meaning = 7

of = 2

Life = 4

------
matt4077
It unfortunately fails my go-to test for these calculators:

    
    
        ≫ 7.8L/100km -> miles/gallon
          7.8 L / 100 km -> mi / gal
          Conversion error:
            Cannot convert unit L/km (base units: m²)
                        to unit mi/gal (base units: m⁻²)

~~~
yodon
That's because your unit conversion is invalid. It's entirely possible to
construct an equation that computes mi/gal from L/km (or from gal/mi for that
matter), but the dimmensionalty of the two numbers clearly disagree. Yes, you
can introduce scenarios like yours where "any human" would know what the
intended meaning of the question is, but mathematically speaking it's
incorrect and encouraging a calculator to perform mathematically incorrect
operations is a recipie for both disaster and the introduction of student/user
misunderstandings.

~~~
Swizec
For what it's worth, it works on google.

[https://www.google.com/search?q=5+l/100km+to+mpg&ie=UTF-8&oe...](https://www.google.com/search?q=5+l/100km+to+mpg&ie=UTF-8&oe=UTF-8&hl=en-
us&client=safari)

~~~
yodon
Sure, because google isn't a calculator, it's an AI machine. Sometimes it
guesses your intent right, sometimes it doesn't. That's fine for many tasks
but not a great way to design a bridge or a steam boiler.

