diff options
author | Matthew Sloyan <matthew.sloyan@arm.com> | 2021-08-24 16:27:15 +0100 |
---|---|---|
committer | Matthew Sloyan <matthew.sloyan@arm.com> | 2021-08-24 16:27:40 +0100 |
commit | f86be93b7492b381370cae7bf71eca8572a0cbae (patch) | |
tree | 2a16d9b1892db2305851b2d91850f1c1635390b0 /21.08/_floating_point_comparison_test_8cpp_source.xhtml | |
parent | ff4682943c0a64acb22643aac7793ad2ec2a1194 (diff) | |
download | armnn-f86be93b7492b381370cae7bf71eca8572a0cbae.tar.gz |
IVGCVSW-5924 Update 21.08 Doxygen Documents
* Also updated latest symlink.
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com>
Change-Id: If9b4e0e52464abdf797b9eb858ae19bcc64c2aea
Diffstat (limited to '21.08/_floating_point_comparison_test_8cpp_source.xhtml')
-rw-r--r-- | 21.08/_floating_point_comparison_test_8cpp_source.xhtml | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/21.08/_floating_point_comparison_test_8cpp_source.xhtml b/21.08/_floating_point_comparison_test_8cpp_source.xhtml new file mode 100644 index 0000000000..b56e14420f --- /dev/null +++ b/21.08/_floating_point_comparison_test_8cpp_source.xhtml @@ -0,0 +1,117 @@ +<!-- Copyright (c) 2020 ARM Limited. --> +<!-- --> +<!-- SPDX-License-Identifier: MIT --> +<!-- --> +<!-- HTML header for doxygen 1.8.13--> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> +<meta http-equiv="X-UA-Compatible" content="IE=9"/> +<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="robots" content="NOINDEX, NOFOLLOW" /> +<meta name="viewport" content="width=device-width, initial-scale=1"/> +<title>ArmNN: src/armnnUtils/test/FloatingPointComparisonTest.cpp Source File</title> +<link href="tabs.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="jquery.js"></script> +<script type="text/javascript" src="dynsections.js"></script> +<link href="navtree.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="resize.js"></script> +<script type="text/javascript" src="navtreedata.js"></script> +<script type="text/javascript" src="navtree.js"></script> +<script type="text/javascript"> + $(document).ready(initResizable); +</script> +<link href="search/search.css" rel="stylesheet" type="text/css"/> +<script type="text/javascript" src="search/searchdata.js"></script> +<script type="text/javascript" src="search/search.js"></script> +<script type="text/x-mathjax-config"> + MathJax.Hub.Config({ + extensions: ["tex2jax.js"], + jax: ["input/TeX","output/HTML-CSS"], +}); +</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> +<link href="doxygen.css" rel="stylesheet" type="text/css" /> +<link href="stylesheet.css" rel="stylesheet" type="text/css"/> +</head> +<body> +<div id="top"><!-- do not remove this div, it is closed by doxygen! --> +<div id="titlearea"> +<table cellspacing="0" cellpadding="0"> + <tbody> + <tr style="height: 56px;"> + <img alt="ArmNN" src="Arm_NN_horizontal_blue.png" style="max-width: 10rem; margin-top: .5rem; margin-left 10px"/> + <td style="padding-left: 0.5em;"> + <div id="projectname"> +  <span id="projectnumber">21.08</span> + </div> + </td> + </tr> + </tbody> +</table> +</div> +<!-- end header part --> +<!-- Generated by Doxygen 1.8.13 --> +<script type="text/javascript"> +var searchBox = new SearchBox("searchBox", "search",false,'Search'); +</script> +<script type="text/javascript" src="menudata.js"></script> +<script type="text/javascript" src="menu.js"></script> +<script type="text/javascript"> +$(function() { + initMenu('',true,false,'search.php','Search'); + $(document).ready(function() { init_search(); }); +}); +</script> +<div id="main-nav"></div> +</div><!-- top --> +<div id="side-nav" class="ui-resizable side-nav-resizable"> + <div id="nav-tree"> + <div id="nav-tree-contents"> + <div id="nav-sync" class="sync"></div> + </div> + </div> + <div id="splitbar" style="-moz-user-select:none;" + class="ui-resizable-handle"> + </div> +</div> +<script type="text/javascript"> +$(document).ready(function(){initNavTree('_floating_point_comparison_test_8cpp_source.xhtml','');}); +</script> +<div id="doc-content"> +<!-- window showing the filter options --> +<div id="MSearchSelectWindow" + onmouseover="return searchBox.OnSearchSelectShow()" + onmouseout="return searchBox.OnSearchSelectHide()" + onkeydown="return searchBox.OnSearchSelectKey(event)"> +</div> + +<!-- iframe showing the search results (closed by default) --> +<div id="MSearchResultsWindow"> +<iframe src="javascript:void(0)" frameborder="0" + name="MSearchResults" id="MSearchResults"> +</iframe> +</div> + +<div class="header"> + <div class="headertitle"> +<div class="title">FloatingPointComparisonTest.cpp</div> </div> +</div><!--header--> +<div class="contents"> +<a href="_floating_point_comparison_test_8cpp.xhtml">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">//</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Copyright © 2020 Arm Ltd. All rights reserved.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// SPDX-License-Identifier: MIT</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">//</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> </div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include <<a class="code" href="_floating_point_comparison_8hpp.xhtml">armnnUtils/FloatingPointComparison.hpp</a>></span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> </div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include <doctest/doctest.h></span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> </div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="keyword">using namespace </span><a class="code" href="namespacearmnn_utils.xhtml">armnnUtils</a>;</div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div><div class="line"><a name="l00012"></a><span class="lineno"><a class="line" href="_floating_point_comparison_test_8cpp.xhtml#a4f09b782de0c0ac05dc0fcf7732a9108"> 12</a></span> <a class="code" href="_floating_point_comparison_test_8cpp.xhtml#a4f09b782de0c0ac05dc0fcf7732a9108">TEST_SUITE</a>(<span class="stringliteral">"FloatingPointComparisonSuite"</span>)</div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> {</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span> TEST_CASE(<span class="stringliteral">"FloatingPointComparisonDefaultTolerance"</span>)</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> {</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  <span class="comment">// 1% range of 1.2 is 1.188 -> 1.212</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  <span class="comment">// Just below tolerance.</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, 1.17f));</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  <span class="comment">// Just above tolerance.</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, 1.213f));</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  <span class="comment">// Just inside the lower range.</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, 1.189f));</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <span class="comment">// Just inside the upper range.</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, 1.210f));</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  <span class="comment">// Exact match</span></div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, 1.2f));</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="comment">// Negative value tests.</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.2f, -1.17f));</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.2f, -1.213f));</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.2f, -1.189f));</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.2f, -1.210f));</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.2f, -1.2f));</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span> </div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="comment">// Negative & positive tests</span></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, -1.2f));</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.2f, 1.2f));</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="comment">// Negative and positive test with large float values.</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(3.3E+38f, -1.17549435e38f));</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.17549435e38f, 3.3E+38f));</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span> </div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="comment">// 1% range of 0.04 is 0.0396 -> 0.0404</span></div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="comment">// Just below tolerance.</span></div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(0.04f, 0.039f));</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="comment">// Just above tolerance.</span></div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(0.04f, 0.04041f));</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="comment">// Just inside the lower range.</span></div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(0.04f, 0.0397f));</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="comment">// Just inside the upper range.</span></div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(0.04f, 0.04039f));</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="comment">// Exact match</span></div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(0.04f, 0.04f));</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> }</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> </div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> TEST_CASE(<span class="stringliteral">"FloatingPointComparisonLargePositiveNumbersDefaultTolerance"</span>)</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span> {</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="comment">// Just below tolerance.</span></div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(3.3E+38f, (3.3E+38f * 0.989f)));</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="comment">// Just above tolerance.</span></div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(3.3E+38f, (3.3E+38f * 1.011f)));</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <span class="comment">// Just inside the lower range.</span></div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(3.3E+38f, (3.3E+38f * 0.992f)));</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="comment">// Just inside the upper range.</span></div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(3.3E+38f, (3.3E+38f * 1.009f)));</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="comment">// Exact match</span></div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(3.3E+38f, 3.3E+38f));</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> }</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span> </div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> TEST_CASE(<span class="stringliteral">"FloatingPointComparisonLargeNegativeNumbersDefaultTolerance"</span>)</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span> {</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="comment">// Just below tolerance.</span></div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.17549435e38f, (-1.17549435e38f * -1.009f)));</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="comment">// Just above tolerance.</span></div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.17549435e38f, (-1.17549435e38f * 1.011f)));</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="comment">// Just inside the lower range.</span></div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.17549435e38f, -1.17549435e38f - (-1.17549435e38f * 0.0099f)));</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="comment">// Just inside the upper range.</span></div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.17549435e38f, -1.17549435e38f + (-1.17549435e38f * 0.0099f)));</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="comment">// Exact match</span></div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.17549435e38f, -1.17549435e38f));</div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span> }</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span> </div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span> TEST_CASE(<span class="stringliteral">"FloatingPointComparisonSpecifiedTolerance"</span>)</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span> {</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <span class="comment">// 2% range of 1.2 is 1.176 -> 1.224</span></div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="comment">// Just below tolerance.</span></div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, 1.175f, 2.0f));</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <span class="comment">// Just above tolerance.</span></div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, 1.226f, 2.0f));</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="comment">// Just inside the lower range.</span></div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, 1.18f, 2.0f));</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="comment">// Just inside the upper range.</span></div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, 1.22f, 2.0f));</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <span class="comment">// Exact match.</span></div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(1.2f, 1.2f, 2.0f));</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span> </div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="comment">// 5% range of 6.2 is 5.89 -> 6.51</span></div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="comment">// Just below tolerance.</span></div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(6.2f, 5.88f, 5.0f));</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="comment">// Just above tolerance.</span></div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(6.2f, 6.52f, 5.0f));</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="comment">// Just inside the lower range.</span></div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(6.2f, 5.9f, 5.0f));</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="comment">// Just inside the upper range.</span></div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(6.2f, 6.5f, 5.0f));</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> </div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="comment">// Larger tolerance (unlikely to be used).</span></div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(10.0f, 9.01f, 10.0f));</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(10.0f, 8.99f, 10.0f));</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span> }</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> </div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> TEST_CASE(<span class="stringliteral">"FloatingPointComparisonLargePositiveNumbersSpecifiedTolerance"</span>)</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span> {</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="comment">// Just below tolerance.</span></div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(3.3E+38f, (3.3E+38f * 0.979f), 2.0f));</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="comment">// Just above tolerance.</span></div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(3.3E+38f, (3.3E+38f * 1.021f), 2.0f));</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="comment">// Just inside the lower range.</span></div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(3.3E+38f, (3.3E+38f * 0.982f), 2.0f));</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="comment">// Just inside the upper range.</span></div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(3.3E+38f, (3.3E+38f * 1.019f), 2.0f));</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> }</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> </div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> TEST_CASE(<span class="stringliteral">"FloatingPointComparisonLargeNegativeNumbersSpecifiedTolerance"</span>)</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span> {</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="comment">// Just below tolerance.</span></div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.17549435e38f, (-1.17549435e38f * -1.019f), 2.0f));</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="comment">// Just above tolerance.</span></div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  CHECK(!<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.17549435e38f, (-1.17549435e38f * 1.021f), 2.0f));</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="comment">// Just inside the lower range.</span></div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.17549435e38f, -1.17549435e38f - (-1.17549435e38f * 0.0089f), 2.0f));</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="comment">// Just inside the upper range.</span></div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  CHECK(<a class="code" href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">within_percentage_tolerance</a>(-1.17549435e38f, -1.17549435e38f + (-1.17549435e38f * 0.0089f), 2.0f));</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span> }</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span> </div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span> }</div><div class="ttc" id="_floating_point_comparison_8hpp_xhtml"><div class="ttname"><a href="_floating_point_comparison_8hpp.xhtml">FloatingPointComparison.hpp</a></div></div> +<div class="ttc" id="_floating_point_comparison_test_8cpp_xhtml_a4f09b782de0c0ac05dc0fcf7732a9108"><div class="ttname"><a href="_floating_point_comparison_test_8cpp.xhtml#a4f09b782de0c0ac05dc0fcf7732a9108">TEST_SUITE</a></div><div class="ttdeci">TEST_SUITE("FloatingPointComparisonSuite")</div><div class="ttdef"><b>Definition:</b> <a href="_floating_point_comparison_test_8cpp_source.xhtml#l00012">FloatingPointComparisonTest.cpp:12</a></div></div> +<div class="ttc" id="namespacearmnn_utils_xhtml"><div class="ttname"><a href="namespacearmnn_utils.xhtml">armnnUtils</a></div><div class="ttdef"><b>Definition:</b> <a href="_data_layout_indexed_8hpp_source.xhtml#l00013">DataLayoutIndexed.hpp:13</a></div></div> +<div class="ttc" id="namespacearmnn_utils_xhtml_a56b0e17341e000fa1d4561890294520c"><div class="ttname"><a href="namespacearmnn_utils.xhtml#a56b0e17341e000fa1d4561890294520c">armnnUtils::within_percentage_tolerance</a></div><div class="ttdeci">bool within_percentage_tolerance(float a, float b, float tolerancePercent=1.0f)</div><div class="ttdoc">Compare two floats and return true if their values are within a specified tolerance of each other...</div><div class="ttdef"><b>Definition:</b> <a href="_floating_point_comparison_8hpp_source.xhtml#l00020">FloatingPointComparison.hpp:20</a></div></div> +</div><!-- fragment --></div><!-- contents --> +</div><!-- doc-content --> +<!-- start footer part --> +<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> + <ul> + <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.xhtml">src</a></li><li class="navelem"><a class="el" href="dir_5d9c764a006d252ff232a5efbbd99a46.xhtml">armnnUtils</a></li><li class="navelem"><a class="el" href="dir_633b0e14f79bf856bcd1ac64b8cedab7.xhtml">test</a></li><li class="navelem"><a class="el" href="_floating_point_comparison_test_8cpp.xhtml">FloatingPointComparisonTest.cpp</a></li> + <li class="footer">Generated on Tue Aug 24 2021 16:18:43 for ArmNN by + <a href="http://www.doxygen.org/index.html"> + <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> + </ul> +</div> +</body> +</html> |