mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-19 11:38:05 +02:00
IEEE 754: Add
This commit is contained in:
parent
7796d2304a
commit
26f58d3572
4 changed files with 60 additions and 0 deletions
35
tikz/ieee-754-float/Makefile
Normal file
35
tikz/ieee-754-float/Makefile
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
SOURCE = ieee-754-float
|
||||||
|
DELAY = 80
|
||||||
|
DENSITY = 300
|
||||||
|
WIDTH = 500
|
||||||
|
|
||||||
|
make:
|
||||||
|
pdflatex $(SOURCE).tex -output-format=pdf
|
||||||
|
make clean
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
|
||||||
|
|
||||||
|
gif:
|
||||||
|
pdfcrop $(SOURCE).pdf
|
||||||
|
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
|
||||||
|
make clean
|
||||||
|
|
||||||
|
png:
|
||||||
|
make
|
||||||
|
make svg
|
||||||
|
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
|
||||||
|
|
||||||
|
transparentGif:
|
||||||
|
convert $(SOURCE).pdf -transparent white result.gif
|
||||||
|
make clean
|
||||||
|
|
||||||
|
svg:
|
||||||
|
make
|
||||||
|
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
|
||||||
|
pdf2svg $(SOURCE).pdf $(SOURCE).svg
|
||||||
|
# Necessary, as pdf2svg does not always create valid svgs:
|
||||||
|
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
|
||||||
|
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
|
||||||
|
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
|
||||||
|
rm $(SOURCE)2.svg
|
3
tikz/ieee-754-float/README.md
Normal file
3
tikz/ieee-754-float/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Compiled example
|
||||||
|
----------------
|
||||||
|

|
BIN
tikz/ieee-754-float/ieee-754-float.png
Normal file
BIN
tikz/ieee-754-float/ieee-754-float.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
22
tikz/ieee-754-float/ieee-754-float.tex
Normal file
22
tikz/ieee-754-float/ieee-754-float.tex
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
\documentclass{article}
|
||||||
|
\usepackage[pdftex,active,tightpage]{preview}
|
||||||
|
\setlength\PreviewBorder{2mm}
|
||||||
|
|
||||||
|
\usepackage{tikz}
|
||||||
|
\usetikzlibrary{shapes.multipart, calc, decorations.pathreplacing}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\begin{preview}
|
||||||
|
\begin{tikzpicture}[array/.style={rectangle split,rectangle split horizontal, rectangle split parts=#1,draw, anchor=center, rectangle split part fill={blue!20, green!20, blue!20!green!90}}]
|
||||||
|
\node[array=3] (a) {
|
||||||
|
\nodepart{one}0
|
||||||
|
\nodepart{two}01001100
|
||||||
|
\nodepart{three}01001111000000001111111
|
||||||
|
};
|
||||||
|
|
||||||
|
\draw [decoration={brace,raise=2pt},decorate] ($(a.two) + (-0.13,+0.35)$) -- node[above=3pt]{Exponent (8 bit)}($(a.three) + (-0.13,+0.35)$);
|
||||||
|
\draw [decoration={brace,mirror,raise=2pt},decorate] ($(a.three) + (-0.13,-0.14)$) -- node[below=3pt]{Mantissa (23 bit)}(a.south east);
|
||||||
|
\draw [decoration={brace,mirror,raise=2pt},decorate] ($(a.one) + (-0.13,-0.14)$) -- node[below=3pt]{Sign (1 bit)}($(a.two) + (-0.13,-0.15)$);
|
||||||
|
\end{tikzpicture}
|
||||||
|
\end{preview}
|
||||||
|
\end{document}
|
Loading…
Add table
Add a link
Reference in a new issue