code: def float_constructor(loader, node):
      
      s = loader.construct_scalar(node)
      if s == '.inf':
          return Decimal('Infinity')
      elif s == '-.inf':
          return -Decimal('Infinity')
      elif s == '.nan':
          return Decimal('NaN')
      return Decimal(s)
docs: Construct Decimal from YAML float encoding.