News for hackers. Stuff that matters.
Re:Can an email go 500 miles in 2025? by jeffhuys on Tuesday July 08, 2025 @10:48AM (#44500505)

   > units
   751 units, 62 prefixes
   You have: 10 miles
   You want: meters
    * 16093.44
    / 6.2137119e-05
Huh. Never knew that was a thing!
Re:Can an email go 500 miles in 2025? by bspammer on Tuesday July 08, 2025 @11:41AM (#44501068)
It's one of my most used utilities, as someone who can't help but nerd-snipe myself on the regular. Example questions that I've used it for, just in the last week:

If I work 42 hours/week, how many minutes is that per year?

I've downloaded 4.91GB in the last minute, what's that in Mbps? How long will it take to download a 76GB game?

This AWS feature costs $0.045/hour, how much is that per month?

This guy I read about traveled 58,000km in 27 years, what's his average speed in m/s?

How much would a 10cm sphere of gold be worth in GBP?

If a 36 inch pipeline can deliver 25580 acre-feet of water in a year, how fast is the water flowing in m/s?

Re:Can an email go 500 miles in 2025? by jmoggr on Tuesday July 08, 2025 @12:41PM (#44501691)
> How much would a 10cm sphere of gold be worth in GBP?

Is there some trick to this? Or do you have to input it like:

You have: 4/3pi(10 cm)^319320 kg/m^345000 GBP/kg

(What ChatGPT gave me)

Re:Can an email go 500 miles in 2025? by bspammer on Tuesday July 08, 2025 @01:00PM (#44501862)
units has (I assume room temp/pressure) densities for all elements, as well as some precious metal prices and currency exchange rates (you need to run the units_cur program regularly to update the database for these). It also has tab completion to make discovering these a bit easier.

The invocation is

You have: goldprice * golddensity * spherevol(10cm/2)

You want: GBP

Re:Can an email go 500 miles in 2025? by jmoggr on Tuesday July 08, 2025 @01:22PM (#44502077)
Neat! Thank you!
Re:Can an email go 500 miles in 2025? by thedrexster on Tuesday July 08, 2025 @04:38PM (#44503864)
TIL -- thank you, brother!
Re:Can an email go 500 miles in 2025? by sneak on Tuesday July 08, 2025 @03:10PM (#44503035)
You can just save a step and ask ChatGPT the answer. It can google the current spot price of gold.
Re:Can an email go 500 miles in 2025? by lazide on Tuesday July 08, 2025 @04:02PM (#44503533)
Sure, but then I need to do all the math to verify the answer it gives me isn’t gibberish anyway.
Re:Can an email go 500 miles in 2025? by lionkor on Tuesday July 08, 2025 @07:40PM (#44505002)
What if its wrong
Re:Can an email go 500 miles in 2025? by kirici on Wednesday July 09, 2025 @02:10AM (#44506778)
You can just save a step of double-checking everything by using WolframAlpha

https://www.wolframalpha.com/input?i=%2810cm+sphere+of+gold+...

Re:Can an email go 500 miles in 2025? by schoen on Tuesday July 08, 2025 @09:16PM (#44505460)
Also check out Kragen's examples from a thread a couple of years ago!

https://news.ycombinator.com/item?id=36988917

Re:Can an email go 500 miles in 2025? by bspammer on Wednesday July 09, 2025 @03:35AM (#44507227)
Wow, that’s an awesome resource actually. Thanks!
Re:Can an email go 500 miles in 2025? by ThePowerOfFuet on Wednesday July 09, 2025 @03:17AM (#44507131)
>25580 acre-feet of water

This is why we can't have nice things.

Re:Can an email go 500 miles in 2025? by bqmjjx0kac on Tuesday July 08, 2025 @10:59AM (#44500625)
I always want to reach for `units`, but I'm perennially baffled by the output! What's up with the * and /?
Re:Can an email go 500 miles in 2025? by Symbiote on Tuesday July 08, 2025 @11:45AM (#44501101)
I usually call it non-interactively:

  $ units 1500DKK USD
      * 236.76653
      / 0.00422357
in which case it's always the first line I want.

(The second line is telling me 1USD is 0.00422357 of 1500DKK.)

Note if you use the currency conversions,

  systemctl enable units-currency-update.timer
is needed to keep them up-to-date.
Re:Can an email go 500 miles in 2025? by tmtvl on Wednesday July 09, 2025 @08:56AM (#44509488)
If you only need the first line you can invoke units with --terse.

  $ units --terse 2.4kWh megajoules
  8.64
Re:Can an email go 500 miles in 2025? by Arnavion on Tuesday July 08, 2025 @11:05AM (#44500696)
The * value is the result of converting 10 miles to meters, as requested.

The / value is the inverse of that in case you wanted that, ie 0.1 meters in miles.

It's explained in `man 1 units`

Re:Can an email go 500 miles in 2025? by bqmjjx0kac on Tuesday July 08, 2025 @11:34AM (#44500998)
Oh, I know it's explained in the man page. I read it every time and promptly forget because I can't internalize the choice of notation.
Re:Can an email go 500 miles in 2025? by spacepotato on Tuesday July 08, 2025 @11:42AM (#44501074)
If you find the output a bit hard to parse at times (as I do), you might want to try qalc instead, I use it all the time from the terminal to do conversions:

    $ qalc 
    > 3 millilightseconds to miles

      3 milliLightSeconds ≈ 558 mi + 1491 yd + 0.1692913386 ft
I'm not sure if it has all the same units as `units` does, but it replaced my use of it entirely as it can do other useful operations as well
Re:Can an email go 500 miles in 2025? by jagged-chisel on Tuesday July 08, 2025 @11:36AM (#44501018)
* multiply

/ divide

Re:Can an email go 500 miles in 2025? by bqmjjx0kac on Tuesday July 08, 2025 @06:47PM (#44504720)
I am familiar.
Re:Can an email go 500 miles in 2025? by barnas2 on Tuesday July 08, 2025 @11:10AM (#44500752)
the * is denoting the conversion from your first unit to your second, the / denotes the other way.

You have: 1 miles You want: feet * 5280 / 0.00018939394

In the above example, 1 mile is 5280 feet, and 1 foot is 0.00018939394 miles

If I do 2 miles to feet, the values are doubled (or halved for the reverse conversion)

You have: 2 miles You want: feet * 10560 / 9.469697e-05