<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://www.baszerr.eu/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>BaSzErr - blog:2021:03:20</title>
        <description></description>
        <link>https://www.baszerr.eu/</link>
        <lastBuildDate>Wed, 06 May 2026 07:55:02 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://www.baszerr.eu/lib/exe/fetch.php?media=wiki:dokuwiki.svg</url>
            <title>BaSzErr</title>
            <link>https://www.baszerr.eu/</link>
        </image>
        <item>
            <title>2021-03-20_-_still_too_much_engineering</title>
            <link>https://www.baszerr.eu/doku.php?id=blog:2021:03:20:2021-03-20_-_still_too_much_engineering</link>
            <description>
&lt;h1 class=&quot;sectionedit1&quot; id=&quot;still_too_much_engineering&quot;&gt;2021-03-20 - still too much engineering&lt;/h1&gt;
&lt;div class=&quot;level1&quot;&gt;

&lt;p&gt;
i started this year with a description &lt;a href=&quot;https://www.baszerr.eu/doku.php?id=blog:2021:01:01:2021-01-01_-_too_much_engineering&quot; class=&quot;wikilink1&quot; title=&quot;blog:2021:01:01:2021-01-01_-_too_much_engineering&quot; data-wiki-id=&quot;blog:2021:01:01:2021-01-01_-_too_much_engineering&quot;&gt;how i started RE on device, only to learn that it&amp;#039;s power cable was loose&lt;/a&gt;. and here we are – a quarter year later i did exactly the same. this time i&amp;#039;ve decided to memorize &lt;a href=&quot;https://en.wikipedia.org/wiki/e (mathematical constant)&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/e (mathematical constant)&quot;&gt;e&lt;/a&gt; (that i remember up to 2 decimal places) and &lt;a href=&quot;https://en.wikipedia.org/wiki/pi&quot; class=&quot;interwiki iw_wp&quot; title=&quot;https://en.wikipedia.org/wiki/pi&quot;&gt;pi&lt;/a&gt; (i remember 4 decimal places) up to 10 decimal places. what can i do with it? well – play with calc, of course. ;)
&lt;/p&gt;

&lt;p&gt;
with &lt;code&gt;e&lt;/code&gt; it was simple – &lt;code&gt;ln(e)=1&lt;/code&gt;. so i started calc app on my phone: &lt;code&gt;ln(2.7182818285)=1.00000000001506641592&lt;/code&gt;. sweet.
&lt;/p&gt;

&lt;p&gt;
problem started with &lt;code&gt;pi&lt;/code&gt; – &lt;code&gt;sin(pi)=0&lt;/code&gt;. so i started calc app on my phone:
&lt;/p&gt;
&lt;ul&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;sin(3)=0.1411…&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;sin(3.14)=0.0015926…&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;sin(3.1415)=0.054802050…&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;level1&quot;&gt;&lt;div class=&quot;li&quot;&gt; &lt;code&gt;sin(3.1415926535)=0.05480366…&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
crap! not only value is not equal to &lt;code&gt;0&lt;/code&gt; on 2nd decimal place already, but it is RAISING with improved precision! problem seemed consistent on 3 different calculator apps – looks like hardware/&lt;abbr title=&quot;Application Programming Interface&quot;&gt;API&lt;/abbr&gt; thing. what can i do? i&amp;#039;ve checked if CPU type – if it is 64-bit. turned out to be Cortex-A53, so 64-bit (i.e. not an issue of 32-bit and small floating-point precision). maybe some weirdo &lt;code&gt;float&lt;/code&gt; vs. &lt;code&gt;double&lt;/code&gt; in software? let&amp;#039;s see on my PC:
&lt;/p&gt;
&lt;pre class=&quot;code cpp&quot;&gt;&lt;span class=&quot;co2&quot;&gt;#include &amp;lt;iostream&amp;gt;&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#include &amp;lt;iomanip&amp;gt;&lt;/span&gt;
&lt;span class=&quot;co2&quot;&gt;#include &amp;lt;cmath&amp;gt;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw2&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;namespace&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;kw4&quot;&gt;int&lt;/span&gt; main&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#123;&lt;/span&gt;
  &lt;span class=&quot;kw3&quot;&gt;cout&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;float:  sin(3.14000000) = &amp;quot;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;fixed&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;setprecision&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; sinf&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu17&quot;&gt;3.14f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; endl&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kw3&quot;&gt;cout&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;float:  sin(3.14159265) = &amp;quot;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;fixed&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;setprecision&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; sinf&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu17&quot;&gt;3.14159265f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; endl&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kw3&quot;&gt;cout&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; endl&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&amp;nbsp;
  &lt;span class=&quot;kw3&quot;&gt;cout&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;double: sin(3.14000000) = &amp;quot;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;fixed&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;setprecision&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;sin&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu16&quot;&gt;3.14&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; endl&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kw3&quot;&gt;cout&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&amp;quot;double: sin(3.14159265) = &amp;quot;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;fixed&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; std&lt;span class=&quot;sy4&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;me2&quot;&gt;setprecision&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;kw3&quot;&gt;sin&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span class=&quot;nu16&quot;&gt;3.14159265&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span class=&quot;sy1&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; endl&lt;span class=&quot;sy4&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;
and we have:
&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;float:  sin(3.14000000) = 0.00159254798199981451
float:  sin(3.14159265) = -0.00000008742277657348

double: sin(3.14000000) = 0.00159265291648682823
double: sin(3.14159265) = 0.00000000358979302984&lt;/pre&gt;

&lt;p&gt;
hmmm… &lt;code&gt;sin(3.14)&lt;/code&gt; is very close to &lt;code&gt;float&lt;/code&gt;/&lt;code&gt;double&lt;/code&gt; results, but other results are more accurate. can&amp;#039;t be that…
&lt;/p&gt;

&lt;p&gt;
so i took another look at the calc app… and voila! trigonometric functions there use by default degrees – i.e. &lt;code&gt;sin(180)=0&lt;/code&gt;. after switching to radians, &lt;code&gt;sin(3.1415926535)=0.00000000008979323846&lt;/code&gt;. works. engineer – engineer never changes… ;)
&lt;/p&gt;

&lt;/div&gt;
</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 15 Jun 2021 20:09:41 +0000</pubDate>
        </item>
    </channel>
</rss>
