home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,556 of 2,978   
   Heinrich Wolf to Heinrich Wolf   
   Re: Longint(), Word(), etc...   
   01 May 05 09:26:59   
   
   From: invalid@invalid.invalid   
      
   I'm sorry!   
   Please replace /* */ by { }   
      
   "Heinrich Wolf"  schrieb im Newsbeitrag   
   news:3dglo9F6ujpbtU1@individual.net...   
   >   
   ...   
   > var   
   > a, b: word;   
   > l : LongInt;   
   >   
   > a := 30000;   
   > b := 30000;   
   > l := a * b;   
   > writeln(l);   
   > /*   
   > The intermediate result is an overflow in word!   
   > l will be 59648.   
   > This is the way to avoid that:   
   > */   
   > l := longint(a) * b;   
   > writeln(l);   
   >   
   > /*   
   > l will be 900000000.   
   > */   
   > l := word(l);   
   > writeln(l);   
   > /*   
   > will cut of the upper 16 bits.   
   > l will be 59648.   
   > */   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca