From 72af855cab43a55426ae052b55f752389fd0ef95 Mon Sep 17 00:00:00 2001
From: Martin Goik <goik@hdm-stuttgart.de>
Date: Wed, 10 Apr 2024 09:11:47 +0200
Subject: [PATCH] Hint abs(x - y)

---
 .../languageFundamentals.xml                  | 32 +++++++++++++++++--
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/Doc/Sd1/LanguageFundamentals/languageFundamentals.xml b/Doc/Sd1/LanguageFundamentals/languageFundamentals.xml
index 102717075..5d5b28617 100644
--- a/Doc/Sd1/LanguageFundamentals/languageFundamentals.xml
+++ b/Doc/Sd1/LanguageFundamentals/languageFundamentals.xml
@@ -5720,9 +5720,35 @@ System.out.println(2147483647 + 1L);</programlisting>
               result and propose a solution.</para>
 
               <tip>
-                <para>You will have to replace the <quote>==</quote> operator
-                by something more appropriate addressing limited arithmetic
-                precision.</para>
+                <itemizedlist>
+                  <listitem>
+                    <para>You will have to relax the exact <quote>==</quote>
+                    operator by a »being close to each other« relation
+                    addressing the limited arithmetic precision.</para>
+                  </listitem>
+
+                  <listitem>
+                    <para>The <methodname
+                    xlink:href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Math.html#abs(double)">Math.abs()</methodname>
+                    method calculates the absolute value:</para>
+
+                    <informaltable border="1">
+                      <tr>
+                        <th>Code</th>
+
+                        <th>Result</th>
+                      </tr>
+
+                      <tr>
+                        <td valign="top"><programlisting language="java">System.out.println(Math.abs(10.7));
+System.out.println(Math.abs(-10.7));</programlisting></td>
+
+                        <td valign="top"><screen>10.7
+10.7</screen></td>
+                      </tr>
+                    </informaltable>
+                  </listitem>
+                </itemizedlist>
               </tip>
             </question>
 
-- 
GitLab