Re: avoid scientific notation
- From: "Dan Barclay" <Dan@xxxxxxxx>
- Date: Tue, 7 Jun 2005 17:37:09 -0500
Tom,
If you have a math or engineering background, take a close look at floating
point Double Precision and at Long Integers. You can probably scale your
problem, and it's likely that Doubles can take care of your calculation
needs unless there are a *very* large number of small values or a mix of
large and very small values. The math operations you are performing can
have a huge effect as well. Even in handling extreme mixed sizes, if you'll
start processing with the small values you can reduce your truncation error
significantly.
There are few problems that cannot be solved with Double Precision floating
point, but I'm sure some do exist.
If you explicitly need to process values with a very large number of digits
I strongly recommend you search out an add-on math library to do this for
you. If write that kind of library yourself, you're likely to be a very old
man before you get it written and tested<g>. "And tested" is the key here.
You will be dealing with a lot of boundary conditions and testing will be
fairly complex.
As for using another language, the only way you're going to get much speed
improvement is to find a language with a native data type of the precision
you're looking for. I don't know of one, but you might check current
FORTRAN compilers (that's where you'll find computational focus).
Dan
"Tom F" <TomF@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6F29B1FB-2D53-4DDE-B240-E0ACBE85B4A1@xxxxxxxxxxxxxxxx
> No trips to pluto, just trying to add a lot of large numbers. I had
> thought
> of eventually using more that one digit at a time like you suggested below
> but saw that would still be limited at about 15 digits at a time.
>
> I kinda assumed that VB didn't have that functionality built and the
> various
> posts seem to have confirmed it.
> I do appreciate everyone's suggestions though.
>
> I have one other question. I am most comfortable using VB 6.0 but wonder
> how
> much speed could be gained if I did this kind of application using C++ or
> Java. I wouldn't expect much since this is just number crunching but
> wonder
> if anyone could give any insight?
>
> Thanks!
>
> "Charlie" wrote:
>
>> ONLY 2108 digits? Are you serious? For what purpose do you need such
>> accuracy? Are you trying to land a rover next to a particular boulder on
>> Pluto?
>>
>> I believe your calculation requirements are beyond the limits of the
>> numeric
>> datatypes available in VB. Your method of adding the single digits of
>> strings makes me think there may be a way to use three arrays of longs,
>> making sure each element stays in the range -999999999 to 999999999 and
>> keeping track of carrying the one to successive elements. Then format
>> the
>> elements of the resultant (third) array to strings and append them
>> together.
>> Might be faster than doing individual digits.
>>
>> 000066000 010000009 900000000
>> 123456789 989999990 900000001
>> ----------------------------------------
>> 123522790 000000000 800000001
>>
>> For i = 1 To nElements
>> strResult = strResult & Format(lngResult(i), "000000000")
>> Next i
>>
>> "123522790000000000800000001"
>
.
- References:
- avoid scientific notation
- From: Tom F
- RE: avoid scientific notation
- From: Charlie
- RE: avoid scientific notation
- From: Tom F
- avoid scientific notation
- Prev by Date: Re: Regular Expressions: How to check for these characters?
- Next by Date: Re: Weird ADO error, any ideas?
- Previous by thread: Re: avoid scientific notation
- Next by thread: Re: avoid scientific notation
- Index(es):
Relevant Pages
|