www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/30/04:47:09

From: Craig Franck <clfranck AT worldnet DOT att DOT net>
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Re: having trouble with long numbers
Date: 30 Jul 1997 00:39:53 GMT
Organization: AT&T WorldNet Services
Lines: 30
Message-ID: <5rm2gp$o2r@mtinsc05.worldnet.att.net>
References: <01bc9c51$0ceeec80$78ed1fcc AT darkstar> <33DE6FA3 DOT 460B59E AT voyager DOT net> <5rlvav$101 AT news DOT ox DOT ac DOT uk>
NNTP-Posting-Host: 207.116.45.198
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) wrote:
>Mark Levis (mlevis AT voyager DOT net) wrote:
>
>: Use a double. It will have precision up to 14 digits. An int will only
>: handle number from
>: -32767 to 32768.
>: unsigned int 0 65535
>
>That's compiler dependent; 

Actually, that is compiler independent. You should always try to
keep within the portable range of values of any type.

>since this was cross-posted to
>comp.os.msdos.djgpp I assume the compiler in question is the gcc with
>djgpp, which uses 32-bit ints by default, not 16-bit. The range is about
>four (American) billion I believe.

It is still best to use a long [-2,147,483,647..2,147,483,647] or
unsigned long [0..4,294,967,295] and keep within the portable 
range of values. If that doesn't do it, use a double rather than
some unportable larger integer type.

-- 
Craig
clfranck AT worldnet DOT att DOT net
Manchester, NH
Most rock journalism is people who can't write interviewing
people who can't talk for people who can't read. -- Frank Zappa

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019