Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Very big: Long Addition...

Posted on 2002-03-19
8
Medium Priority
?
201 Views
Last Modified: 2010-05-02
I have 16 digit max currency numbers,
I need to add these, but I cannot do it, because VB have no supported type for this... bigger than LONG.

   Both + and - values I have...

What Can I do for this? How can I add and display these correctly...

Sample:
Num1: 10,000,000,123
Num2: 15,000,000,450
I wanna add these two number...  (No .00)



0
Comment
Question by:Ege
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 39

Expert Comment

by:appari
ID: 6879258
if at all its required to do these type of calculations i do this in SQLs. for example in Oracle

select to_char(Num1+Num2) from dual

will return exact calculated value without truncation. then use the returned value and format it using format(returnval,"#,#0")

replace Num1 and Num2 with actual values
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 800 total points
ID: 6879266
Use the currency data type?

optionally try the Double data type as:

Range of double is 1.7E +/- 308 (15 digits).
0
 
LVL 2

Expert Comment

by:ronenr
ID: 6879268
IF I undestand right you can do:

Dim x As Currency
Dim y As Currency

x = 10000000123#
y = 15000000450#

Debug.Print Format(x + y, "#,###")

The datatype currency and double are 8 bytes numbers.

Good luck
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Author Comment

by:Ege
ID: 6879278
:)
I am happy today, and want to spent points! ...
Well, I am very new to VB, and do NOT know data types!

sorry others, it is FCEP... (First Come, Earn Point  like FIFO/FILO) :))

bye...
not: I gave "C" ryancys, It was easy...
0
 
LVL 1

Expert Comment

by:Doodle
ID: 6879282
Use the double data type it can deal with larger values.

Integer 2 bytes     -32,768 to 32,767
Long    4 bytes     -2,147,483,648 to 2,147,483,647
Single  4 bytes    
       -3.402823E38 to -1.401298E-45 for negative
        1.401298E-45 to 3.402823E38 for positive
Double  8 bytes
  -1.79769313486232E308 to -4.94065645841247E-324 (-)      
     4.94065645841247E-324 to 1.79769313486232E308 (+)
0
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 6879292
> It was easy...
Thank for the points But is it me deserve a "C"?
0
 
LVL 1

Author Comment

by:Ege
ID: 6879304
Sorry ryancys,
I though "C" as a HALF POINT...

But it is not!

How can I change this? If not, post a comment to
"point and grade for ryancsys"
and get A :))
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6879795
I have corrected this for you and changed the "C" to an "A".  Thank you ryancys for your additional assistance to Ege here, I will also handle the other question for you.

Just to clarify the grading process, Ege, the points you assign are always the same, but the grade you give has a direct impact on the Expert points awarded.  Example, 100 point question with an A grade = 400 expert points, B grade = 300 and C grade = 200, so quite an impact, not to mention that few at this excellent site feel their assistance is anything less than excellent, and for the most part, I wholeheartedly agree.  

Moondancer - EE Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question