Re: A83: Help with a problem


[Prev][Next][Index][Thread]

Re: A83: Help with a problem




In accordance with the prophecy, Ted21@aol.com uttered:


> I have encountered a bug in the following code that I can not figure out.  
> This program checks whether or not a number is a perfect square, and if it 
> is, display the square root.  It can detect if the number is a perfect square 
> or not, but when it displays the square root, it has a problem.  When I enter 
> in 4 it outputs 1.41421356 E -36 and that really isn't the square root of 4.  
> Any help will be appreciated, as well as optimizations.  Here is the code:

> (snip)

I suppose some of the system calls trash OP3. Try pushing the entered value
on the floating point stack instead, and pop it back when you need it the
second time.

Linus

- --- Linus Akesson ------------------------ http://linusworld.cjb.net --- -


       Driving People Insane:
       3. Find out where your boss shops and buy exactly the same
          outfits. Wear them one day after your boss does.  (This is
          especially effective if your boss is the opposite gender.)




References: