use Math;
//inline proc cmplx1((x , y) : (real(?w), imag(?w)))
//{
// writeln(w); // error: w undeclared [should be an error about w being redeclared]
// return x * exp(y);
//}
// error: unable to resolve type
//inline proc cmplx((x , y)) where isRealType(x.type) && isImagType(y.type)
//{
// return x * exp(y);
//}
// this version seems to work
// note: you could add `numBits(tup(0).type) == numBits(tup(1).type)`
// if you want the real and imag to be the same width.
inline proc cmplx(tup)
where isTuple(tup) && isRealType(tup(0).type) && isImagType(tup(1).type)
{
const (x,y) = tup;
return x * exp(y);
}
writeln(cmplx( (1.0, 40.0i) ));