←back to thread

Uncertain<T>

(nshipster.com)
444 points samtheprogram | 1 comments | | HN request time: 0.001s | source
Show context
layer8 ◴[] No.45055943[source]
Arguably Uncertain should be the default, and you should have to annotate a type as certain T when you are really certain. ;)
replies(2): >>45056272 #>>45056582 #
nine_k ◴[] No.45056582[source]
Only for physical measurements. For things like money, you should be pretty certain, often down to exact fractional cents.

It appears that a similar approach is implemented in some modern Fortran libraries.

replies(4): >>45057007 #>>45057078 #>>45057151 #>>45060359 #
rictic ◴[] No.45057078[source]
A person might have mistyped a price, a barcode may have been misread, the unit prices might be correct but the quantity could be mistaken. Modeling uncertainty well isn't just about measurement error from sensors.

I wonder what it'd look like to propagate this kind of uncertainty around. You might want to check the user's input against a representative distribution to see if it's unusual and, depending on the cost of an error vs the friction of asking, double-check the input.

replies(1): >>45058748 #
1. bee_rider ◴[] No.45058748{3}[source]
Typos seem like a different type of error from physical tolerances, and one that would be really hard to reason about mathematically.