Formula (6.67, 6.68). Statement that -log(1-u) is equivalent to -log(u) is true iff u is U(0,1) in the (0,1) range. In reality Python U(0,1) as well as C/C++ U(0,1) are defined in the interval [0,1). Thus, -log(1-u) will always work while -log(u) sometimes will produce FP exceptions when 0 is sampled
Formula (6.67, 6.68). Statement that
-log(1-u)
is equivalent to-log(u)
is true iffu
is U(0,1) in the (0,1) range. In reality Python U(0,1) as well as C/C++ U(0,1) are defined in the interval [0,1). Thus,-log(1-u)
will always work while-log(u)
sometimes will produce FP exceptions when 0 is sampled