Here (Linux-gtk2) when you compile in "Release" mode and run "without debugging", any negative number (other than -2) will give you a NaN as result and that's because you're trying to
Power() a base less than zero.
Note, though, that is
not at startup, but after you set Edit1 and click the button*. If you're seeing an error at startup then there has to be another cause, possibly accessing a control which is not yet
there, or some such thing.
* My test program had two edits an a "do it!" button with your code in its
OnClick() handler ... though a little better formated