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

Re: 32b long int???????



On 13-Dec-1999 Steve Baker wrote:
> Erik wrote:
> 
>> try a float or a double, a double should retain more precision and range
>> than a
>> 64b binary plain, and float is probably "close enough"
> 
> Floats only contain 32 bits and whilst doubles are 64bit, they can't
> accurately
> represent more than 50-odd integer bits because of the bits consumed by the
> exponent.
> 

I thought floats were 64b and doubles were 80 bit. Guess I was mistaken :) long
double displays as 12 bytes, or 96 bits, so it's probly the 80 bit one I was
thinking of?

(don't laught too hard)

#include <stdio.h>
#include <sys/types.h>

int main()
{
    printf(" type      bytes  bits\n");
    printf("short:      %d      %d\n",sizeof(short),sizeof(short)*8);
    printf("int:        %d      %d\n",sizeof(int),sizeof(int)*8);
    printf("long:       %d      %d\n",sizeof(long),sizeof(long)*8);
    printf("long long:  %d      %d\n",sizeof(long long),sizeof(long long)*8);
    printf("int64_t:    %d      %d\n",sizeof(int64_t),sizeof(int64_t)*8);
    printf("float:      %d      %d\n",sizeof(float),sizeof(float)*8);
    printf("double:     %d      %d\n",sizeof(double),sizeof(double)*8);
    printf("long double %d     %d\n",sizeof(long double),sizeof(long double)*8);
    return 0;
}


> -- 
> Steve Baker                  http://web2.airmail.net/sjbaker1
> sjbaker1@airmail.net (home)  http://www.woodsoup.org/~sbaker
> sjbaker@hti.com      (work)
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.auc.dk
> For additional commands, e-mail: linuxgames-help@sunsite.auc.dk
> 
> 

        -Erik <erik@smluc.org> [http://math.smsu.edu/~br0ke]

The opinions expressed by me are not necessarily opinions. In all
probability, they are random rambling, and to be ignored. Failure to ignore
may result in severe boredom or confusion. Shake well before opening. Keep
Refrigerated.