TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Bill Birrell
from: Jasen Betts
date: 2004-04-17 08:10:24
subject: Squares

Hi Bill.

15-Apr-04 09:29:02, Bill Birrell wrote to Jasen Betts


  >> NH> Otherwise, you would start getting negative numbers after a
  >> bit.

  >> or better.

  >> for (n=0; n> 0;

 BB> This baffles me. I ignored it first time round, but I really don't
 BB> see how squares can ever go negative. It is a characteristic of
 BB> squares that they are always positive. If you can get a negative
 BB> number by squaring an integer your math is by definition absurd.

You cant get such a number arithmetically, the only way is by overflow.
if for example you multiply 255 by 255 on a machine with 16 bit integers
the result looks negative.

 -=> Bye <=-

---
* Origin: Money is the root of all wealth. (3:640/1042)
SEEN-BY: 633/267 270
@PATH: 640/1042 531 954 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.