13 ms·
Show HN: Insect – a high-precision scientific calculator with physical units
- Animats 9y agoThat'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 9y agoThere 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&hl=en https://play.google.com/store/apps/details?id=frink.android&...
- paperpunk 9y agoSoulver does it (Mac/iPhone), it just uses 'as' instead of '->' E.g. "6Mbit/s * 1.5h as GB" I've been using it for a while now and I can't imagine going back to a traditional calculator
- sharkdp 9y agoHi 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 9y agoVery 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 9y agoThank you very much. I'll look into this. Thank you for the reference.
- lol768 9y agoThis 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 9y agoAll of these things work in Google, btw. Google has one of the best unit conversion tools, and it's built into the search.
- foota 9y agoI've always been frustrated by how Google's unit conversion doesn't integrate well with its calculator.
- olegkikin 9y agoThat's why 99% of the time there's no need to use the calculator, just type your formula straight into the search.
- JetSpiegel 9y agoAnd use a remote server with at least 1RTT of delay to do basic arithmetic. Big Data indeed.
- olegkikin 9y agoIt'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.
- 9y ago
- oskbor 9y agoLooks 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 9y agopackage.json and bower.json does not include mathjs, so it doesn't seem like it does rely on mathjs.
- sharkdp 9y agoYes. 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.
- isatty 9y agoHi Sharkdp, wonderful product. I think that unit and command autocompletion would be super useful!
- sharkdp 9y agoHi, thank you very much for the feedback. Actually, autocompletion should work already?
- deleted 9y ago[deleted]
- scentoni 9y agoI 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 Ω
- infinisil 9y agoFun fact: Converting to a unit is exactly the same as dividing by it (temperatures are the exception), so this works too: ≫ sqrt(mu0/eps0) / ohm sqrt(mu0 / eps0) / Ω = 376.73 Also seems like the constants (!) got changed a bit since you executed this
- sharkdp 9y agoThank you for the feedback! I'm open for any syntax suggestions.
- scentoni 9y agoMaybe something like SI(sqrt(1/(eps0 mu0))) = 299792458 m/s factor(sqrt(mu0/eps0),ohm) = SI(sqrt(mu0/eps0)/ohm)*ohm = 376.730 Ω
- Quiark 9y agoI tried to enter 3 5 which was interpreted as 3 * 5. Seems a bit risky to me :) Otherwise looks neat.
- sharkdp 9y agoThank 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 9y agoYes, 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.
- db48x 9y agoLooks pretty nice, but no light years? No attoparsecs? You don't even have hogsheads or fortnights!!!!!1! Still, it's pretty good.
- deleted 9y ago[deleted]
- sharkdp 9y agoThank 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)!
- gaius 9y agoPlease see http://www.theregister.co.uk/Design/page/reg-standards-converter.html http://www.theregister.co.uk/Design/page/reg-standards-conve... :-)
- NotSammyHagar 9y agoYes, please add light years, parsecs. Perhaps weight of planets in our solar system, and the sun?
- sharkdp 9y agolightyears and parsecs are here, now.
- NotSammyHagar 9y agoThanks! You could also add speedoflight?
- sharkdp 9y agolightyears, (atto)parsecs and fortnights are now supported.
- forgotpwtomain 9y agoHmm, I find the auto-associativity to be a bit weird for example: ≫ 1/12 c 1 / (12 × c) = 2.7797e-10 s/m
- sharkdp 9y agoThank 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.
- nine_k 9y agoApparently unit-less constants should bind stronger: 1/4 s - > (1/4) s 1 m / 4 s - > (1 m) / (4 s)
- semi-extrinsic 9y agoLooks 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).
- sharkdp 9y agoThank you for the feedback! > Is there any way I can save a list of variables to file and then reload hem? Not yet, no - thank you for the suggestion. The command-line version can read from a file, though (https://github.com/sharkdp/insect/issues/40 https://github.com/sharkdp/insect/issues/40)
- hdivider 9y agoGreat work indeed. I'd also love to see support for complex numbers. A big differentiator over other calculators.
- matt4077 9y agoIt 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 9y agoThat'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 9y agoFor what it's worth, it works on google. https://www.google.com/search?q=5+l/100km+to+mpg&ie=UTF-8&oe=UTF-8&hl=en-us&client=safari https://www.google.com/search?q=5+l/100km+to+mpg&ie=UTF-8&oe...
- yodon 9y agoSure, 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.
- sharkdp 9y agoYes, 100% agree with your comment. I'd rather have a calculator application that is maybe a little less "smart" in exchange for mathematical correctness and predictability.
- arnarbi 9y agoI don't remember which calculator did this (I think GNU units), but I've seen this handled automatically with a warning saying "Warning: reciprocal conversion"
- ourcat 9y agoNice. This is a lot like (in looks and some functionality) the macOs app, 'Numi' (which I love) : https://numi.io/ https://numi.io/
- gumby 9y agoNumi looks nice! I like the syntax I use the similar Soulver on my Mac and iOS devices.
- ourcat 9y agoNice. I probably mostly use Numi for unit conversions, but asked for in a 'human' way. eg "68 square meters in square feet"
- desdiv 9y agoDamn, that looks sweet. Is there a similar app out there for Android and Ubuntu/Debian?
- timow1337 9y agoToo bad it doesn't support complex numbers
- gabipurcaru 9y agoShameless 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 9y agoHere are some more: http://mathnotepad.com http://mathnotepad.com https://arve0.github.io/webcas/ https://arve0.github.io/webcas/
- amelius 9y ago2**100+1-2**100 Equals 0?
- effie 9y agoIt seems it uses approximate floating point arithmetics, with 30 digit precision.
- sharkdp 9y agoCorrect. "2^99 + 1 - 2^99" still works because 2^99 < 10^30
- kmill 9y agoA 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/ad719fc73b00837edf9aca5966744b1915b4a650/src/Data/Decimal.js#L3 https://github.com/sharkdp/purescript-decimals/blob/ad719fc7...
- gjjrfcbugxbhf 9y agoThat's nice test but to fair their tagline says high precision not arbitrary precision.
- snissn 9y agocool! Quick minor suggestion, would be cool to support words for numbers like five kilometers or five million seconds!
- sharkdp 9y agoThank you. Same request is tracked here: https://github.com/sharkdp/insect/issues/86 https://github.com/sharkdp/insect/issues/86
- toss1 9y agoVery 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?
- linker3000 9y agoFails at the first fundamental test: Meaning of life Meaning × of × life Unknown identifier: Meaning
- pdabbadabba 9y agoVery nice! Any plans to add decibel/log-scale units? That would make this even handier.
- sharkdp 9y agoThank 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 9y agoThis 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.
- raketenolli 9y agoLooks 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 9y agoThank 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 9y agoyou 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 9y agoGood 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.
- franciscop 9y agoSorry 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/
- alok-g 9y agoWow! The article is eye-opening; worthy of submitting to HN as a news link in my opinion to create more awareness. If you agree, please submit.
- franciscop 9y agoI found it through the front page a few weeks back (;
- arnarbi 9y agohttps://news.ycombinator.com/item?id=14460013 https://news.ycombinator.com/item?id=14460013
- xyzzy_plugh 9y agoThat looks like a living butterfly.
- sharkdp 9y agoOh, I didn't know that :-)... that's interesting. I'm very much open for suggestions on how to improve the logo. I already went through a couple of iterations... https://github.com/sharkdp/insect/blob/master/media/insect.svg https://github.com/sharkdp/insect/blob/master/media/insect.s...
- ythn 9y agoFwiw I think the logo looks great
- franciscop 9y agoActually it was just a "did you know?" comment, 99.99% of people don't know/care about it. I'd throw a SVG modification but I won't have my laptop around/time until Monday, when I'd just lower the upper wing a bit.
- rnhmjoj 9y agoI use this tool also: http://pythonhosted.org/uncertainties http://pythonhosted.org/uncertainties It comes in pretty handy for a quick calculation with error propagation.
- alok-g 9y agoIt's not working on my Android, Dolphin browser. I am unable to type anything on the prompt.
- wotamRobin 9y agoI 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.
- ythn 9y agoIt doesn't support "stones" (st?) either. I tried "20 st -> kg" (Game of Thrones uses stones as units of mass) but it didn't work.
- sharkdp 9y agoThank 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.
- jdmichal 9y agoYou could try to go the complicated route to disambiguate based on whether the other units present are liquid volume or mass.
- adrianmonk 9y agoWell, 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.)
- deleted 9y ago[deleted]
- subhsandhu1 9y agoJab Harry Met Sajal Songs Pk (2017) Movie Mp3 Song Album Download http://songspk.desilyrics.in/download/jab-harry-met-sajal-mp3-songs-pk.html http://songspk.desilyrics.in/download/jab-harry-met-sajal-mp...
- Pfhreak 9y agoGreat tool. I would love to see computing units -- gb/s, etc.
- sharkdp 9y agoThey 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
- effie 9y agoI tried to convert 1000 rpm (revolutions per minute) to Hertz (periods per second), but I get Unknown identifier: rpm
- sharkdp 9y agorpm are supported now. Thanks.
- btown 9y ago> high precision ≫ e*1e15 e × 1000000000000000 = 2718280000000000 Needs a bit of work, I think.
- deleted 9y ago[deleted]
- contravariant 9y agoYet weirdly enough sin(pi) and 1 - log(e) are pretty close to 0 (still not exact but accurate to 30 digits).
- sharkdp 9y agoI realize it looks confusing in this example but this is just how it is displayed (with 6 significant digits). The internal precision is 30 digits.
- anowlcalledjosh 9y agoIndeed: >>> 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.
- psuter 9y agoNice 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 9y agoThank 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.
- relyks 9y agoThis is way faster than Wolfram Alpha and much simpler to use for most use cases :)
- antrion 9y agoReally 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 9y agoThank 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
- ASipos 9y agoI tried e ^ (i * pi)
- avip 9y ago≫ round(pi * 100000000000000000) = 314159265358979324 ≫ round(pi * 1000000000000000000) = 3141590000000000000 (similar comment by @btown down there about e)
- sharkdp 9y agoThis 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
- zython 9y agohmmm, 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 9y agoThank 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.
- navane 9y agoThere's a good python library to work with units: it's called Pint (named after a certain quantity of beer). Afaik it does everything OP does, and more and better.
- boramalper 9y agoKudos! 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
- maho 9y agoI absolutely agree with these requests! I am so desperate for an uncertainty-aware/unit-aware calculator that I tried implementing one myself, even though it is quite beyond my skill-set. I gave up and used Mathematica (more on that below). Two comments on the requests: - Most existing calculators that offer propagation of uncertainty use a simplified formula -- the one with the square root and the partial derivatives. That's OK for lab courses. But in real life, the distributions of the input parameters are non-Gaussian, the formulas depend on each other in subtle ways that are easy to miss, and you have to deal with systematic and statistic errors (precision vs. accuracy). Most researches I know, myself included, sort-of fudge this with pen-and-paper and Excel, and end up underestimating their errors... In my view, the best solution is a Monte-Carlo type calculation, where you draw the input parameters from their respective distributions, then do the calculation, and repeat 10000 times. The mean and the std deviation gives you final result. - Arbitrary precision is doable, but often unnecessary. To me, it was always more important to know when the result is numerical garbage (in which case I rearrange the equations to make them more computer-friendly), than to choose some precision up-front, hoping it would be enough. For me, interval arithmetic [1] is the best solution. All numbers are represented by the next higher and next lower floating point number, and each calculation results in a new interval, where the result is guaranteed to be in the interval. Often, the intervals blow up unnecessarily, but are still much smaller than the desired accuracy or precision. These days, whenever I get an unexpected result, I repeat the calculation with interval arithmetic in Mathematica or Matlab to exclude numerical errors. Interval arithmetic is not very costly in terms of run-time, and there are great libraries out there. The unit-aware, uncertainty aware calculator that I ended up using for my PhD-thesis was Mathematica. Mathematica deals with units somewhat well and iterates over lists natively. You can write standard formulas and feed them lists for the Monte-Carlo calculation. However, unit calculations are extremely slow. My workaround split the calculation into one unit-calculation and 10000 unit-less calculations. However, I ran into so many Mathematica bugs and quirks that hosed the calculation ("transparent" Mathematica-updates that changed the result, file corruption (!), swalled minus-signs (!!)) that I cannot possibly recommend Mathematica for anything but toy projects. Great work! I will keep a close eye on this awesom project! [1]: http://subs.emis.de/LNI/Seminar/Seminar07/148.pdf http://subs.emis.de/LNI/Seminar/Seminar07/148.pdf
- BenjaminBini 9y agoFound a bug : sin(pi) = 8.62803e-81
- baq 9y agoClose enough.
- floatboth 9y agoThere'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/
- qualitytime 9y agoThe first test i always do with a new calulator: 99999999999999! = 1.6456e+1356570551809668 999999999999999! = Infinity 99999999999999999!= NaN
- jkh1 9y agoFirst thing I tried: >> 2 min 35 s + 3 min 54 s = 13920 s²
- sharkdp 9y agowhitespace is multiplication. If you use explicit addition, it should work: 2 min + 35 s + 3 min + 54 s = 6.48333 min
- anigbrowl 9y agoNice, 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 9y agosin(30 rad) = -0.988032
- anigbrowl 9y agoI 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.
- lwlml 9y ago4 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.
- jclulow 9y agoSo "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 9y agoI'd call them "MB (megabytes)" and "MMB" (marketing megabytes). Pretty clear.
- l-p 9y agoThere is already MiB (mebibytes) and MB (once actual megabytes, now what you call MMB).
- bo1024 9y agoYes but that concedes the change in definition of MB, which I strongly dislike.
- fnj 9y ago"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.
- bo1024 9y agoInteresting! But hmm..."Megameter" "Megaliter" "Megagram"
- 9y ago
- DINKDINK 9y agoNeeds 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 9y agoI 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).
- sharkdp 9y agocalories are supported now
- sonium 9y agoNeeds more energy units then Joules
- sharkdp 9y agocalories are supported now.
- jk2323 9y agoNice. But no RPN? I pass!
- eps 9y agoIf 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 9y agoWolfram 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.
- dredmorbius 9y agoGNU Units is extensible in this regard. You can add your own dimensions. I'm trying to think of how you'd specify density of butter, perhaps "butterdensity", cognate, "earthmass". I've got a number of geographic areas specified, so I can give you, say, paper size in milli manhattanarea.
- F_r_k 9y agoFor those interested on a CLI counterpart, GNU units is more or less the same. The units definitions file is enormous
- rikkus 9y ago≫ 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 9y agoIn 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"
- deleted 9y ago[deleted]
- Hello71 9y agoI'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
- rjzzleep 9y agoI'd say better user experience. But then again qalculate! also does provide you with that. https://qalculate.github.io/ https://qalculate.github.io/ {~} % qalc > c to km s^(-1) speed_of_light = approx. 299792.46(km / s) > 10 kg to g 10 * kilogram = 10000 g > $10 to euro dollar * 10 = approx. EUR 8.9501477 > 100oF to oC (((100 * kelvin) + (459.67 * kelvin)) * 5) / 9 = approx. 37.777778 oC
- sharkdp 9y ago> 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".
- gvkv 9y agoWell 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.
- Zenst 9y ago≫ pi pi = 3.14159 High-precision!
- eggy 9y agoI 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?
- averagewall 9y agoThis 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!
- raz32dust 9y ago"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.
- dredmorbius 9y agoNice, 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 9y agoThank 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 9y agoAh, I didn't find that. Yes, that's useful.
- rwallace 9y agoLooks 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.
- te 9y agoI'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
- navane 9y agoI 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
- navane 9y agoI use Python with pint [0] for this. It integrates with numpy. This you 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 9y agoInteresting. 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.
- kwhitefoot 9y agoPlease 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.