Hacker News new | ask | show | jobs
by AlotOfReading 13 days ago
Unit mistakes happen all the time, which is why you should be using your units library religiously and still being vigilant even then.

Worst case I've found was off by 15 orders of magnitude.

4 comments

One of my personal rules is to ALWAYS suffix the variables and fields with unit names:

`timeout_ms` or `rate_kbps`, NOT `timeout` or `rate`.

Unless the variable type already constrains it (e.g. Duration in Go).

Until someone comes along and changes it without updating the name, or the value comes from a remote service and they change without you changing your name… etc.
This also helps downstream a lot.
It's not difficult to write regression tests that catch unit mistakes.
One of the Mars landers famously failed due to unit conversion errors from metric to standard.
I didn't know the imperial system was named "standard". Funny, cause its everything but standard both internationally and its definitions (which are not standard as based on SI)
Claiming something isn't standard because it isn't based on SI is entirely circular in the case of weights and measures.

That said I wish the US would bite the bullet and make the switch. Mandating dual labeling on everything would be a great start. Then in 20 years we could narrow it back down to one.

You just need to start teaching kids the metric system. Then when they'll grow up the switch will almost magically happen by itself.
All of my science classes in the rural US from middle school onward were taught entirely in metric, and it had been that way for decades prior. Obviously I'm an adult now, and metric still isn't universal.
The cost is too high. You can't have mph and kmh signs on the same road. So you gotta switch all the signs at once. Mile markers, exit numbers (are miles), distance to signs, all have to change.

I did the math on a comment elsewhere. Just google how many miles of interstate there are, and quadruple it, thats not even approaching how many signs you'd need for just the interstate. Signs run $25-ish, plus installation, which can cost >$1000. At the very least the km markers will need to be installed.

I know you’re being snarky, but the US system is not “imperial” anyway. It’s properly “US Customary” but is often called “US Standard.”
Wasn't it (also?) the Ariane V flight in 1996? Oh, NVM, that was an overflow error.
Degrees, very funny.