let do_promotion ~with_alarms ~src_typ ~dest_type v =
  match dest_type, src_typ with
  | TFloat _, TInt _ ->
      Cvalue_type.V.cast_int_to_float ~with_alarms (get_rounding_mode()) v
  | TInt _, TFloat _ -> Cvalue_type.V.cast_float_to_int ~with_alarms v
  | _, _ -> v