diff --git a/tikz/ieee-754-float/Makefile b/tikz/ieee-754-float/Makefile new file mode 100644 index 0000000..fe5430d --- /dev/null +++ b/tikz/ieee-754-float/Makefile @@ -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 diff --git a/tikz/ieee-754-float/README.md b/tikz/ieee-754-float/README.md new file mode 100644 index 0000000..5861171 --- /dev/null +++ b/tikz/ieee-754-float/README.md @@ -0,0 +1,3 @@ +Compiled example +---------------- +![Example](ieee-754-float.png) diff --git a/tikz/ieee-754-float/ieee-754-float.png b/tikz/ieee-754-float/ieee-754-float.png new file mode 100644 index 0000000..25c8f9e Binary files /dev/null and b/tikz/ieee-754-float/ieee-754-float.png differ diff --git a/tikz/ieee-754-float/ieee-754-float.tex b/tikz/ieee-754-float/ieee-754-float.tex new file mode 100644 index 0000000..ef50751 --- /dev/null +++ b/tikz/ieee-754-float/ieee-754-float.tex @@ -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}