|
|
back to boardCan a square of an integer number be negative? My solution resulted in Crash {FLT_INVALID_OPERATION} several times, before I understood, that the square of an integer number can be negative! Oh! What a stupid mistake!-) The crash mentioned above was caused by the following function in my source code: function Dist( const p1, p2: Point ): extended; begin Result := sqrt( sqr(p2.x-p1.x) + sqr(p2.y-p1.y) ); end; I couldn't even imagine, that sqr() function can produce negative results! So, If you get Crash on test #6, just use extended (^: Re: Can a square of an integer number be negative? Holy crap I can't believe either!! Thanks |
|
|