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.
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.
A type system that understands units of measurement can help:
https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...
It's perfectly possible to write F# code without those and messing up units conversion.
F# has this built in but it can be achieved with libraries in some other languages. For example, in Haskell with the dimensional package[1]:
import Numeric.Units.Dimensional.Prelude
import Numeric.Units.Dimensional.NonSI (mile)
speedLimit :: Velocity Double
speedLimit = 30 *~ (mile / hour)
main :: IO ()
main = do
let speed1 = 35 *~ (kilo meter / hour)
let speed2 = 35 *~ (mile / hour)
let speed3 = 35
print (speed1 <= speedLimit)
print (speed2 <= speedLimit)
print (speed3 <= speedLimit)
GHC will give you an error because `speed3` is mistyped.Go read about it yourself. NASA got some data from a contractor. The data had no units at all. The contractor assumed the data to be in some kind of US-standard units. NASA got these raw numbers and assumed they were in some kind of SI units.
Having enforced units in your language isn't going to help in this situation at all. They weren't exchanging code, they were exchanging raw data, or more specifically, a table with a bunch of numbers on it. The people at NASA simply assumed some units (instead of calling the contractor and asking), and they would have done this in your scenario too.
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.
It is getting less frequent in modern code bases that target 32-bit MCUs with hardware-floating point support, but converting large codebases
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.