Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Formating
Message
De
02/09/2002 01:24:53
 
 
À
02/09/2002 00:12:04
Teddy Win
Bytel Information Technology
Jakarta, Indonésie
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Titre:
Divers
Thread ID:
00695872
Message ID:
00695879
Vues:
9
you are getting rounding Error because you are assigining the values to a single data type, just change the single data type in your code to double, I hope you will not face the round off error.
Use double data type for more accuracy.

here is a saction of MSDN for you

The Single and Double data types are very precise—that is, they allow you to specify extremely small or large numbers. However, these data types are not very accurate because they use floating-point mathematics. Floating-point mathematics has an inherent limitation in that it uses binary digits to represent decimals. Not all the numbers within the range available to the Single or Double data type can be represented exactly in binary form, so they are rounded. Also, some numbers can't be represented exactly with any finite number of digits—pi, for example, or the decimal resulting from 1/3.

Because of these limitations to floating-point mathematics, you may encounter rounding errors when you perform operations on floating-point numbers. Compared to the size of the value you're working with, the rounding error will be very small. If you don't require absolute accuracy and can afford relatively small rounding errors, the floating-point data types are ideal for representing very small or very large values. On the other hand, if your values must be accurate—for example, if you're working with money values—you should consider one of the scaled integer data types.
Best Luck..
Nilesh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform