Round() Vs Format()
If your application involve ROUNDING NUMBER than you MUST READ this!
AI
ملخص الذكاء الاصطناعي: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
كود المصدر
Rounding number is important fuction especially if you doing some Accounting, Math, etc calculation. Check the following fact. Let say, X = 2.344 + 2.341, there for, X = 4.685 Round X to 2 decimal point = 4.68 Refer to IEEE standard, 4.685 rounded to 2 decimal point is 4.68 4.675 rounded to 2 decimal point is 4.68 The problem when you use Round(): Fact 1 : Round(2.344 + 2.341, 2) = 4.69 Fact 2: Round(4.685, 2) = 4.68 You can see the different answer between Fact 1 & 2. In accounting point of view, the 0.01 cent must accountable. Recommandation: Use Format() instead of Round() Example: Format(2.344 + 2.341, "#.00") = 4.68 Format(4.685, "#.00") = 4.68 Hope this will help.
التعليقات الأصلية (3)
مسترجع من Wayback Machine