Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the maximum allowed value of the Double data type

Status
Not open for further replies.

vpellerito

Technical User
Sep 12, 2006
30
US
I'm trying to set the value for my array to the maximum value allowed for a Double data type. How do I do this without explicitly setting a constant (which I can't seem to do anyway)?
I've seen this as a property in some languages but not sure how it works in VB.
Thanks
 
Hi vp,

I'm not clear on your intention.
Why on earth would you want to set the size to 3 (followed by 300 zeros)?

a) I'm not sure if this would exceed memory limitations
b) I'm not sure if this would automatically reserve said memory every time the app. was executed. (What a waste at the start - with very little data in there).

ATB

Darrylle





Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Roger that Bob

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Thanks for your responses. Sorry for my late response but I was away this weekend.

The reason why I asked how to set an array value to the maximum value allowed for a Double data type was because this was what was done the original author of the code.
I want to take some code written in Fortran and convert it to VB. It's an algorithm for Jenk's optimization method and the code initialized a matrix that way. See here for the code in Fortran
and here in PHP

To be honest, I'm not entirely sure why the array needs to be initialized as such. I don't have access to the original paper explaining the algorithm. The irony of all this is that the algorithm was probably originally written in Basic. :)
 
VP,

In that case, there IS no reason to define it to the maximum.

As BOb as said:

Use REDIM PRESERVE ArrayName("current size" + 1)

Every time you come to add a new element.

N.B. You MUST use PRESERVE, otherwise REDIM alone will wipe the original array content.

ATB

Darrylle

Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top