title: Why does this C# function to draw a sine wave using System.Drawing overflows?
body: <p>So I made this little windows forms program that draws a sine wave but when I put certain functions like <code>sin(x) ^ x</code> it overflows.
  Please review this code and help me figure this out!</p>
  
  <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
          if (Completed) return;
          Completed = true;
          Graphics g = this.CreateGraphics();
          Pen pen = new Pen(Brushes.Black, 2.0F);
  
          float x1 = 0;
          float y1 = 0;
  
          float y2 = 0;
  
          float yEx = 300;
          float eF = 50;
  
  
          for (float x = 0; x &lt; Width; x += 0.005F)
          {
              y2 = (float)Math.Pow(Math.Sin(x) , x);
  
              g.DrawLine(pen, x1 * eF, y1 * eF + yEx, x * eF, y2 * eF + yEx);
              x1 = x;
              y1 = y2;
          }
  
      }
  </code></pre>
  
  <p>When I execute, it runs for a bit and then displays this:<br>
  <a href="https://i.stack.imgur.com/tPyjI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tPyjI.png" alt="what is exactly displayed"></a></p>
  
  <p>Any contribution is appreciated!</p>