Can I limit the size of a double?

I have an array of doubles, which range is size from 0.6803939303238393921 to 27.4995966002839211038 . I need to limit the numbers to a length of 4, but I cannot limit thier size until I place them in a specific array as they are used in calculations. Any ideas?

Thanks,

Brad

Arrays are defined as

dim d () as double
bradbrittonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Do you really want to truncate your digits and lose accuracy?

Why not just display them with four digits using ToString() when you need to present them to the user?
Bob LearnedCommented:
Are you talking about Math.Round(number, 4) to round to 4 decimal digits?

Bob

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
For example...

        Dim d As Double = 0.68039393032383944
        Dim strD As String = d.ToString("#0.0000")
        MsgBox(strD)

        Dim d2 As Double = 27.499596600283922
        Dim strD2 As String = d2.ToString("#0.0000")
        MsgBox(strD2)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.