Electronic – Does LTSpice support a “Remainder” or “Modulus” function

automationltspicemath

I am trying to change a parameter in LT Spice with if statements and make it change on whether a different value is even or odd.

Mathematically, this would be easy with a remainder or modulous function because XR2 or X%2= 0 means it's even and XR2 or X%2= 1 means it's odd. However, I've looked through the LTSpice .param documentation and couldn't find any support for this type of function. Does anyone know another way to perform this operation or if this function goes by a different name?

Best Answer

LTspice does support Modulus function :"Mod", for example MOD(2,2)=0, MOD(3,2)=1.