473,569 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calculations on LARGE numbers

Hi,

I am trying to do some calculations on large numbers (ie
7,768,489,957,8 92,578,474,792, 094 / 12,280) and no matter what I do it
doesn't get it quite right. Its always somewhere between 10 and and 5000 out
:(

I have a suspition is could be down to one of the number functions I am
using along the way but im not sure.

Any help or guidance would be greatly appriciated.

Thanks in advance

Fred
Mar 13 '06 #1
22 4449
Fred wrote:
I am trying to do some calculations on large numbers (ie
7,768,489,957,8 92,578,474,792, 094 / 12,280) and no matter what I do it
doesn't get it quite right. Its always somewhere between 10 and and 5000
out :(

I have a suspition is could be down to one of the number functions I am
using along the way but im not sure.

Any help or guidance would be greatly appriciated.


VB and VBScript integers are Long datatypes (32-bit) and range
from -2,147,483,648 to 2,147,483,647, which is -2^31 to 2^31-1. Larger
values are handled as Float datatype which is 64-bit. Your large number is
stored as an approximation.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
Mar 13 '06 #2

"Frinton" <fr*******@hotm ail.com> wrote in message
news:44******@2 12.67.96.135...
Hi,

I am trying to do some calculations on large numbers (ie
7,768,489,957,8 92,578,474,792, 094 / 12,280) and no matter what I do it
doesn't get it quite right. Its always somewhere between 10 and and 5000
out :(
The best is to convert it to currency.
dim v
v=CCur(10)
v=v * ccur(1030303030 30.1034)
I have a suspition is could be down to one of the number functions I am
using along the way but im not sure.


Mar 13 '06 #3
Frinton wrote on 13 mrt 2006 in microsoft.publi c.inetserver.as p.general:
I am trying to do some calculations on large numbers (ie
7,768,489,957,8 92,578,474,792, 094 / 12,280) and no matter what I do it
doesn't get it quite right. Its always somewhere between 10 and and
5000 out
:(

I have a suspition is could be down to one of the number functions I
am using along the way but im not sure.

Any help or guidance would be greatly appriciated.


<http://en.wikipedia.or g/wiki/Long_division>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 13 '06 #4
Thanks for the reply

Is there any work around to this?

Im storing the values in SQL, is BigInt the largest exact number possible?

Thanks

Fred

"Richard Mueller" <rl************ **@ameritech.NO SPAM.net> wrote in message
news:uA******** ******@TK2MSFTN GP12.phx.gbl...
Fred wrote:
I am trying to do some calculations on large numbers (ie
7,768,489,957,8 92,578,474,792, 094 / 12,280) and no matter what I do it
doesn't get it quite right. Its always somewhere between 10 and and 5000
out :(

I have a suspition is could be down to one of the number functions I am
using along the way but im not sure.

Any help or guidance would be greatly appriciated.


VB and VBScript integers are Long datatypes (32-bit) and range
from -2,147,483,648 to 2,147,483,647, which is -2^31 to 2^31-1. Larger
values are handled as Float datatype which is 64-bit. Your large number is
stored as an approximation.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

Mar 13 '06 #5
Thanks for the reply

Im getting an overflow when I try this :(

Fred

"Egbert Nierop (MVP for IIS)" <eg***********@ nospam.invalid> wrote in
message news:uJ******** ******@tk2msftn gp13.phx.gbl...

"Frinton" <fr*******@hotm ail.com> wrote in message
news:44******@2 12.67.96.135...
Hi,

I am trying to do some calculations on large numbers (ie
7,768,489,957,8 92,578,474,792, 094 / 12,280) and no matter what I do it
doesn't get it quite right. Its always somewhere between 10 and and 5000
out :(


The best is to convert it to currency.
dim v
v=CCur(10)
v=v * ccur(1030303030 30.1034)
I have a suspition is could be down to one of the number functions I am
using along the way but im not sure.

Mar 13 '06 #6
Thanks for the reply

Its not the calculation that is causing me the problem its the storing of
values

Fred

"Evertjan." <ex************ **@interxnl.net > wrote in message
news:Xn******** ************@19 4.109.133.242.. .
Frinton wrote on 13 mrt 2006 in microsoft.publi c.inetserver.as p.general:
I am trying to do some calculations on large numbers (ie
7,768,489,957,8 92,578,474,792, 094 / 12,280) and no matter what I do it
doesn't get it quite right. Its always somewhere between 10 and and
5000 out
:(

I have a suspition is could be down to one of the number functions I
am using along the way but im not sure.

Any help or guidance would be greatly appriciated.


<http://en.wikipedia.or g/wiki/Long_division>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Mar 13 '06 #7
"Frinton" <fr*******@hotm ail.com> wrote:
Thanks for the reply

Its not the calculation that is causing me the problem its the storing of
values


In VB or VBScript there's probably no way out of this. Java (not
JavaScript) has a BigInteger class, and there are classes available
for C++ that can handle integers of arbitrary precision.

Arithmetic operations in these classes would not be fast, but they
would preserve and use the full precision.

--
Tim Slattery
MS MVP(DTS)
Sl********@bls. gov
Mar 13 '06 #8
On Mon, 13 Mar 2006 15:12:09 -0000, "Frinton" <fr*******@hotm ail.com> wrote:
Hi,

I am trying to do some calculations on large numbers (ie
7,768,489,957, 892,578,474,792 ,094 / 12,280) and no matter what I do it
doesn't get it quite right. Its always somewhere between 10 and and 5000 out
:(

I have a suspition is could be down to one of the number functions I am
using along the way but im not sure.

Any help or guidance would be greatly appriciated.

Thanks in advance

Fred

See tip 4533 » How do I perform accurate and/or complex math in a batch? 11-Dec-01
in the 'Tips & Tricks' at http://www.jsifaq.com

When I type the following at a CMD.EXE prompt:
for /f %i in ('domath //nologo "Round(77684899 578925784747920 94/12280)"') do @echo %i

I get 6.3261318875346 7E+20


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com
Mar 13 '06 #9

"Jerold Schulman" <Je***@jsiinc.c om> wrote in message
news:lv******** *************** *********@4ax.c om...
On Mon, 13 Mar 2006 15:12:09 -0000, "Frinton" <fr*******@hotm ail.com>
wrote:
Hi,

I am trying to do some calculations on large numbers (ie
7,768,489,957 ,892,578,474,79 2,094 / 12,280) and no matter what I do it
doesn't get it quite right. Its always somewhere between 10 and and 5000
out
:(

I have a suspition is could be down to one of the number functions I am
using along the way but im not sure.

Any help or guidance would be greatly appriciated.

Thanks in advance

Fred

See tip 4533 » How do I perform accurate and/or complex math in a batch?
11-Dec-01
in the 'Tips & Tricks' at http://www.jsifaq.com

When I type the following at a CMD.EXE prompt:
for /f %i in ('domath //nologo "Round(77684899 578925784747920 94/12280)"')
do @echo %i

I get 6.3261318875346 7E+20


Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
http://www.jsifaq.com

Mar 13 '06 #10

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

Similar topics

4
6507
by: koray | last post by:
hi, i need to show large numbers seperated by commas. since i'm using variables from speedscript, i cannot know their values, since the user should enter them. how should i code to show these large numbers in comma(or pointed)-style?
3
5261
by: Alex Vinokur | last post by:
Dann Corbit has implemented function int ilog2 (unsigned long) at http://groups.google.com/groups?selm=lkPa4.2165%24I41.1498%40client Is exist a similar C++-function for very large numbers, e.g., function with signature vector<unsigned long> ilog2 (const vector<unsigned long>&)? -- Alex Vinokur email: alex DOT vinokur AT gmail DOT com
10
4973
by: Tuvas | last post by:
I've been thinking about writing a program to generate the world's largest prime numbers, just for the fun of it. This would require being able to hold an 8000000 digit number into memory (25 megabits, or a little over 3 megs of memory for just one variable...) I would also need several smaller variables. This came about as I optimised a prime...
1
1614
by: Jonathan | last post by:
My app is trying to multiply and add some very large numbers. Here is the line that I am am having problems with: Seconds = CDbl(PartB) * CDbl(16777216) Seconds is a double and PartB is a short. Partb is 15 before this line. After the multiplication, the value held in seconds is 549420. This obviously isn't correct. I know that the problem...
17
12754
by: Sri | last post by:
How do you add an n-bit number in C? Regards, Sri
3
8196
by: CFonville | last post by:
I was wondering if there is any way to store large numbers in a variable? With this simple script: var bigpi = 1234567890123456789012345678901234567890123456789012345678901234567890; alert(bigpi); I only get the first 17 digits and an exponent. Is there any way to save very large numbers to a variable? I would really like to be able...
24
21551
by: Frank Swarbrick | last post by:
We have a batch process that inserts large numbers (100,000 - 1,000,000) of records into a database each day. (DL/I database.) We're considering converting it to a DB2 table. Currently we have logic in place that, prior to inserting any data, reads the first input record and checks to see if it already exists in the table. If the record...
2
1958
by: Todd.Branchflower | last post by:
Hey everyone, I am new to c++ and the group and would appreciate your help. I was doing a problem on projecteuler.net in which you had to find the largest factor of an extremely large number. Unfortunately, I didn't know how to accommodate a number of this size in c++. After developing my algorithm and writing it in c++, I wrote the...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1213
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.