Solved

Handle significant figures in VB.NET

Posted on 2004-09-28
3
623 Views
Last Modified: 2010-08-05
Dear all,

  I am trying to handle calculation between numbers, with 25 significant figures (e.g. 123456.7890123456789012345) and seems even double can not handle figures like that.

  Are there any simple way in VB.NET to handle these kind of numbers? except cut the numbers into parts.

  Thanks.

Regs,
Bezier
0
Comment
Question by:bezier98
3 Comments
 
LVL 9

Accepted Solution

by:
checoo earned 250 total points
ID: 12167767
use decimal it can handle upto 28 significant figures
0
 
LVL 10

Assisted Solution

by:123654789987
123654789987 earned 250 total points
ID: 12168389
The decimal data type

decimal data type variables can store 1 times 10 to the 28th 1.0 × 10-28 and 7.9 times 10 to the 28 th 7.9 × 1028 in 128 bit. If you think about this type you will note that it has a greater precision and a smaller range and that’s we exactly needs for financial calculations also note that decimal data type has a Precision of 28-29 significant digits.
0
 

Author Comment

by:bezier98
ID: 12214604
Acutally I did use decimal type, but at the begining, it doesn't work, but now I know the reason.

I try the following

Dim x as decimal

x = "123456.7890123456789012345"
msgbox (x + 0.0000000000000000001)

the result will turn out to be 12345.789012346

which I think VB treated 0.0000000000000000001 as double

After assigned 0.0000000000000000001 to another decimal y, then
msgbox(x + y) will give the exact answer

Anyway, thanks for helping

Bezier
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now