
August 20th, 2008, 11:05 AM
| | | large integers?
hi,all:
one of my pals want to use integers of about 15 digits to do some
calculation,as far as i know,c99 supports long long and that type
would be enough,but,many compiler don't support long long,so is there
any other way to tackle this problem,thx.. | 
August 20th, 2008, 11:05 AM
| | | Re: large integers?
jackie said: Quote:
hi,all:
one of my pals want to use integers of about 15 digits to do some
calculation,as far as i know,c99 supports long long and that type
would be enough,but,many compiler don't support long long,so is there
any other way to tackle this problem,thx..
| Obtain, or write, a "bignum" library.
The two bignum libraries most commonly recommended are Miracl (by Shamus
Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
Either is found easily via a Web search. Miracl was free for non-commercial
use last time I looked, and GMP is covered by either GPL or LGPL, I forget
which.
Writing your own is, however, a lot of fun and rather instructive.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999 | 
August 20th, 2008, 11:35 AM
| | | Re: large integers?
Greetings.
In article
<24a26455-580e-4956-a3c5-dffc567e4073@j33g2000pri.googlegroups.com>,
jackie wrote: Quote:
hi,all:
one of my pals want to use integers of about 15 digits to do some
calculation,as far as i know,c99 supports long long and that type
would be enough,but,many compiler don't support long long,so is there
any other way to tackle this problem,thx..
| Why not simply find a compiler which *does* support long long integers? Is
your friend using an operating system so obscure that, say, GCC is not
available for it?
Regards,
Tristan
--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= < In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you | 
August 20th, 2008, 11:45 AM
| | | Re: large integers?
Tristan Miller said: Quote:
Greetings.
>
In article
<24a26455-580e-4956-a3c5-dffc567e4073@j33g2000pri.googlegroups.com>,
jackie wrote:
> Quote:
>hi,all:
> one of my pals want to use integers of about 15 digits to do some
>calculation,as far as i know,c99 supports long long and that type
>would be enough,but,many compiler don't support long long,so is there
>any other way to tackle this problem,thx..
| >
Why not simply find a compiler which *does* support long long integers?
| Well, fair point - but the next question will then be "oh, it turns out we
need 40-digit integers after all", and then we're reduced to recommending
that he tries to find a compiler that has long longs that are at least 132
bits wide...
Easier to point him at bignums right off the bat. :-)
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999 | 
August 20th, 2008, 02:35 PM
| | | Re: large integers?
On 20 Aug, 11:09, Richard Heathfield <r...@see.sig.invalidwrote:
<snip> Quote:
The two bignum libraries most commonly recommended are Miracl (by Shamus
Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>
Either is found easily via a Web search. Miracl was free for non-commercial
use last time I looked, and GMP is covered by either GPL or LGPL, I forget
which.
| it's full GPL I believe, which may limit its use in commercial
products.
No I don't want an argument about this...
--
Nick Keighley | 
August 20th, 2008, 03:05 PM
| | | Re: large integers?
Nick Keighley said: Quote:
On 20 Aug, 11:09, Richard Heathfield <r...@see.sig.invalidwrote:
>
<snip>
> Quote:
>The two bignum libraries most commonly recommended are Miracl (by Shamus
>Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>>
>Either is found easily via a Web search. Miracl was free for
>non-commercial use last time I looked, and GMP is covered by either GPL
>or LGPL, I forget which.
| >
it's full GPL I believe,
| Ta. Quote: |
which may limit its use in commercial products.
| ICBW about this, but I *guess* the OP isn't too worried about that. Quote: |
No I don't want an argument about this...
| Pfui. Life's too short. :-)
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999 | 
August 20th, 2008, 03:45 PM
| | | Re: large integers?
Nick Keighley <nick_keighley_nospam@hotmail.comwrites: Quote:
On 20 Aug, 11:09, Richard Heathfield <r...@see.sig.invalidwrote:
>
<snip>
> Quote:
>The two bignum libraries most commonly recommended are Miracl (by Shamus
>Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>>
>Either is found easily via a Web search. Miracl was free for non-commercial
>use last time I looked, and GMP is covered by either GPL or LGPL, I forget
>which.
| >
it's full GPL I believe, which may limit its use in commercial
products.
| It is LGPL, so that is unlikely. Quote: |
No I don't want an argument about this...
| I hope you exclude factual errors from that!
--
Ben. | 
August 20th, 2008, 04:05 PM
| | | Re: large integers?
Greetings.
In article
<f9a64823-bb0a-4951-bcef-ed2266926801@c65g2000hsa.googlegroups.com>, Nick
Keighley wrote: Quote:
On 20 Aug, 11:09, Richard Heathfield <r...@see.sig.invalidwrote:
>
<snip>
> Quote:
>The two bignum libraries most commonly recommended are Miracl (by Shamus
>Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>>
>Either is found easily via a Web search. Miracl was free for
>non-commercial use last time I looked, and GMP is covered by either GPL
>or LGPL, I forget which.
| >
it's full GPL I believe, which may limit its use in commercial
products.
| There's no limit on the use of GPL code in commercial products.
Regards,
Tristan
--
_
_V.-o Tristan Miller [en,(fr,de,ia)] >< Space is limited
/ |`-' -=-=-=-=-=-=-=-=-=-=-=-=-=-=-= < In a haiku, so it's hard
(7_\\ http://www.nothingisreal.com/ >< To finish what you | 
August 20th, 2008, 04:25 PM
| | | Re: large integers?
Tristan Miller wrote: Quote:
Greetings.
>
In article
<f9a64823-bb0a-4951-bcef-ed2266926801@c65g2000hsa.googlegroups.com>, Nick
Keighley wrote:
| .... Quote: Quote:
it's full GPL I believe, which may limit its use in commercial
products.
| >
There's no limit on the use of GPL code in commercial products.
| GPL does not prohibit commercial use, but it does impose requirements
that are inconsistent with the needs of many commercial software
providers. This is precisely the purpose of GPL, and in particular, of
those requirements. They were developed by people philosophically
opposed to those needs being met. | 
August 20th, 2008, 04:45 PM
| | | Re: large integers?
Tristan Miller <psychonaut@nothingisreal.comwrote: Quote:
Keighley wrote:
> Quote:
On 20 Aug, 11:09, Richard Heathfield <r...@see.sig.invalidwrote: Quote:
The two bignum libraries most commonly recommended are Miracl (by Shamus
Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>
Either is found easily via a Web search. Miracl was free for
non-commercial use last time I looked, and GMP is covered by either GPL
or LGPL, I forget which.
| it's full GPL I believe, which may limit its use in commercial
products.
| >
There's no limit on the use of GPL code in commercial products.
| In theory. In practice, the use of GPL code for commercial products is
severely limited by the amount of money lawyers can wring out of the
edge cases.
Richard | 
August 20th, 2008, 05:46 PM
| | | Re: large integers?
On Wed, 20 Aug 2008 10:09:01 +0000, Richard Heathfield
<rjh@see.sig.invalidwrote: Quote:
>jackie said:
> Quote:
>hi,all:
> one of my pals want to use integers of about 15 digits to do some
>calculation,as far as i know,c99 supports long long and that type
>would be enough,but,many compiler don't support long long,so is there
>any other way to tackle this problem,thx..
| >
>Obtain, or write, a "bignum" library.
>
>The two bignum libraries most commonly recommended are Miracl (by Shamus
>Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>
>Either is found easily via a Web search. Miracl was free for non-commercial
>use last time I looked, and GMP is covered by either GPL or LGPL, I forget
>which.
>
>Writing your own is, however, a lot of fun and rather instructive.
|
Any info on packages that are covered by a BSD style license?
Richard Harter, cri@tiac.net http://home.tiac.net/~cri, http://www.varinoma.com
Save the Earth now!!
It's the only planet with chocolate. | 
August 20th, 2008, 05:46 PM
| | | Re: large integers?
Richard Harter said: Quote:
On Wed, 20 Aug 2008 10:09:01 +0000, Richard Heathfield
<rjh@see.sig.invalidwrote:
>
| <snip> Quote: Quote:
>>
>>Writing your own is, however, a lot of fun and rather instructive.
| >
Any info on packages that are covered by a BSD style license?
| Not that I know of. Writing your own is, however, a lot of fun and rather
instructive. :-)
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999 | 
August 20th, 2008, 06:17 PM
| | | Re: large integers? cri@tiac.net (Richard Harter) writes: Quote:
On Wed, 20 Aug 2008 10:09:01 +0000, Richard Heathfield
<rjh@see.sig.invalidwrote:
> Quote:
>>jackie said:
>> Quote:
>>hi,all:
>> one of my pals want to use integers of about 15 digits to do some
>>calculation,as far as i know,c99 supports long long and that type
>>would be enough,but,many compiler don't support long long,so is there
>>any other way to tackle this problem,thx..
| >>
>>Obtain, or write, a "bignum" library.
>>
>>The two bignum libraries most commonly recommended are Miracl (by Shamus
>>Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>>
>>Either is found easily via a Web search. Miracl was free for non-commercial
>>use last time I looked, and GMP is covered by either GPL or LGPL, I forget
>>which.
>>
>>Writing your own is, however, a lot of fun and rather instructive.
| >
>
Any info on packages that are covered by a BSD style license?
| http://directory.fsf.org/project/bigmath/
(but note that GMP is LGPL no GPL).
--
Ben. | 
August 21st, 2008, 08:05 AM
| | | Re: large integers?
The two bignum libraries most commonly recommended are Miracl (by Shamus Quote:
Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>
| i am using ms vs2005,and can i use GMP anyway? | 
August 21st, 2008, 08:15 AM
| | | Re: large integers?
On 20 Aug, 15:41, Ben Bacarisse <ben.use...@bsb.me.ukwrote: Quote:
Nick Keighley<nick_keighley_nos...@hotmail.comwrites: Quote: |
On 20 Aug, 11:09, Richard Heathfield <r...@see.sig.invalidwrote:
| | Quote: Quote: Quote:
The two bignum libraries most commonly recommended are Miracl (by Shamus
Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
| | > Quote: Quote:
Either is found easily via a Web search. Miracl was free for non-commercial
use last time I looked, and GMP is covered by either GPL or LGPL, I forget
which.
| | > Quote:
it's full GPL I believe, which may limit its use in commercial
products.
| >
It is LGPL, so that is unlikely.
| serves me right for trusting I memory. (I could have sworn last
time I looked it was full GPL...) Quote: Quote: |
No I don't want an argument about this...
| >
I hope you exclude factual errors from that!
| naturally! I was trying to avoid a Free Software ethics discussion
--
Nick Keighley | 
August 21st, 2008, 08:25 AM
| | | Re: large integers?
jackie said: Quote: Quote:
>The two bignum libraries most commonly recommended are Miracl (by Shamus
>Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>>
| >
i am using ms vs2005,and can i use GMP anyway?
| I have no idea - but there's probably a way. (You can certainly use Miracl
with Visual C.)
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999 | 
August 21st, 2008, 07:55 PM
| | | Re: large integers?
On Aug 21, 2:01*am, jackie <jackie...@gmail.comwrote: Quote: Quote:
The two bignum libraries most commonly recommended are Miracl (by Shamus
Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
| >
i am using ms vs2005,and can i use GMP anyway?
|
While somewhat OT, MSVC support the __int64 type, which is largely
equivalent to what you'd expect long long to be on most systems. That
is obviously an MS extension, which may or may not be an issue for you. | 
August 25th, 2008, 08:45 PM
| | | Re: large integers?
"Ben Bacarisse" <ben.usenet@bsb.me.ukwrote in message
news:87k5ebfvyt.fsf@bsb.me.uk... Quote: cri@tiac.net (Richard Harter) writes:
> Quote:
>On Wed, 20 Aug 2008 10:09:01 +0000, Richard Heathfield
><rjh@see.sig.invalidwrote:
>> Quote:
>>>jackie said:
>>>
>>>hi,all:
>>> one of my pals want to use integers of about 15 digits to do some
>>>calculation,as far as i know,c99 supports long long and that type
>>>would be enough,but,many compiler don't support long long,so is there
>>>any other way to tackle this problem,thx..
>>>
>>>Obtain, or write, a "bignum" library.
>>>
>>>The two bignum libraries most commonly recommended are Miracl (by Shamus
>>>Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>>>
>>>Either is found easily via a Web search. Miracl was free for
>>>non-commercial
>>>use last time I looked, and GMP is covered by either GPL or LGPL, I
>>>forget
>>>which.
>>>
>>>Writing your own is, however, a lot of fun and rather instructive.
| >>
>>
>Any info on packages that are covered by a BSD style license?
| > http://directory.fsf.org/project/bigmath/
>
(but note that GMP is LGPL no GPL).
| I guess that almost every modern compiler supports 64 bit integers for
non-embedded platforms. Having the O.P. write or use a number class is
almost certainly the wrong answer.
But if they want a BSD style 64-bit number class, this package: http://www.synesis.com.au/software/stlsoft/
has signed 64 bit integer. http://www.synesis.com.au/software/s...pp-source.html
There are lots of others besides this one.
I guess that there may be language objections (e.g. "the cited package is
C++ and not C") but it is also possible to interface to C++ from nearly
every non-embedded modern C++ and C compiler system. The exact method for
how to do that will (of course) depend on the compiler in question.
** Posted from http://www.teranews.com ** | 
August 25th, 2008, 09:35 PM
| | | Re: large integers?
"Richard Heathfield" <rjh@see.sig.invalidwrote in message
news:JrKdnc-vdaC6ijDVnZ2dnUVZ8vqdnZ2d@bt.com... Quote:
jackie said:
> Quote: Quote:
>>The two bignum libraries most commonly recommended are Miracl (by Shamus
>>Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>>>
| >>
>i am using ms vs2005,and can i use GMP anyway?
| | I have compiled GMP with vs2005. But if you have Visual Studio 2005, then
you already have native long long support. Quote:
I have no idea - but there's probably a way. (You can certainly use Miracl
with Visual C.)
| For 64 bit support, large integer packages will definitely be overkill (and
much slower than the inline assembly or native intrinsics provided by the
compiler).
** Posted from http://www.teranews.com ** | 
August 25th, 2008, 09:45 PM
| | | Re: large integers?
"jackie" <jackiexxm@gmail.comwrote in message
news:1f512e17-90bf-4785-956f-4b69073dbb28@k36g2000pri.googlegroups.com... Quote: Quote:
>The two bignum libraries most commonly recommended are Miracl (by Shamus
>Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>>
| >
i am using ms vs2005,and can i use GMP anyway?
>
| Why bother?
C:\tmp>vsvars32
Setting environment for using Microsoft Visual Studio 2005 x86 tools.
C:\tmp>cl t.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for
80x86
Copyright (C) Microsoft Corporation. All rights reserved.
t.c
Microsoft (R) Incremental Linker Version 8.00.50727.762
Copyright (C) Microsoft Corporation. All rights reserved.
/out:t.exe
t.obj
C:\tmp>t
m = 1
m = 1
o = 1
o = 1
i = 1
i = 1
k = 1
k = 1
m = 2
m = 2
o = 2
o = 2
i = 2
i = 2
k = 2
k = 2
m = 4
m = 4
o = 4
o = 4
i = 4
i = 4
k = 4
k = 4
m = 8
m = 8
o = 8
o = 8
i = 8
i = 8
k = 8
k = 8
m = 16
m = 16
o = 16
o = 16
i = 16
i = 16
k = 16
k = 16
m = 32
m = 32
o = 32
o = 32
i = 32
i = 32
k = 32
k = 32
m = 64
m = 64
o = 64
o = 64
i = 64
i = 64
k = 64
k = 64
m = 128
m = 128
o = 128
o = 128
i = 128
i = 128
k = 128
k = 128
m = 256
m = 256
o = 256
o = 256
i = 256
i = 256
k = 256
k = 256
m = 512
m = 512
o = 512
o = 512
i = 512
i = 512
k = 512
k = 512
m = 1024
m = 1024
o = 1024
o = 1024
i = 1024
i = 1024
k = 1024
k = 1024
m = 2048
m = 2048
o = 2048
o = 2048
i = 2048
i = 2048
k = 2048
k = 2048
m = 4096
m = 4096
o = 4096
o = 4096
i = 4096
i = 4096
k = 4096
k = 4096
m = 8192
m = 8192
o = 8192
o = 8192
i = 8192
i = 8192
k = 8192
k = 8192
m = 16384
m = 16384
o = 16384
o = 16384
i = 16384
i = 16384
k = 16384
k = 16384
m = 32768
m = 32768
o = 32768
o = 32768
i = 32768
i = 32768
k = 32768
k = 32768
m = 65536
m = 65536
o = 65536
o = 65536
i = 65536
i = 65536
k = 65536
k = 65536
m = 131072
m = 131072
o = 131072
o = 131072
i = 131072
i = 131072
k = 131072
k = 131072
m = 262144
m = 262144
o = 262144
o = 262144
i = 262144
i = 262144
k = 262144
k = 262144
m = 524288
m = 524288
o = 524288
o = 524288
i = 524288
i = 524288
k = 524288
k = 524288
m = 1048576
m = 1048576
o = 1048576
o = 1048576
i = 1048576
i = 1048576
k = 1048576
k = 1048576
m = 2097152
m = 2097152
o = 2097152
o = 2097152
i = 2097152
i = 2097152
k = 2097152
k = 2097152
m = 4194304
m = 4194304
o = 4194304
o = 4194304
i = 4194304
i = 4194304
k = 4194304
k = 4194304
m = 8388608
m = 8388608
o = 8388608
o = 8388608
i = 8388608
i = 8388608
k = 8388608
k = 8388608
m = 16777216
m = 16777216
o = 16777216
o = 16777216
i = 16777216
i = 16777216
k = 16777216
k = 16777216
m = 33554432
m = 33554432
o = 33554432
o = 33554432
i = 33554432
i = 33554432
k = 33554432
k = 33554432
m = 67108864
m = 67108864
o = 67108864
o = 67108864
i = 67108864
i = 67108864
k = 67108864
k = 67108864
m = 134217728
m = 134217728
o = 134217728
o = 134217728
i = 134217728
i = 134217728
k = 134217728
k = 134217728
m = 268435456
m = 268435456
o = 268435456
o = 268435456
i = 268435456
i = 268435456
k = 268435456
k = 268435456
m = 536870912
m = 536870912
o = 536870912
o = 536870912
i = 536870912
i = 536870912
k = 536870912
k = 536870912
m = 1073741824
m = 1073741824
o = 1073741824
o = 1073741824
i = 1073741824
i = 1073741824
k = 1073741824
k = 1073741824
m = 2147483648
m = 2147483648
o = 2147483648
o = 2147483648
i = 2147483648
i = 2147483648
k = 2147483648
k = 2147483648
m = 4294967296
m = 4294967296
o = 4294967296
o = 4294967296
i = 4294967296
i = 4294967296
k = 4294967296
k = 4294967296
m = 8589934592
m = 8589934592
o = 8589934592
o = 8589934592
i = 8589934592
i = 8589934592
k = 8589934592
k = 8589934592
m = 17179869184
m = 17179869184
o = 17179869184
o = 17179869184
i = 17179869184
i = 17179869184
k = 17179869184
k = 17179869184
m = 34359738368
m = 34359738368
o = 34359738368
o = 34359738368
i = 34359738368
i = 34359738368
k = 34359738368
k = 34359738368
m = 68719476736
m = 68719476736
o = 68719476736
o = 68719476736
i = 68719476736
i = 68719476736
k = 68719476736
k = 68719476736
m = 137438953472
m = 137438953472
o = 137438953472
o = 137438953472
i = 137438953472
i = 137438953472
k = 137438953472
k = 137438953472
m = 274877906944
m = 274877906944
o = 274877906944
o = 274877906944
i = 274877906944
i = 274877906944
k = 274877906944
k = 274877906944
m = 549755813888
m = 549755813888
o = 549755813888
o = 549755813888
i = 549755813888
i = 549755813888
k = 549755813888
k = 549755813888
m = 1099511627776
m = 1099511627776
o = 1099511627776
o = 1099511627776
i = 1099511627776
i = 1099511627776
k = 1099511627776
k = 1099511627776
m = 2199023255552
m = 2199023255552
o = 2199023255552
o = 2199023255552
i = 2199023255552
i = 2199023255552
k = 2199023255552
k = 2199023255552
m = 4398046511104
m = 4398046511104
o = 4398046511104
o = 4398046511104
i = 4398046511104
i = 4398046511104
k = 4398046511104
k = 4398046511104
m = 8796093022208
m = 8796093022208
o = 8796093022208
o = 8796093022208
i = 8796093022208
i = 8796093022208
k = 8796093022208
k = 8796093022208
m = 17592186044416
m = 17592186044416
o = 17592186044416
o = 17592186044416
i = 17592186044416
i = 17592186044416
k = 17592186044416
k = 17592186044416
m = 35184372088832
m = 35184372088832
o = 35184372088832
o = 35184372088832
i = 35184372088832
i = 35184372088832
k = 35184372088832
k = 35184372088832
m = 70368744177664
m = 70368744177664
o = 70368744177664
o = 70368744177664
i = 70368744177664
i = 70368744177664
k = 70368744177664
k = 70368744177664
m = 140737488355328
m = 140737488355328
o = 140737488355328
o = 140737488355328
i = 140737488355328
i = 140737488355328
k = 140737488355328
k = 140737488355328
m = 281474976710656
m = 281474976710656
o = 281474976710656
o = 281474976710656
i = 281474976710656
i = 281474976710656
k = 281474976710656
k = 281474976710656
m = 562949953421312
m = 562949953421312
o = 562949953421312
o = 562949953421312
i = 562949953421312
i = 562949953421312
k = 562949953421312
k = 562949953421312
m = 1125899906842624
m = 1125899906842624
o = 1125899906842624
o = 1125899906842624
i = 1125899906842624
i = 1125899906842624
k = 1125899906842624
k = 1125899906842624
m = 2251799813685248
m = 2251799813685248
o = 2251799813685248
o = 2251799813685248
i = 2251799813685248
i = 2251799813685248
k = 2251799813685248
k = 2251799813685248
m = 4503599627370496
m = 4503599627370496
o = 4503599627370496
o = 4503599627370496
i = 4503599627370496
i = 4503599627370496
k = 4503599627370496
k = 4503599627370496
m = 9007199254740992
m = 9007199254740992
o = 9007199254740992
o = 9007199254740992
i = 9007199254740992
i = 9007199254740992
k = 9007199254740992
k = 9007199254740992
m = 18014398509481984
m = 18014398509481984
o = 18014398509481984
o = 18014398509481984
i = 18014398509481984
i = 18014398509481984
k = 18014398509481984
k = 18014398509481984
m = 36028797018963968
m = 36028797018963968
o = 36028797018963968
o = 36028797018963968
i = 36028797018963968
i = 36028797018963968
k = 36028797018963968
k = 36028797018963968
m = 72057594037927936
m = 72057594037927936
o = 72057594037927936
o = 72057594037927936
i = 72057594037927936
i = 72057594037927936
k = 72057594037927936
k = 72057594037927936
m = 144115188075855872
m = 144115188075855872
o = 144115188075855872
o = 144115188075855872
i = 144115188075855872
i = 144115188075855872
k = 144115188075855872
k = 144115188075855872
m = 288230376151711744
m = 288230376151711744
o = 288230376151711744
o = 288230376151711744
i = 288230376151711744
i = 288230376151711744
k = 288230376151711744
k = 288230376151711744
m = 576460752303423488
m = 576460752303423488
o = 576460752303423488
o = 576460752303423488
i = 576460752303423488
i = 576460752303423488
k = 576460752303423488
k = 576460752303423488
m = 1152921504606846976
m = 1152921504606846976
o = 1152921504606846976
o = 1152921504606846976
i = 1152921504606846976
i = 1152921504606846976
k = 1152921504606846976
k = 1152921504606846976
m = 2305843009213693952
m = 2305843009213693952
o = 2305843009213693952
o = 2305843009213693952
i = 2305843009213693952
i = 2305843009213693952
k = 2305843009213693952
k = 2305843009213693952
m = 4611686018427387904
m = 4611686018427387904
o = 4611686018427387904
o = 4611686018427387904
i = 4611686018427387904
i = 4611686018427387904
k = 4611686018427387904
k = 4611686018427387904
m = 9223372036854775808
m = 9223372036854775808
o = 9223372036854775808
o = 9223372036854775808
C:\tmp>type t.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
size_t index;
__int64 i;
long long k;
unsigned __int64 m;
unsigned long long o;
static const unsigned long long one = 1;
for (index = 0; index < 64; index++)
{
m = one << index;
printf("m = %llu\n", m);
printf("m = %I64u\n", m);
o = one << index;
printf("o = %llu\n", o);
printf("o = %I64u\n", o);
if (index == 63) continue;
i = one << index;
printf("i = %lld\n", i);
printf("i = %I64i\n", i);
k = one << index;
printf("k = %lld\n", k);
printf("k = %I64i\n", k);
}
return 0;
}
C:\tmp>
** Posted from http://www.teranews.com ** | 
August 25th, 2008, 10:05 PM
| | | Re: large integers?
Dann Corbit wrote:
.... Quote:
C++ and not C") but it is also possible to interface to C++ from nearly
every non-embedded modern C++ and C compiler system. The exact method for
how to do that will (of course) depend on the compiler in question.
| I know how to write C++ code so that it can link to C code, using
"extern C" language linkage to declare the C objects and functions it
refers to. I know haw to write C++ code which can be linked to by C
code, using "extern C" when defining objects and functions that C
code should have access to. I don't know any way to write C code so
that it can access C++ code was not explicitly written to allow
linkage to C. Your wording seems to suggest that this is possible. Is
that the case? | 
August 25th, 2008, 10:35 PM
| | | Re: large integers?
<jameskuyper@verizon.netwrote in message
news:51801890-e6ae-42cc-82e5-b0527bf034a6@b1g2000hsg.googlegroups.com... Quote:
Dann Corbit wrote:
... Quote:
>C++ and not C") but it is also possible to interface to C++ from nearly
>every non-embedded modern C++ and C compiler system. The exact method
>for
>how to do that will (of course) depend on the compiler in question.
| >
I know how to write C++ code so that it can link to C code, using
"extern C" language linkage to declare the C objects and functions it
refers to. I know how to write C++ code which can be linked to by C
code, using "extern C" when defining objects and functions that C
code should have access to. I don't know any way to write C code so
that it can access C++ code was not explicitly written to allow
linkage to C. Your wording seems to suggest that this is possible. Is
that the case?
| Yes, to some degree {system and compiler specific of course}. For instance:
if you create a C++ DLL with exports: __declspec(dllexport), which is
specific to Microsoft and Intel compilers on Windows operating systems.
That also assumes that you use a function call interface rather than a class
member interface. As I recall, class member access is problematic to reach
C++ members from C programs even with exports.
My suggestion would be for the OP to create an interface file, though, as
this is the most general solution.
** Posted from http://www.teranews.com ** | 
August 28th, 2008, 04:45 PM
| | | Re: large integers?
On Wed, 20 Aug 2008 18:16:26 +0100, Ben Bacarisse
<ben.usenet@bsb.me.ukwrote: Quote:
>cri@tiac.net (Richard Harter) writes:
> Quote:
>On Wed, 20 Aug 2008 10:09:01 +0000, Richard Heathfield
><rjh@see.sig.invalidwrote:
>> Quote:
>>>jackie said:
>>>
>>>hi,all:
>>> one of my pals want to use integers of about 15 digits to do some
>>>calculation,as far as i know,c99 supports long long and that type
>>>would be enough,but,many compiler don't support long long,so is there
>>>any other way to tackle this problem,thx..
>>>
>>>Obtain, or write, a "bignum" library.
>>>
>>>The two bignum libraries most commonly recommended are Miracl (by Shamus
>>>Software Ltd) and "GMP" (by GNU, and not to be confused with "GIMP"!).
>>>
>>>Either is found easily via a Web search. Miracl was free for non-commercial
>>>use last time I looked, and GMP is covered by either GPL or LGPL, I forget
>>>which.
>>>
>>>Writing your own is, however, a lot of fun and rather instructive.
| | | Been there, done that. Only integer, but I can work with that. Quote:
>
>(but note that GMP is LGPL no GPL).
| As I understand it, once I muck with the source I've eaten fruit
from the poisoned tree.
Richard Harter, cri@tiac.net http://home.tiac.net/~cri, http://www.varinoma.com
Save the Earth now!!
It's the only planet with chocolate. | 
August 28th, 2008, 07:35 PM
| | | Re: large integers? cri@tiac.net (Richard Harter) writes: Quote:
On Wed, 20 Aug 2008 18:16:26 +0100, Ben Bacarisse
<ben.usenet@bsb.me.ukwrote:
| <snip> Quote: Quote: |
>>(but note that GMP is LGPL no GPL).
| >
As I understand it, once I muck with the source I've eaten fruit
from the poisoned tree.
| I feel confident that there are meanings for "muck with", "eaten
fruit" and "poisoned tree" that render that remark true, though I
don't know which ones you had in mind :-)
--
Ben. | 
August 29th, 2008, 10:05 PM
| | | Re: large integers?
Richard Harter wrote, On 28/08/08 16:45: Quote: |
On Wed, 20 Aug 2008 18:16:26 +0100, Ben Bacarisse
| <snip> Quote: Quote: |
>(but note that GMP is LGPL no GPL).
| >
As I understand it, once I muck with the source I've eaten fruit
from the poisoned tree.
| <OT>
With LGPL if you mucked around with the source of the LGPL library your
changes to that library would be LGPL (and would have to be available to
people you made your changed library available to) *but* whatever code
you simply linked to the modified library could still be closed source.
--
Flash Gordon
Before now I've emailed a SW author to obtain permission to use his code
in a commercial application. | 
September 1st, 2008, 06:05 PM
| | | Re: large integers?
On Fri, 29 Aug 2008 21:46:39 +0100, Flash Gordon
<spam@flash-gordon.me.ukwrote: Quote:
>Richard Harter wrote, On 28/08/08 16:45: Quote: |
>On Wed, 20 Aug 2008 18:16:26 +0100, Ben Bacarisse
| >
><snip>
> Quote: Quote: |
>>(but note that GMP is LGPL no GPL).
| >>
>As I understand it, once I muck with the source I've eaten fruit
>from the poisoned tree.
| >
><OT>
>
>With LGPL if you mucked around with the source of the LGPL library your
>changes to that library would be LGPL (and would have to be available to
>people you made your changed library available to) *but* whatever code
>you simply linked to the modified library could still be closed source.
|
Thanks. That's more or less the way that I understood it. The
problem is the other way around - the context is BSD style
licensed code. If I create a package under BSD style, it is
unencumbered, i.e., any user can do almost anything they like
with the code. If I include an LGPL library untouched, the
package is still effectively unencumbered. However, if I modify
the library and/or incorporate part of it into my code then the
package is now encumbered.
Richard Harter, cri@tiac.net http://home.tiac.net/~cri, http://www.varinoma.com
Save the Earth now!!
It's the only planet with chocolate. | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 205,248 network members.
|