Skip to content

Commit

Permalink
Carmack, Doom, fixed-point arithmetic; etc
Browse files Browse the repository at this point in the history
  • Loading branch information
yurichev committed Feb 1, 2014
1 parent f6757e2 commit 2c0f7ae
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions patterns/12_FPU/main.tex
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\section{\IFRU{Работа с FPU}{Work with FPU}}
\section{\IFRU{Работа с FPU}{Working with FPU}}
\label{sec:FPU}

\newcommand{\FNURLSTACK}{\footnote{\url{http://en.wikipedia.org/wiki/Stack_machine}}}
Expand All @@ -9,33 +9,39 @@ \section{\IFRU{Работа с FPU}{Work with FPU}}
\newcommand{\FNURLEP}{\footnote{\url{http://en.wikipedia.org/wiki/Extended_precision}}}

\ac{FPU}\EMDASH\IFRU{блок в процессоре работающий с числами с плавающей запятой.}
{is a device within main \ac{CPU} specially designed to deal with floating point numbers.}

{is a device within main \ac{CPU} specially designed to deal with floating point numbers.}\\
\\
\IFRU{Раньше он назывался сопроцессором. Он немного похож на программируемый калькулятор и
стоит немного в стороне от \ac{CPU}.}
{It was called coprocessor in past.
It stay aside of the main \ac{CPU} and looks like programmable calculator
in some way and.}

in some way and.}\\
\\
\IFRU{Перед изучением \ac{FPU} полезно ознакомиться с тем как работают стековые машины\FNURLSTACK,
или ознакомиться с основами языка Forth\FNURLFORTH.}
{It is worth to study stack machines\FNURLSTACK{} before \ac{FPU} studying, or learn Forth language basics\FNURLFORTH.}

{It is worth to study stack machines\FNURLSTACK{} before \ac{FPU} studying, or learn Forth language basics\FNURLFORTH.}\\
\\
\index{x86!80486}
\index{x86!FPU}
\IFRU{Интересен факт, что в свое время (до 80486) сопроцессор был отдельным чипом на материнской плате,
и вследствие его высокой цены, он стоял не всегда. Его можно было докупить отдельно и поставить.}
и вследствие его высокой цены, он стоял не всегда. Его можно было докупить отдельно и поставить}
{It is interesting to know that in past (before 80486 CPU) coprocessor was a separate chip
and it was not always settled on motherboard. It was possible to buy it separately and install.}

\IFRU{Начиная с процессора 80486, FPU уже всегда входит в его состав.}
{Starting at 80486 CPU, FPU is always present in it.}

and it was not always settled on motherboard. It was possible to buy it separately and install}
\footnote{\IFRU{Например, Джон Кармак использовал в своей игре Doom числа с фиксированной запятой, хранящиеся
в обычных 32-битных \ac{GPR} (16 бит на целую часть и 16 на дробную),
чтобы Doom работал на 32-битных компьютерах без FPU, т.е., 80386 и 80486 SX}{
For example, John Carmack used fixed-point arithmetic values in his Doom video game, stored in
32-bit \ac{GPR} registers (16 bit for intergral part and another 16 bit for fractional part), so the Doom
could work on 32-bit computer without FPU, i.e., 80386 and 80486 SX}}.\\
\\
\IFRU{Начиная с процессора 80486 DX, FPU уже всегда входит в его состав.}
{Starting at 80486 DX CPU, FPU is always present in it.}\\
\\
\index{IEEE 754}
\IFRU{FPU имеет стек из восьми 80-битных регистров, каждый может содержать число в формате IEEE 754\FNURLIEEE.}
{FPU has a stack capable to hold 8 80-bit registers, each register can hold a number
in IEEE 754\FNURLIEEE format.}

in IEEE 754\FNURLIEEE format.}\\
\\
\index{float}
\index{double}
\IFRU\CCpp имеются два типа для работы с числами с плавающей запятой,
Expand All @@ -46,21 +52,21 @@ \section{\IFRU{Работа с FPU}{Work with FPU}}
{\CCpp language offer at least two floating number types, \Tfloat (\IT{single-precision}\FNURLSP, 32 bits)
\footnote{single precision float numbers format is also addressed in
the \IT{\WorkingWithFloatAsWithStructSubSubSectionName}~(\ref{sec:floatasstruct}) section}
and \Tdouble (\IT{double-precision}\FNURLDP, 64 bits).}

and \Tdouble (\IT{double-precision}\FNURLDP, 64 bits).}\\
\\
\index{long double}
\IFRU{GCC также поддерживает тип \IT{long double} (\IT{extended precision}\FNURLEP, 80 бит), но MSVC ~--- нет.}
{GCC also supports \IT{long double} type (\IT{extended precision}\FNURLEP, 80 bit) but MSVC is not.}

{GCC also supports \IT{long double} type (\IT{extended precision}\FNURLEP, 80 bit) but MSVC is not.}\\
\\
\IFRU{Не смотря на то что \Tfloat занимает столько же места сколько \Tint на 32-битной архитектуре,
представление чисел, разумеется, совершенно другое.}
{\Tfloat type requires the same number of bits as \Tint type in 32-bit environment,
but number representation is completely different.}

but number representation is completely different.}\\
\\
\IFRU{Число с плавающей точкой состоит из знака, мантиссы\footnote{\IT{significand} или \IT{fraction}
в англоязычной литературе} и экспоненты.}
{Number consisting of sign, significand (also called \IT{fraction}) and exponent.}

{Number consisting of sign, significand (also called \IT{fraction}) and exponent.}\\
\\
\IFRU{Функция, имеющая \Tfloat или \Tdouble среди аргументов, получает эти значения через стек.
Если функция возвращает \Tfloat или \Tdouble, она оставляет значение в регистре \STZERO ~--- то есть,
на вершине FPU-стека.}
Expand Down

0 comments on commit 2c0f7ae

Please sign in to comment.