File:Binade.svg

From testwiki
Jump to navigation Jump to search
    Original file (SVG file, nominally 218 × 59 pixels, file size: 18 KB)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: An axis with ticks marking the floating-point numbers between 0 and 1 with 3 bits of precision and a minimum exponent of -5, with the binade of exponent -2 highlighted
    Date
    Source Own work
    Author Taylor Riastradh Campbell

    Source code

    \documentclass{standalone}
    
    \usepackage{tikz}
    
    \usetikzlibrary{decorations.pathreplacing}
    
    
    \newcommand{\emin}{-5}
    \newcommand{\eminplusone}{-4}
    \newcommand{\emax}{6}
    \newcommand{\p}{3}
    \newcommand{\fmax}{3}           % 2^(\p - 1) - 1
    
    
    \begin{document}
    
    \begin{tikzpicture}[x=15em,y=2em]
    
    % zero
    \draw (0,0) -- (0,1.5ex) node[above] {$\mathstrut 0$};
    
    % subnormal
    \foreach \f in {1, ..., \fmax} {
      \pgfmathsetmacro\x{(0 + \f/2^(\p - 1)) * 2^\emin}
      \draw (\x,0) -- (\x,1ex);
    }
    
    % normal
    \foreach \e in {\emin, ..., -1} {
      \pgfmathsetmacro\x{(1 + 0/2^(\p - 1)) * 2^\e}
      \draw (\x,0) -- (\x,1.5ex);
      \foreach \f in {1, ..., \fmax} {
        \pgfmathsetmacro\x{(1 + \f/2^(\p - 1)) * 2^\e}
        \draw (\x,0) -- (\x,1ex);
      }
    }
    
    % label tick at 1/2
    \node[above] at (0.5,1.5ex) {$\mathstrut 1/2$};
    
    % one
    \draw (0.5,0) -- (0.5,1ex);
    \draw (1,0) -- (1,1.5ex) node[above] {$\mathstrut 1$};
    
    % axis
    \draw[<->] (-0.0625,0) -- (1.1,0);
    
    % highlight binade [2^{-2}, 2^{-1})
    \draw[decorate, decoration={brace}, below=1ex, thick]
      ({(1 + \fmax/2^(\p - 1) + 1/2^(\p + 1))*2^(-2)}, 0)
      -- ({(1 + 0/2^(\p - 1) - 1/2^(\p + 1))*2^(-2)}, 0)
      node[pos=0.5, below=0.5ex] {$\mathstrut {+}1.xy \times 2^{-2}$};
    
    \end{tikzpicture}
    
    \end{document}
    

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    24 October 2023

    image/svg+xml

    c0e01b9dfed7eb89a82d5b35b501c6aa8c5f13d9

    18,938 byte

    59 pixel

    218 pixel

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current20:33, 24 October 2023Thumbnail for version as of 20:33, 24 October 2023218 × 59 (18 KB)wikimediacommons>Taylor Riastradh CampbellUploaded while editing "Binade" on en.wikipedia.org

    There are no pages that use this file.