Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To expand on barbegal's comment, in my opinion the genius of the "micromort" unit is the observation is that you can add them.

In fact, 10 micromorts + 10 micromorts is 19.9999 micromorts (you have too many nines). But within the relevant standard of accuracy, 19.9999 = 20.

The same is true for more complicated estimates. For example, 10 micromorts every day for a year is 3643.3 micromorts, which is practically 10 times 365.

It's not completely accurate, but it's certainly good enough for the intended flavor of computation.

Also, as you observed, the system breaks down with large probabilities. I think a good analogy here is Newtonian mechanics. If you drop a ball of a building, and want to know how long it will take to fall, then for all practical purposes you can ignore the effects of relativity. But if you were to throw the ball at half the speed of light, then you would need to be more careful. (In more ways than one...)



Here's a fun way to see this approximation: 1 + x ~= e^x when x is close to zero (either positive or negative).

So let m be 10^-6 .

Probability of survival of one event = 1 - m ~= e^-m .

Probability of survival of two events = (1 - m)^2 ~= (e^-m)^2 = e^-2m ~= 1 - 2m.


To add to this, this is why we have those funny functions log1p() and expm1() in the standard library.

To add micromorts:

    double add_micromorts(double x, double y) {
        return -1e6 * expm1(
            -log1p(x * 1e-6) - log1p(y * 1e-6)
        );
    }
This is not the most accurate way of doing things, it is much simpler to

    return x + y - x * y * 1e-6;
But the formula with expm1 and log1p lets you easily do things like multiply 10 micromorts/day by 10.5 days.


They're mostly there for converting from log returns and back, but yeah they're good for any kind of probabilities as well.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: