Gary, The widest integer I have is "long long int", which is 8 bytes. I need a bit more for "nuber of secs in 8192 weeks".
I reproduce my attempt at C below, have I goofed up? root@ntpmon:~/ntpsec# cat /tmp/aa.c #include <stdio.h> int main() { int integerType; long int longintegerType; long long int longlongintegerType; float floatType; double doubleType; long double longdoubleType; char charType; // Sizeof operator is used to evaluate the size of a variable printf("Size of int: %ld bytes\n",sizeof(integerType)); printf("Size of long int: %ld bytes\n",sizeof(longintegerType)); printf("Size of long long int: %ld bytes\n",sizeof(longlongintegerType)); printf("Size of float: %ld bytes\n",sizeof(floatType)); printf("Size of double: %ld bytes\n",sizeof(doubleType)); printf("Size of long double: %ld bytes\n",sizeof(longdoubleType)); printf("Size of char: %ld byte\n",sizeof(charType)); return 0; } root@ntpmon:~/ntpsec# /tmp/a.out Size of int: 4 bytes Size of long int: 4 bytes Size of long long int: 8 bytes Size of float: 4 bytes Size of double: 8 bytes Size of long double: 12 bytes Size of char: 1 byte -- Sanjeev Gupta +65 98551208 http://www.linkedin.com/in/ghane On Sat, Aug 17, 2019 at 5:49 AM Gary E. Miller via devel <devel@ntpsec.org> wrote: > Yo Sanjeev! > > On Sat, 17 Aug 2019 05:27:17 +0800 > Sanjeev Gupta <gha...@gmail.com> wrote: > > > Gary, > > > > On my 32 bit x86, gcc 8 > > > > Size of int: 4 bytesSize of long int: 4 bytesSize of long long int: 8 > > bytesSize of float: 4 bytesSize of double: 8 bytesSize of long double: > > 12 bytesSize of char: 1 byte > > > > I have cast explicitly to (long double), please review: > > > > https://gitlab.com/NTPsec/ntpsec/merge_requests/1015 > > I do not like using floating point when ints will do. Too much chance > to get things like 8.999999999999 > > > RGDS > GARY > --------------------------------------------------------------------------- > Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703 > g...@rellim.com Tel:+1 541 382 8588 > > Veritas liberabit vos. -- Quid est veritas? > "If you can't measure it, you can't improve it." - Lord Kelvin > _______________________________________________ > devel mailing list > devel@ntpsec.org > http://lists.ntpsec.org/mailman/listinfo/devel >
_______________________________________________ devel mailing list devel@ntpsec.org http://lists.ntpsec.org/mailman/listinfo/devel