From 2a9593969ef2680dabc0c2c356ff524a73529573 Mon Sep 17 00:00:00 2001
From: Eric Kooistra <kooistra@astron.nl>
Date: Tue, 19 Apr 2022 12:08:43 +0200
Subject: [PATCH] Explained use of almost_equal() and almost_zero().

---
 libraries/base/common/src/vhdl/common_pkg.vhd | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libraries/base/common/src/vhdl/common_pkg.vhd b/libraries/base/common/src/vhdl/common_pkg.vhd
index d57813bc9a..ef84bffe9d 100644
--- a/libraries/base/common/src/vhdl/common_pkg.vhd
+++ b/libraries/base/common/src/vhdl/common_pkg.vhd
@@ -193,7 +193,9 @@ PACKAGE common_pkg IS
   
   FUNCTION ratio( n, d : NATURAL) RETURN NATURAL;  -- return n/d when n MOD d = 0 else return 0, so ratio * d = n only when integer ratio > 0
   FUNCTION ratio2(n, m : NATURAL) RETURN NATURAL;  -- return integer ratio of n/m or m/n, whichever is the largest
- 
+
+  -- use almost_equal(a/b, 1.0, max_ratio) to verify that a and b differ less than max_ratio/100 percent
+  -- use almost_zero(a/b, max_ratio) to verify that a is less than max_ratio/100 percent of b, so almost zero
   FUNCTION almost_equal(a, b, delta : REAL) RETURN BOOLEAN;  -- return TRUE when abs(a - b) < abs(delta), else return FALSE
   FUNCTION almost_zero(a, delta : REAL) RETURN BOOLEAN;      -- return TRUE when abs(a)     < abs(delta), else return FALSE
   
-- 
GitLab