example added

This commit is contained in:
Meik Hellmund 2022-09-26 20:54:19 +02:00
parent ea246342b6
commit afeb392e4b
6 changed files with 570 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
*~
*.ipynb

382
Example1.html Normal file
View File

@ -0,0 +1,382 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Example1</title>
<style>
html {
line-height: 1.5;
font-family: Georgia, serif;
font-size: 20px;
color: #1a1a1a;
background-color: #fdfdfd;
}
body {
margin: 0 auto;
max-width: 36em;
padding-left: 50px;
padding-right: 50px;
padding-top: 50px;
padding-bottom: 50px;
hyphens: auto;
overflow-wrap: break-word;
text-rendering: optimizeLegibility;
font-kerning: normal;
}
@media (max-width: 600px) {
body {
font-size: 0.9em;
padding: 1em;
}
h1 {
font-size: 1.8em;
}
}
@media print {
body {
background-color: transparent;
color: black;
font-size: 12pt;
}
p, h2, h3 {
orphans: 3;
widows: 3;
}
h2, h3, h4 {
page-break-after: avoid;
}
}
p {
margin: 1em 0;
}
a {
color: #1a1a1a;
}
a:visited {
color: #1a1a1a;
}
img {
max-width: 100%;
}
h1, h2, h3, h4, h5, h6 {
margin-top: 1.4em;
}
h5, h6 {
font-size: 1em;
font-style: italic;
}
h6 {
font-weight: normal;
}
ol, ul {
padding-left: 1.7em;
margin-top: 1em;
}
li > ol, li > ul {
margin-top: 0;
}
blockquote {
margin: 1em 0 1em 1.7em;
padding-left: 1em;
border-left: 2px solid #e6e6e6;
color: #606060;
}
code {
font-family: Menlo, Monaco, 'Lucida Console', Consolas, monospace;
font-size: 85%;
margin: 0;
}
pre {
margin: 1em 0;
overflow: auto;
}
pre code {
padding: 0;
overflow: visible;
overflow-wrap: normal;
}
.sourceCode {
background-color: transparent;
overflow: visible;
}
hr {
background-color: #1a1a1a;
border: none;
height: 1px;
margin: 1em 0;
}
table {
margin: 1em 0;
border-collapse: collapse;
width: 100%;
overflow-x: auto;
display: block;
font-variant-numeric: lining-nums tabular-nums;
}
table caption {
margin-bottom: 0.75em;
}
tbody {
margin-top: 0.5em;
border-top: 1px solid #1a1a1a;
border-bottom: 1px solid #1a1a1a;
}
th {
border-top: 1px solid #1a1a1a;
padding: 0.25em 0.5em 0.25em 0.5em;
}
td {
padding: 0.125em 0.5em 0.25em 0.5em;
}
header {
margin-bottom: 4em;
text-align: center;
}
#TOC li {
list-style: none;
}
#TOC ul {
padding-left: 1.3em;
}
#TOC > ul {
padding-left: 0;
}
#TOC a:not(:hover) {
text-decoration: none;
}
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { color: #008000; } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { color: #008000; font-weight: bold; } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<!-- CSS added by ANSI escape sequences filter -->
<style>
.ansi {line-height:1; padding:0; margin: 0; letter-spacing:0;
overflow:visible;font-family:JuliaMono;}
/* console foregrounds and backgrounds */
pre .ansi-black-fg { color: #3e424d; }
pre .ansi-red-fg { color: #e75c58; }
pre .ansi-green-fg { color: #00a250; }
pre .ansi-yellow-fg { color: #ddb62b; }
pre .ansi-blue-fg { color: #208ffb; }
pre .ansi-magenta-fg { color: #d160c4; }
pre .ansi-cyan-fg { color: #60c6c8; }
pre .ansi-white-fg { color: #c5c1b4; }
pre .ansi-black-bg { background-color: #3e424d; }
pre .ansi-red-bg { background-color: #e75c58; }
pre .ansi-green-bg { background-color: #00a250; }
pre .ansi-yellow-bg { background-color: #ddb62b; }
pre .ansi-blue-bg { background-color: #208ffb; }
pre .ansi-magenta-bg { background-color: #d160c4; }
pre .ansi-cyan-bg { background-color: #60c6c8; }
pre .ansi-white-bg { background-color: #c5c1b4; }
pre .ansi-black-intense-fg { color: #282c36; }
pre .ansi-red-intense-fg { color: #b22b31; }
pre .ansi-green-intense-fg { color: #007427; }
pre .ansi-yellow-intense-fg { color: #b27d12; }
pre .ansi-blue-intense-fg { color: #0065ca; }
pre .ansi-magenta-intense-fg { color: #a03196; }
pre .ansi-cyan-intense-fg { color: #258f8f; }
pre .ansi-white-intense-fg { color: #a1a6b2; }
pre .ansi-black-intense-bg { background-color: #282c36; }
pre .ansi-red-intense-bg { background-color: #b22b31; }
pre .ansi-green-intense-bg { background-color: #007427; }
pre .ansi-yellow-intense-bg { background-color: #b27d12; }
pre .ansi-blue-intense-bg { background-color: #0065ca; }
pre .ansi-magenta-intense-bg { background-color: #a03196; }
pre .ansi-cyan-intense-bg { background-color: #258f8f; }
pre .ansi-white-intense-bg { background-color: #a1a6b2; }
pre .ansi-default-inverse-fg { color: rgba(255, 255, 255, 1); }
pre .ansi-default-inverse-bg { background-color: #111111; }
pre .ansi-bold { font-weight: bold; }
pre .ansi-underline { text-decoration: underline; }
</style>
</head>
<body>
<div id="13bf7a6e" class="cell code" data-execution_count="6">
<div class="sourceCode" id="cb1"><pre
class="sourceCode julia"><code class="sourceCode julia"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="im">using</span> <span class="bu">BenchmarkTools</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="pp">@benchmark</span> <span class="fu">sum</span>(<span class="fu">rand</span>(<span class="fl">1000</span>))</span></code></pre></div>
<div class="output execute_result" data-execution_count="6">
<pre class="ansi"><code class="ansi">BenchmarkTools.Trial: 10000 samples with 10 evaluations.
Range <span class="ansi-black-intense-fg">(</span><span class="ansi-cyan-intense-fg ansi-bold">min</span><span class="ansi-magenta-fg">max</span><span class="ansi-black-intense-fg">): </span><span class="ansi-cyan-intense-fg ansi-bold">1.182 μs</span><span class="ansi-magenta-fg">145.397 μs</span> <span class="ansi-black-intense-fg"></span> GC <span class="ansi-black-intense-fg">(</span>min … max<span class="ansi-black-intense-fg">): </span>0.00% … 96.62%
Time <span class="ansi-black-intense-fg">(</span><span class="ansi-blue-intense-fg ansi-bold">median</span><span class="ansi-black-intense-fg">): </span><span class="ansi-blue-intense-fg ansi-bold">1.277 μs </span><span class="ansi-black-intense-fg"></span> GC <span class="ansi-black-intense-fg">(</span>median<span class="ansi-black-intense-fg">): </span>0.00%
Time <span class="ansi-black-intense-fg">(</span><span class="ansi-green-intense-fg ansi-bold">mean</span> ± <span class="ansi-green-fg">σ</span><span class="ansi-black-intense-fg">): </span><span class="ansi-green-intense-fg ansi-bold">1.789 μs</span> ± <span class="ansi-green-fg"> 4.410 μs</span> <span class="ansi-black-intense-fg"></span> GC <span class="ansi-black-intense-fg">(</span>mean ± σ<span class="ansi-black-intense-fg">): </span>9.23% ± 3.75%
▄█<span class="ansi-blue-fg"></span>▅▃▃▄▃ <span class="ansi-green-fg"> </span> ▁▃▄▃▃▄▃▂▂▁ ▂
██<span class="ansi-blue-fg"></span>█████▇▇▆▆▆▁▅<span class="ansi-green-fg"></span>▅▄▅▄▁▃▄▄▅▁▁▅▄▃▃▁▁▃▃▁▃▁▃▃▁▁▄██████████▇▇▇▆▇▆ █
1.18 μs<span class="ansi-black-intense-fg"> </span><span class="ansi-black-intense-fg">Histogram: </span><span class="ansi-black-intense-fg ansi-bold">log(</span><span class="ansi-black-intense-fg">frequency</span><span class="ansi-black-intense-fg ansi-bold">)</span><span class="ansi-black-intense-fg"> by time</span> 3.51 μs <span class="ansi-bold"><</span>
Memory estimate<span class="ansi-black-intense-fg">: </span><span class="ansi-yellow-fg">7.94 KiB</span>, allocs estimate<span class="ansi-black-intense-fg">: </span><span class="ansi-yellow-fg">1</span>.</code></pre>
</div>
</div>
<div id="b1c443f8" class="cell code" data-execution_count="7">
<div class="sourceCode" id="cb2"><pre
class="sourceCode julia"><code class="sourceCode julia"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="kw">function</span> <span class="fu">printbitsf64</span>(x<span class="op">::</span><span class="dt">Float64</span>)</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> s <span class="op">=</span> <span class="fu">bitstring</span>(x)</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">printstyled</span>(s[<span class="fl">1</span>], color <span class="op">=</span> <span class="op">:</span>blue, reverse<span class="op">=</span><span class="cn">true</span>)</span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">printstyled</span>(s[<span class="fl">2</span><span class="op">:</span><span class="fl">12</span>], color <span class="op">=</span> <span class="op">:</span>green, reverse<span class="op">=</span><span class="cn">true</span>)</span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">printstyled</span>(s[<span class="fl">13</span><span class="op">:</span><span class="kw">end</span>], color<span class="op">=:</span>red, bold<span class="op">=</span><span class="cn">true</span>, reverse<span class="op">=</span><span class="cn">true</span>)</span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">print</span>(<span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>)</span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a><span class="kw">end</span></span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a><span class="fu">printbitsf64</span>(<span class="fl">27.56640625</span>)</span></code></pre></div>
<div class="output stream stdout">
<pre class="ansi"><code class="ansi"><span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">10000000011</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">1011100100010000000000000000000000000000000000000000</span>
</code></pre>
</div>
</div>
<div id="8f3d880c" class="cell code" data-execution_count="8">
<div class="sourceCode" id="cb3"><pre
class="sourceCode julia"><code class="sourceCode julia"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>Eps<span class="op">=</span><span class="fl">0.5</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="cf">while</span> <span class="fl">1</span> <span class="op">!=</span> <span class="fl">1</span> <span class="op">+</span> Eps</span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> Eps<span class="op">/=</span> <span class="fl">2</span></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">printbitsf64</span>(<span class="fl">1</span><span class="op">+</span>Eps)</span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a><span class="cf">end</span></span></code></pre></div>
<div class="output stream stdout">
<pre class="ansi"><code class="ansi"><span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0100000000000000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0010000000000000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0001000000000000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000100000000000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000010000000000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000001000000000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000100000000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000010000000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000001000000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000100000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000010000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000001000000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000100000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000010000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000001000000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000100000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000010000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000001000000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000100000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000010000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000001000000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000100000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000010000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000001000000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000100000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000010000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000001000000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000100000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000010000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000001000000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000100000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000010000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000001000000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000100000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000010000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000001000000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000100000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000010000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000001000000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000100000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000010000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000001000000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000000100000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000000010000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000000001000000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000000000100000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000000000010000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000000000001000</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000000000000100</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000000000000010</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000000000000001</span>
<span class="ansi-default-inverse-fg ansi-blue-bg">0</span><span class="ansi-default-inverse-fg ansi-green-bg">01111111111</span><span class="ansi-default-inverse-fg ansi-red-intense-bg ansi-bold">0000000000000000000000000000000000000000000000000000</span>
</code></pre>
</div>
</div>
<div id="0c1f152a" class="cell code" data-execution_count="13">
<div class="sourceCode" id="cb4"><pre
class="sourceCode julia"><code class="sourceCode julia"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="kw">function</span> <span class="fu">printbits2f64</span>(x<span class="op">::</span><span class="dt">Float64</span>)</span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> s <span class="op">=</span> <span class="fu">bitstring</span>(x)</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a> <span class="fu">printstyled</span>(s[<span class="fl">1</span>], color <span class="op">=</span> <span class="fl">142</span>, reverse<span class="op">=</span><span class="cn">true</span>)</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a> <span class="fu">printstyled</span>(s[<span class="fl">2</span><span class="op">:</span><span class="fl">12</span>], color <span class="op">=</span> <span class="fl">190</span>, reverse<span class="op">=</span><span class="cn">false</span>, underline<span class="op">=</span><span class="cn">true</span>)</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a> <span class="fu">printstyled</span>(s[<span class="fl">13</span><span class="op">:</span><span class="kw">end</span>], color<span class="op">=</span> <span class="fl">27</span>, bold<span class="op">=</span><span class="cn">true</span>, reverse<span class="op">=</span><span class="cn">true</span>)</span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a> <span class="fu">print</span>(<span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>)</span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="kw">end</span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a><span class="fu">printbits2f64</span>(<span class="fl">27.56640625</span>)</span></code></pre></div>
<div class="output stream stdout">
<pre class="ansi"><code class="ansi"><span class="ansi-default-inverse-fg" style="background-color: rgb(175,175,55)">0</span><span class="ansi-underline" style="color: rgb(215,255,55)">10000000011</span><span class="ansi-default-inverse-fg ansi-bold" style="background-color: rgb(55,95,255)">1011100100010000000000000000000000000000000000000000</span>
</code></pre>
</div>
</div>
<div id="a2175725" class="cell code">
<div class="sourceCode" id="cb5"><pre
class="sourceCode julia"><code class="sourceCode julia"></code></pre></div>
</div>
</body>
</html>

184
Example1.ipynb Normal file
View File

@ -0,0 +1,184 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"id": "13bf7a6e",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"BenchmarkTools.Trial: 10000 samples with 10 evaluations.\n",
" Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m1.182 μs\u001b[22m\u001b[39m … \u001b[35m145.397 μs\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m0.00% … 96.62%\n",
" Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m1.277 μs \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m0.00%\n",
" Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m1.789 μs\u001b[22m\u001b[39m ± \u001b[32m 4.410 μs\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m9.23% ± 3.75%\n",
"\n",
" \u001b[39m▄\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m▅\u001b[39m▃\u001b[39m▃\u001b[39m▄\u001b[39m▃\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[32m \u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m▃\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[39m▄\u001b[39m▃\u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▂\n",
" \u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m▇\u001b[39m▆\u001b[39m▆\u001b[39m▆\u001b[39m▁\u001b[39m▅\u001b[32m▄\u001b[39m\u001b[39m▅\u001b[39m▄\u001b[39m▅\u001b[39m▄\u001b[39m▁\u001b[39m▃\u001b[39m▄\u001b[39m▄\u001b[39m▅\u001b[39m▁\u001b[39m▁\u001b[39m▅\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[39m▁\u001b[39m▁\u001b[39m▃\u001b[39m▃\u001b[39m▁\u001b[39m▃\u001b[39m▁\u001b[39m▃\u001b[39m▃\u001b[39m▁\u001b[39m▁\u001b[39m▄\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m▇\u001b[39m▇\u001b[39m▆\u001b[39m▇\u001b[39m▆\u001b[39m \u001b[39m█\n",
" 1.18 μs\u001b[90m \u001b[39m\u001b[90mHistogram: \u001b[39m\u001b[90m\u001b[1mlog(\u001b[22m\u001b[39m\u001b[90mfrequency\u001b[39m\u001b[90m\u001b[1m)\u001b[22m\u001b[39m\u001b[90m by time\u001b[39m 3.51 μs \u001b[0m\u001b[1m<\u001b[22m\n",
"\n",
" Memory estimate\u001b[90m: \u001b[39m\u001b[33m7.94 KiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m1\u001b[39m."
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"using BenchmarkTools\n",
"\n",
"@benchmark sum(rand(1000))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "b1c443f8",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m10000000011\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m1011100100010000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n"
]
}
],
"source": [
"function printbitsf64(x::Float64)\n",
" s = bitstring(x)\n",
" printstyled(s[1], color = :blue, reverse=true)\n",
" printstyled(s[2:12], color = :green, reverse=true)\n",
" printstyled(s[13:end], color=:red, bold=true, reverse=true)\n",
" print(\"\\n\")\n",
"end\n",
"\n",
"printbitsf64(27.56640625)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "8f3d880c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0100000000000000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0010000000000000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0001000000000000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000100000000000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000010000000000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000001000000000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000100000000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000010000000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000001000000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000100000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000010000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000001000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000100000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000010000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000001000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000100000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000010000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000001000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000100000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000010000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000001000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000100000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000010000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000001000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000100000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000010000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000001000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000100000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000010000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000001000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000100000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000010000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000001000000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000100000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000010000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000001000000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000100000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000010000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000001000000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000100000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000010000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000001000000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000000100000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000000010000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000000001000000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000000000100000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000000000010000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000000000001000\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000000000000100\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000000000000010\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000000000000001\u001b[27m\u001b[22m\u001b[39m\n",
"\u001b[34m\u001b[7m0\u001b[27m\u001b[39m\u001b[32m\u001b[7m01111111111\u001b[27m\u001b[39m\u001b[31m\u001b[1m\u001b[7m0000000000000000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n"
]
}
],
"source": [
"Eps=0.5\n",
"while 1 != 1 + Eps\n",
" Eps/= 2\n",
" printbitsf64(1+Eps)\n",
"end"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "0c1f152a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[38;5;142m\u001b[7m0\u001b[27m\u001b[39m\u001b[38;5;190m\u001b[4m10000000011\u001b[24m\u001b[39m\u001b[38;5;27m\u001b[1m\u001b[7m1011100100010000000000000000000000000000000000000000\u001b[27m\u001b[22m\u001b[39m\n"
]
}
],
"source": [
"function printbits2f64(x::Float64)\n",
" s = bitstring(x)\n",
" printstyled(s[1], color = 142, reverse=true)\n",
" printstyled(s[2:12], color = 190, reverse=false, underline=true)\n",
" printstyled(s[13:end], color= 27, bold=true, reverse=true)\n",
" print(\"\\n\")\n",
"end\n",
"\n",
"printbits2f64(27.56640625)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a2175725",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia (4 threads) 1.8.1",
"language": "julia",
"name": "julia-4-threads-1.8"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.8.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

BIN
Example1.pdf Normal file

Binary file not shown.

View File

@ -8,7 +8,8 @@
local css = [[
<!-- CSS added by ANSI escape sequences filter -->
<style>
.ansi {line-height:1; padding:0; margin: 0; letter-spacing:0;font-family:JuliaMono;}
.ansi {line-height:1; padding:0; margin: 0; letter-spacing:0;
overflow:visible;font-family:JuliaMono;}
/* console foregrounds and backgrounds */
pre .ansi-black-fg { color: #3e424d; }

2
make.sh Normal file
View File

@ -0,0 +1,2 @@
pandoc -t pdf --ipynb-output=all --lua-filter=ansi2html.lua -s --katex Example1.ipynb --pdf-engine=xelatex > Example1.pdf
pandoc -t html --ipynb-output=all --lua-filter=ansi2html.lua -s --katex Example1.ipynb > Example1.html