Hacker News new | ask | show | jobs
by majewsky 2592 days ago
> So I can send duckduckgo a query like "!g speed of light / 400nm in terahertz" and I get the calculated unit-correct answer immediately.

You can use the command-line program units(1) to do this, available on all Unices. (The preinstalled version on macOS is horribly outdated though, so you might have to look for a newer version in Homebrew.)

  $ units --verbose
  Currency exchange rates from FloatRates (USD base) on 2019-02-20 
  3070 units, 109 prefixes, 109 nonlinear units

  You have: c / 400 nm
  You want: terahertz
        c / 400 nm = 749.4811449999999695137376 terahertz
        c / 400 nm = (1 / 0.001334256380792608193130988) terahertz
The only drawback is that getting up-to-date currency exchange rates requires running an extra program, units_cur.