ec2(M_E, 0.0), inz );
      return complex_div( eiz - einz, complex(0.0, 2.0));
    }

    vec2 complex_cos(vec2 x) {
      vec2 iz = complex_mul(vec2(0.0, 1.0), x);
      vec2 inz = complex_mul(vec2(0.0, -1.0), x);
      vec2 eiz = complex_pow( vec2(M_E, 0.0), iz );
      vec2 einz = complex_pow( vec2(M_E, 0.0), inz );
      return complex_div( eiz + einz, complex(2.0, 0.0));
    }

    vec2 complex_log(vec2 x) {
      return vec2( log( length(x) ), arg(x) );
    }

    bool isNan(float val)
    {
        