From 6ae0790866097d6cb762e6dc6c05e7f46f9717ad Mon Sep 17 00:00:00 2001
From: apv <apv@opencascade.com>
Date: Mon, 19 Jun 2017 16:37:39 +0300
Subject: [PATCH] 0028841: testdiff DRAW command hangs or crash with
 arithmetical exception

---
 src/DrawResources/TestCommands.tcl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/DrawResources/TestCommands.tcl b/src/DrawResources/TestCommands.tcl
index fb2b3deba9..1f800a9e95 100644
--- a/src/DrawResources/TestCommands.tcl
+++ b/src/DrawResources/TestCommands.tcl
@@ -1873,7 +1873,11 @@ proc _diff_img_name {dir1 dir2 casepath imgfile} {
 
 # auxiliary procedure to produce string comparing two values
 proc _diff_show_ratio {value1 value2} {
-    return "$value1 / $value2 \[[format "%+5.2f%%" [expr 100 * ($value1 - $value2) / double($value2)]]\]"
+    if {[expr double ($value2)] == 0.} {
+        return "$value1 / $value2"
+    } else {
+        return "$value1 / $value2 \[[format "%+5.2f%%" [expr 100 * ($value1 - $value2) / double($value2)]]\]"
+    }
 }
 
 # procedure to check cpu user time