Solved

Handle significant figures in VB.NET

Posted on 2004-09-28
3
634 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
[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
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

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