def set_floating_point_behaviour_options(opts,
                                         inv=True,
                                         div0=True,
                                         oflo=True,
                                         esr=True,
                                         nanoo=True):
  """Set the IPU floating point control behaviour bits

  See the Poplar API documentation for poplar::FloatingPointBehaviour.

  Args:
    inv: If true a floating point invalid operation (defined by IEEE 754)
      will cause an exception.
    div0: If true a floating point divide by zero operation will cause an
      exception.
    oflo: If true a floating point overflow will cause an exception.
    esr: Enable stochastic rounding.
    nanoo: Enable Not-a-Number on overflow mode.
  """
  opts.floating_point_behaviour.inv = inv
  opts.floating_point_behaviour.div0 = div0
  opts.floating_point_behaviour.oflo = oflo
  opts.floating_point_behaviour.esr = esr
  opts.floating_point_behaviour.nanoo = nanoo

  return opts