Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #3673
| From | "Julio Di Egidio" <julio@diegidio.name> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: Adding double-float values together |
| Date | 2013-08-20 20:53 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <kv0hgd$13v$1@dont-email.me> (permalink) |
| References | (9 earlier) <0.593019630819eda7e2dd.20130815170222BST.87zjsjgcxe.fsf@bsb.me.uk> <6918786f-e5f4-4306-80dc-a6ca6518f14d@googlegroups.com> <0.496dbdcba00648308483.20130816124501BST.87ioz5272a.fsf@bsb.me.uk> <23ce3ae2-c11c-41a5-be47-bce7e3928480@googlegroups.com> <521347b8$0$15903$e4fe514c@news2.news.xs4all.nl> |
"Jongware" <jongware@no-spam.plz> wrote in message news:521347b8$0$15903$e4fe514c@news2.news.xs4all.nl... > On 20-Aug-13 10:55 AM, industrial_one@hotmail.com wrote: <snipped> >> Is there ever a case where it makes sense to use a float for an integer? The size of the significand is 23 bits for single-precision (i.e. 32-bit) floats and 53 bits for double-precision (i.e. 64-bit) floats: when converting from an integer, the value gets rounded if it cannot fit in the significand. > Maybe there is a chance that a number could overflow max integer value, > for each of the single entries or for the total after addition. Using > floats makes sure you can count up to 10^38, but at the cost of precision. It is very easy here to overflow a 32-bit integer, as that would be just 2 GB. But I don't see any point in using doubles either, 64-bit integers would be ideal: simpler, much more performant, and, I'd assume, virtually impossible to overflow. Julio
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Adding double-float values together industrial_one@hotmail.com - 2013-08-14 09:40 -0700
Re: Adding double-float values together Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-14 18:23 +0100
Re: Adding double-float values together industrial_one@hotmail.com - 2013-08-14 10:35 -0700
Re: Adding double-float values together Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-14 19:22 +0100
Re: Adding double-float values together industrial_one@hotmail.com - 2013-08-14 12:20 -0700
Re: Adding double-float values together Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-15 02:05 +0100
Re: Adding double-float values together Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-15 02:36 +0100
Re: Adding double-float values together industrial_one@hotmail.com - 2013-08-14 18:42 -0700
Re: Adding double-float values together Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-15 03:04 +0100
Re: Adding double-float values together industrial_one@hotmail.com - 2013-08-14 21:17 -0700
Re: Adding double-float values together Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-08-15 08:39 -0700
Re: Adding double-float values together Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-15 17:02 +0100
Re: Adding double-float values together industrial_one@hotmail.com - 2013-08-16 02:25 -0700
Re: Adding double-float values together Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-08-16 12:45 +0100
Re: Adding double-float values together industrial_one@hotmail.com - 2013-08-20 01:55 -0700
Re: Adding double-float values together Jongware <jongware@no-spam.plz> - 2013-08-20 12:40 +0200
Re: Adding double-float values together "Julio Di Egidio" <julio@diegidio.name> - 2013-08-20 20:53 +0100
Re: Adding double-float values together Robert Miles <milesrf@Usenet-News.net> - 2013-08-24 09:22 -0500
Re: Adding double-float values together "Julio Di Egidio" <julio@diegidio.name> - 2013-08-24 15:49 +0100
csiph-web