set_order#

rateslib.dual.set_order(val, order)#

Changes the order of a Dual or Dual2 leaving floats and ints unchanged.

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

  • order (int in [0, 1, 2]) – The AD order to convert to. If val is float or int 0 will be used.

Return type:

float, int, Dual or Dual2