Thanks Tim. You are correct, using fstp instruction instead of fst will resolve this problem. On Mon, Feb 9, 2009 at 6:46 PM, Tim Prince <TimothyPrince@xxxxxxxxxxxxx> wrote: > Halesh S wrote: > >> I wrote a small code to perform FPU division and multiplication. & I >> have attached the same. >> >> The output is as follows >> >> $./test >> 1.000000 >> 81.000000 >> 1.000000 >> nan >> >> Why the last o/p is giving NAN? Please let me the answer, why its >> failing to return the proper product. >> If any problem in my code please let me know. > > Aren't you overflowing the x87 internal stack, by always pushing data and > never popping? > >