Skip to content

Commit 973cf1b

Browse files
committed
added floating point structure sketch
1 parent 974736b commit 973cf1b

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

text/main/basics/simpleDataTypesAndOperations/float/float.tex

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,19 @@
1616
%
1717
\hsection{How Floating Point Numbers Work}%
1818
\label{sec:howFloatingPointNumbersWork}%
19+
%
20+
\begin{figure}%
21+
\centering%
22+
\includegraphics[width=0.7\linewidth]{\currentDir/floatIEEEStructure}%
23+
\caption{The structure of an 64~bit / double precision IEEE~Standard 754 floating point number~\cite{IEEE2019ISFFPA,H1997IS7FPN}.}%
24+
\label{fig:floatIEEEStructure}%
25+
\end{figure}%
26+
%
1927
With \pythonil{float}, \python\ offers us one type for fractional numbers.
2028
This datatype represents numbers usually in the same format as \pythonil{double}s in the \pgls{C}~programming language~\cite{PSF2024NTIFC}, which, in turn, internally have a 64~bit IEEE~Standard 754 floating point number layout~\cite{IEEE2019ISFFPA,H1997IS7FPN}.
2129

2230
The idea behind this standard is to represent both very large numbers, like~$10^{300}$ and very small numbers, like~$10^{-300}$.
23-
In order to achieve this, the 64~bits are divided into three pieces.
31+
In order to achieve this, the 64~bits are divided into three pieces, as illustrated in \cref{fig:floatIEEEStructure}.
2432

2533
The first part, the so-called \pgls{significand} or \pgls{mantissa}, consists of 52~bits, represents the digits of the number.
2634
52~bits can represent $52\log_2 10\approx 15$~decimal digits, meaning that we can represent numbers to a precision of about 15~digits.
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)