On Sun, Feb 28, 2010 at 9:07 PM, Eli Friedman <eli.friedman at gmail.com> wrote:> On Sun, Feb 28, 2010 at 1:02 PM, Russell Wallace > <russell.wallace at gmail.com> wrote: >> What's the largest integer such that something like 'return ((a * b) / >> c) >> d' works correctly on all major platforms? > > Twice the size of a pointer, i.e. 64 bits on 32-bit platforms and 128 > bits on 64-bit platforms.Okay, thanks. Do I understand correctly that this is likely to continue to be the case, so language support for large integers will need to be implemented by other means?
On Sun, Feb 28, 2010 at 1:10 PM, Russell Wallace <russell.wallace at gmail.com> wrote:> On Sun, Feb 28, 2010 at 9:07 PM, Eli Friedman <eli.friedman at gmail.com> wrote: >> On Sun, Feb 28, 2010 at 1:02 PM, Russell Wallace >> <russell.wallace at gmail.com> wrote: >>> What's the largest integer such that something like 'return ((a * b) / >>> c) >> d' works correctly on all major platforms? >> >> Twice the size of a pointer, i.e. 64 bits on 32-bit platforms and 128 >> bits on 64-bit platforms. > > Okay, thanks. Do I understand correctly that this is likely to > continue to be the case, so language support for large integers will > need to be implemented by other means?Yes; there are no plans to change this. -Eli
On 28 February 2010 16:10, Russell Wallace <russell.wallace at gmail.com> wrote:> > Okay, thanks. Do I understand correctly that this is likely to > continue to be the case, so language support for large integers will > need to be implemented by other means? >Maybe it would be worth adding "iInf" to LLVM to use all the pre-existing optimizations, then have passes to lower it to GMP or other implementations...
On Sun, Feb 28, 2010 at 9:51 PM, me22 <me22.ca at gmail.com> wrote:> Maybe it would be worth adding "iInf" to LLVM to use all the > pre-existing optimizations, then have passes to lower it to GMP or > other implementations...I see where you're coming from, but I don't think that would be useful. There are applications where a dependency on GMP is okay, but not across the board for a core language feature. I think I'm just going to have to bite the bullet and go ahead and implement arbitrary precision integers as part of my standard library.