Live data from Hacker News

GNU Units

gnu.org

61–70 of 117 posts

Re: GNU Units

#62
post #7

Units of measure are, of course, the aboriginal type system for pre-software hand calculation.. carrying units along to make sure you do not add apples to oranges { unless you know how to convert "apples" to "oranges" for some adapted metaphorical fruits.. e.g. orange section/segment/slices :-) }. Nim [1] has sufficient compile-time strength that units can be integrated with the static type system: https://github.com…

Just for curiosity, what Nim does that other languages with operator overloading wouldn't do? Aside from the "number.unit" syntax, you could do some trickery to get units comparison and conversions even on C++

Re: GNU Units

#63
post #6
post #4

Earlier quoted context omitted.

>This tool is underrated. Failing to deal with units conversion already crashed a Mars probe The mistake there was that they were unaware that they had to make the unit conversion, not that they did it wrong. No tool can, by itself, overcome your ignorance of its necessity.

> No tool can, by itself, overcome your ignorance of its necessity. A type system that understands units of measurement can help: https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...

That still requires you to know about its existence.

It's perfectly possible to write F# code without those and messing up units conversion.

Re: GNU Units

#64
When I run `sudo pacman -Fy units` on Arch Linux I only get a similar tool from plan9port, it's strange they took the GNU version out of the repos.

Re: GNU Units

#65
post #46

This is a great program and I use it almost every day. A+ For my local units file, I've also defined a “floppyMB” for retro computing purposes. The old “1.2 MB”, “1.44 MB”, “2.88 MB” measures were based on the idea that “1 MB = 1000 KiB” (seriously). The “1.44 MB” floppies would be measured as either 1.47 MB or 1.41 MiB in more conventional units. echo "floppyMB 1000 KiB" >> ~/.units units "1.44 floppyMB" MiB

This is highly cursed.

Hardware manufacturers of the 90s have a lot to answer for with regards to binary prefix units.

Re: GNU Units

#66
post #64

When I run `sudo pacman -Fy units` on Arch Linux I only get a similar tool from plan9port, it's strange they took the GNU version out of the repos.

Yeah looks like you need to install `units` from AUR.

Re: GNU Units

#68

> You have: 17 yards + 2 feet + 5 inches Measuring things like this seems brain dead.

Yes, it's a sample, like how sample programming code snippets use names such as Foo and Bar. Similarly braindead to do it in practice!

Though imperial-system users don't mix units like that, it's not like "20 minutes 30 seconds", they just use fractions or decimals as appropriate. "20 and a half minutes" or "20.5 minutes". You'd just say "17.8 yards".

(Metric user here, with an appreciation for base 12)

Re: GNU Units

#69

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.

Not a full spreadsheet, but I have a passion project that can support units:

https://instacalc.com/56734

I wanted a quick, shareable "back of the envelope" tool.

Re: GNU Units

#70
post #64

When I run `sudo pacman -Fy units` on Arch Linux I only get a similar tool from plan9port, it's strange they took the GNU version out of the repos.

Without looking into it at all, it probably just didn't have an active package maintainer.
Post reply on HN