code: def val_to_fp(self, sort, signed=True, rm=None):
          if rm is None:
              rm = fp.fp.RM.default()
          if sort is None:
              sort = fp.fp.FSort.from_size(self.length)
          op = fp.fpToFP if signed else fp.fpToFPUnsigned
          return op(rm, self, sort)