473,323 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Generate Big Integers

How do I generate Big Integers in VB .NET?

For example, if I have a number like

98908324328432864872364234623874682342234234242342

that can't be stored in INT64 or INT32 type variable. How can I generate it?

Secondly, how will I multiply 2 big Integers?

Your help will be
Jul 21 '05 #1
3 5509

You need to use attributes on structures and define both an Add and Equals
method. You may want to use the comparable interface. If you are using C#
then you do not need an Add and Equals method since you can simply override
the + and = operators. However, you have to wait until .Net 2.0 to override
operators in VB.

Robby
"Mohit Gupta" <Mo********@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
How do I generate Big Integers in VB .NET?

For example, if I have a number like

98908324328432864872364234623874682342234234242342

that can't be stored in INT64 or INT32 type variable. How can I generate
it?

Secondly, how will I multiply 2 big Integers?

Your help will be

Jul 21 '05 #2
Though your post is bit of help to me but that does not answers my question.

How can I save a number like 237498237498237493274230470327 in a variable?
Do you have any idea how to create such a big number?

I know that in java there is a BigInteger class. Any idea to create it?

"Robby" wrote:

You need to use attributes on structures and define both an Add and Equals
method. You may want to use the comparable interface. If you are using C#
then you do not need an Add and Equals method since you can simply override
the + and = operators. However, you have to wait until .Net 2.0 to override
operators in VB.

Robby
"Mohit Gupta" <Mo********@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
How do I generate Big Integers in VB .NET?

For example, if I have a number like

98908324328432864872364234623874682342234234242342

that can't be stored in INT64 or INT32 type variable. How can I generate
it?

Secondly, how will I multiply 2 big Integers?

Your help will be


Jul 21 '05 #3

Look up the StructLayoutAttribute attribute along with the
FieldOffsetAttribute attribute. Using these you can define a new 128 bit
integer value type, Int128. See my previous post for addition and
subtraction of this new type. You will need to be inventive on the addition
algorithum since as you will soon find a simple member by member addition of
the two lower 64 bits can produce a stack overflow for an Int64. Think of
how you created the Int128 and apply this logic to an Int64. One solution
calls for a private value type nested within the Int128 value type to handle
the Int64 addition.

That is all I am prepared to say as any more will give the intire
implimentation away and then I will have to charge you a design fee. :)

--Robby
"Mohit Gupta" <Mo********@discussions.microsoft.com> wrote in message
news:BB**********************************@microsof t.com...
Though your post is bit of help to me but that does not answers my
question.

How can I save a number like 237498237498237493274230470327 in a variable?
Do you have any idea how to create such a big number?

I know that in java there is a BigInteger class. Any idea to create it?

"Robby" wrote:

You need to use attributes on structures and define both an Add and
Equals
method. You may want to use the comparable interface. If you are using
C#
then you do not need an Add and Equals method since you can simply
override
the + and = operators. However, you have to wait until .Net 2.0 to
override
operators in VB.

Robby
"Mohit Gupta" <Mo********@discussions.microsoft.com> wrote in message
news:E8**********************************@microsof t.com...
> How do I generate Big Integers in VB .NET?
>
> For example, if I have a number like
>
> 98908324328432864872364234623874682342234234242342
>
> that can't be stored in INT64 or INT32 type variable. How can I
> generate
> it?
>
> Secondly, how will I multiply 2 big Integers?
>
> Your help will be


Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Acacia | last post by:
How would you generate a random number in C++?
6
by: Sebastien | last post by:
Hi, I am building a products database, linking sales and production. Each part has a unique sales Stock Code and Production Number. The sales stock code is a combination of letters and numbers...
3
by: Mohit Gupta | last post by:
How do I generate Big Integers in VB .NET? For example, if I have a number like 98908324328432864872364234623874682342234234242342 that can't be stored in INT64 or INT32 type variable. How...
14
by: Anthony Liu | last post by:
I am at my wit's end. I want to generate a certain number of random numbers. This is easy, I can repeatedly do uniform(0, 1) for example. But, I want the random numbers just generated sum up...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I generate a random integer from 1 to N?...
82
by: robert bristow-johnson | last post by:
here is a post i put out (using Google Groups) that got dropped by google: i am using gcc as so: $ gcc -v Using built-in specs. Target: i386-redhat-linux Configured with: ../configure...
16
by: Mark S. | last post by:
I'm a fan of the GUID, but the current project is looking to use a genuinely unique integer. Does the following do that? Math.Abs(System.Guid.NewGuid().GetHashCode()) TIA
5
by: DAXU | last post by:
Hi, I need to generate a fixed number of random integers that their summary equals to certain values. For example, the scenario can be: simulate user hits (e.g. 20000) within a hour (3600...
5
by: ss30 | last post by:
Hi, I'm really new to python or really any programming at all. I'm trying to write a game and I'm really stuck on one small, seemingly easy task. I have to generate a random list of n single...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.