set_order_convert#

rateslib.dual.set_order_convert(val, order, tag, vars_from=None)#

Convert a float, Dual or Dual2 type to a specified alternate type.

Parameters:
  • val (float, Dual or Dual2) – The value to convert.

  • order (int) – The AD order to convert the value to if necessary.

  • tag (list of str, optional) – The variable name(s) if upcasting a float to a Dual or Dual2

  • vars_from (optional, Dual or Dual2) – A pre-existing Dual of correct order from which the Vars are extracted. Improves efficiency when given.

Return type:

float, Dual, Dual2