-- | Opcode Equivalents of Functions
module CsoundExpr.Opcodes.Math.Opeqfunc
    (divzA,
     divzI,
     divzK,
     product',
     sum',
     taninv2A,
     taninv2I,
     taninv2K)
where



import CsoundExpr.Base.Types
import CsoundExpr.Base.MultiOut
import CsoundExpr.Base.SideEffect
import CsoundExpr.Base.UserDefined



-- | * opcode : divz
--  
--  
-- * syntax : 
--  
--  >   ares divz xa, xb, ksubst
--  >   ires divz ia, ib, isubst
--  >   kres divz ka, kb, ksubst
--  
--  
-- * description : 
--  
--  Safely divides two numbers.
--  
--  
-- * url : <http://www.csounds.com/manual/html/divz.html>
 
divzA :: (X x0, X x1, K k0) => x0 -> x1 -> k0 -> Arate
divzA x0a x1b k2subst = opcode "divz" args
  where args = [to x0a, to x1b, to k2subst]


-- | * opcode : divz
--  
--  
-- * syntax : 
--  
--  >   ares divz xa, xb, ksubst
--  >   ires divz ia, ib, isubst
--  >   kres divz ka, kb, ksubst
--  
--  
-- * description : 
--  
--  Safely divides two numbers.
--  
--  
-- * url : <http://www.csounds.com/manual/html/divz.html>
 
divzI :: Irate -> Irate -> Irate -> Irate
divzI i0a i1b i2subst = opcode "divz" args
  where args = [to i0a, to i1b, to i2subst]


-- | * opcode : divz
--  
--  
-- * syntax : 
--  
--  >   ares divz xa, xb, ksubst
--  >   ires divz ia, ib, isubst
--  >   kres divz ka, kb, ksubst
--  
--  
-- * description : 
--  
--  Safely divides two numbers.
--  
--  
-- * url : <http://www.csounds.com/manual/html/divz.html>
 
divzK :: (K k0, K k1, K k2) => k0 -> k1 -> k2 -> Krate
divzK k0a k1b k2subst = opcode "divz" args
  where args = [to k0a, to k1b, to k2subst]


-- | * opcode : product
--  
--  
-- * syntax : 
--  
--  >   ares product asig1, asig2 [, asig3] [...]
--  
--  
-- * description : 
--  
--  Multiplies any number of a-rate signals.
--  
--  
-- * url : <http://www.csounds.com/manual/html/product.html>
 
product' :: [Arate] -> Arate
product' a0sig = opcode "product" args
  where args = map to a0sig


-- | * opcode : sum
--  
--  
-- * syntax : 
--  
--  >   ares sum asig1 [, asig2] [, asig3] [...]
--  
--  
-- * description : 
--  
--  Sums any number of a-rate signals.
--  
--  
-- * url : <http://www.csounds.com/manual/html/sum.html>
 
sum' :: [Arate] -> Arate
sum' a0sig = opcode "sum" args
  where args = map to a0sig


-- | * opcode : taninv2
--  
--  
-- * syntax : 
--  
--  >   ares taninv2 ay, ax
--  >   ires taninv2 iy, ix
--  >   kres taninv2 ky, kx
--  
--  
-- * description : 
--  
--  Returns the arctangent of iy/ix, ky/kx, or ay/ax.
--  
--  
-- * url : <http://www.csounds.com/manual/html/taninv2.html>
 
taninv2A :: Arate -> Arate -> Arate
taninv2A a0y a1x = opcode "taninv2" args
  where args = [to a0y, to a1x]


-- | * opcode : taninv2
--  
--  
-- * syntax : 
--  
--  >   ares taninv2 ay, ax
--  >   ires taninv2 iy, ix
--  >   kres taninv2 ky, kx
--  
--  
-- * description : 
--  
--  Returns the arctangent of iy/ix, ky/kx, or ay/ax.
--  
--  
-- * url : <http://www.csounds.com/manual/html/taninv2.html>
 
taninv2I :: Irate -> Irate -> Irate
taninv2I i0y i1x = opcode "taninv2" args
  where args = [to i0y, to i1x]


-- | * opcode : taninv2
--  
--  
-- * syntax : 
--  
--  >   ares taninv2 ay, ax
--  >   ires taninv2 iy, ix
--  >   kres taninv2 ky, kx
--  
--  
-- * description : 
--  
--  Returns the arctangent of iy/ix, ky/kx, or ay/ax.
--  
--  
-- * url : <http://www.csounds.com/manual/html/taninv2.html>
 
taninv2K :: (K k0, K k1) => k0 -> k1 -> Krate
taninv2K k0y k1x = opcode "taninv2" args
  where args = [to k0y, to k1x]