You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2007/10/03 17:25:28 UTC

svn commit: r581626 - /incubator/stdcxx/trunk/util/display.cpp

Author: faridz
Date: Wed Oct  3 08:25:27 2007
New Revision: 581626

URL: http://svn.apache.org/viewvc?rev=581626&view=rev
Log:
2007-10-03 Farid Zaripov <fa...@epam.com>

	* display.cpp (print_status_plain): Use float arithmetic when
	calculating the percent of the failed assertions to avoid
	overflow of the unsigned int type.

Modified:
    incubator/stdcxx/trunk/util/display.cpp

Modified: incubator/stdcxx/trunk/util/display.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/display.cpp?rev=581626&r1=581625&r2=581626&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/display.cpp (original)
+++ incubator/stdcxx/trunk/util/display.cpp Wed Oct  3 08:25:27 2007
@@ -205,8 +205,10 @@
         && 0 == status->status 
         && 0 == status->exit) {
         if (status->assert) {
-            printf (" %7u %6u %5d%%", status->assert, status->failed, 
-                    100 * (status->assert - status->failed) / status->assert);
+            const int percnt = int (  100.0
+                                    * (status->assert - status->failed)
+                                    / status->assert);
+            printf (" %7u %6u %5d%%", status->assert, status->failed, percnt);
         }
         else {
             printf ("       0 %6u   100%%", status->failed);