Approximating univariate factored distributions via message-passing algorithms