code: def rounding_error(x, denormal_correction=True):
      """Compute the maximum absolute 32-bit rounding error possible in `x`.
  
      That is, we compute
        max_y |y - x|  among y where x = round_in_32_bits(y)
  
      All internal computations are carried out in float64 so this
      function is itself accurate.
  
      TensorFlow flushes denormals to zero, so there's a rounding error
      cliff at the smallest normal positive float: anything that rounded
      to 0 could have been as large as `tiny`; but anything that rounded
      to anything positive must have been normal.  The
      `denormal_correction` flag controls whether this is taken into
      account.
  
      Args:
        x: Tensor of `x` values to compute 32-bit rounding error for.  Is
          internally cast to float64 regardless of input dtype.
        denormal_correction: Python bool.  Denormal flushing is accounted
          for if `True`; otherwise rounding is assumed to affect only the
          bits that fall off the mantissa.
  
      Returns:
        err: float64 Tensor of elementwise maximum rounding errors in `x`.
      """
      resolution = tf.math.pow(tf.constant(2.0, dtype=tf.float64), -24)
      tiny32 = tf.constant(np.finfo(np.float32).tiny, dtype=tf.float64)
      # minute32 approximates (in 64 bits) the smallest positive 32-bit
      # float including denormals.  There is no way for 32-bit rounding
      # error to be less than this.
      minute32 = tiny32 * resolution
      x = tf.math.abs(tf.cast(x, dtype=tf.float64))
      if denormal_correction:
          return tf.where(x >= tiny32, x * resolution, tiny32)
      else:
          return tf.maximum(x * resolution, minute32)
  
file_path: probability/tensorflow_probability/python/internal/numerics_testing.py
imports: import functools
  from absl import logging
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.math import gradient
label_desc: Use image node_id 6 for calling a global function with example usage: rounding_error(x, denormal_correction) and returns: tf, tf