Live data from Hacker News

GNU Units

gnu.org

51–60 of 117 posts

Re: GNU Units

#51
I've been learning emacs calc (my HP-48g calculator finally died) and it seems to have this built-in. It's super impressive.

Re: GNU Units

#52

Is there a spreadsheet that supports units in its cells and GNU Units in formulas? Seems like that would be an amazing open source tool.

to my surprise, it turns out that org-mode's spreadsheet does support units, because it uses emacs calc-eval. But calc seems to have its own dimensional analysis engine rather than using gnu units. i was hoping to get a temperature in this last column, for example:

    | 3 mm | 4 kg | 0.44444444 kg / mm^2 | 44.444444 kg m^2 / (s^2 mm^2) | (44.444444 kg m^2 / (s^2 mm^2 stefanboltzmann))^0.25 |
    | 2 mm | 1 kg | kg / (4 mm^2)        | 25 kg m^2 / (s^2 mm^2)        | (25 kg m^2 / (s^2 mm^2 stefanboltzmann))^0.25        |
    #+TBLFM: $3=$2/$1/$1::$4=$3*(10m/s)**2::$5=($4/ stefanboltzmann)**(1/4)
(edited, previous incorrect version follows)

    | 3 mm | 4 kg | 0.44444444 kg / mm^2 | 300 mm m^2 / s^2 | (300 mm m^2 / (s^2 stefanboltzmann))^0.25 |
    | 2 mm | 1 kg | kg / (4 mm^2)        | 200 mm m^2 / s^2 | (200 mm m^2 / (s^2 stefanboltzmann))^0.25 |
    #+TBLFM: $3=$2/$1/$1::$4=$1*(10m/s)**2::$5=($4/ stefanboltzmann)**(1/4)
similarly here i was hoping to get the time until the laptop charges and i guess i sort of did but not really

    | 22.8 Wh | 16.8 Wh | 6. Wh | 7.4W | 0.81081081 Wh / W |
    #+TBLFM: $3=$1-$2::$5=$3/$4

Re: GNU Units

#53
post #51

I've been learning emacs calc (my HP-48g calculator finally died) and it seems to have this built-in. It's super impressive.

i was excited by your comment but disappointingly emacs calc seems to have its own, less powerful unit conversion system https://news.ycombinator.com/item?id=36991392

Re: GNU Units

#54
post #47
post #44

Earlier quoted context omitted.

Trying your examples, especially considering that the elliptical orbit of the earth likewise causes the Sun's angular diameter change depending on where our orbit is, I found that Units current has a buggy definition of moondist_min and moondist_max. It's defined in the definitions file as 356.371 km and 406.720 km respectively. These should be Mm! (Or remove the period, either will work) Just to work around the bug,…

interesting, looks like an effort to improve the precision resulted in a factor of 1000 error! `help moondist_max` shows me considerably less precise values: sundist 1.0000010178 au # mean earth-sun distance moondist 3.844e8 m # mean earth-moon distance sundist_near 1.471e11 m # earth-sun distance at perihelion sundist_far 1.521e11 m # earth-sun distance at aphelion moondist_min 3.564e8 m # approximate least distance…

Where are you typing help to get that output?

Re: GNU Units

#55
post #54
post #47

Earlier quoted context omitted.

interesting, looks like an effort to improve the precision resulted in a factor of 1000 error! `help moondist_max` shows me considerably less precise values: sundist 1.0000010178 au # mean earth-sun distance moondist 3.844e8 m # mean earth-moon distance sundist_near 1.471e11 m # earth-sun distance at perihelion sundist_far 1.521e11 m # earth-sun distance at aphelion moondist_min 3.564e8 m # approximate least distance…

Where are you typing help to get that output?

at the units prompt

    You have: help moondist_max
then i scrolled up a few lines in less

Re: GNU Units

#56
post #55
post #54

Earlier quoted context omitted.

Where are you typing help to get that output?

at the units prompt You have: help moondist_max then i scrolled up a few lines in less

I could've sworn I tried and didn't get anything. Now it is working. I don't know what I did! (running version 2.22, at any rate)

Re: GNU Units

#58
post #42

I personally use Qalculate ( https://qalculate.github.io/ ), specifically their CLI version for this purpose. I'm not sure how well it compares to GNU Units, but it works well enough for my needs; and it's fairly simple due to the English syntax.

I was about to say the same. ;-) Except I use the Qt UI.

Re: GNU Units

#59
post #26
post #9

Earlier quoted context omitted.

> The mistake there was that they were unaware that they had to make the unit conversion, not that they did it wrong. I think the root cause here was continued use of medieval units, instead of just standardizing on the metric system as it's already done around nearly the entire world.

Even if it was all metric, in embedded systems you often have to deal with the same measurements in different units, like angles in radians, degrees, centidegrees, length in mm, m, cm, due to various reasons (mostly historical, like integer math being faster than floating point math). It is getting less frequent in modern code bases that target 32-bit MCUs with hardware-floating point support, but converting large co…

> Even if it was all metric, in embedded systems you often have to deal with the same measurements in different units, like angles in radians, degrees, centidegrees, length in mm, m, cm, due to various reasons (mostly historical, like integer math being faster than floating point math).

It’s also cultural - different fields use different SI units for historical or practical reasons.

My second year at MIT I was in a program (16.001 & 2) that had different classes using cgs, mks, and mills. They all met in the same classroom (different times of course!), so there was no spacial reminder. But we all survived.

Re: GNU Units

#60
post #56
post #55

Earlier quoted context omitted.

at the units prompt You have: help moondist_max then i scrolled up a few lines in less

I could've sworn I tried and didn't get anything. Now it is working. I don't know what I did! (running version 2.22, at any rate)

sweet

search is also pretty nice

    You have: search gallon
    alegallon      beergallon
    beergallon     282 UKinch^3
    brgallon       4.54609 l
    drygallon      1|2 uspeck
    gallon         usgallon
    imperialgallon brgallon
    irishgallon    217.6 UKinch^3
    scotsgallon    827.232 UKinch^3
    usgallon       231 in^3
    winegallon     231 UKinch^3
Post reply on HN