PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Das Floating-Point Format im Detail


GloomY
2004-04-15, 21:28:55
Öff, warum sind denn das 13 (!) Seiten? :???: :o

Ich hab' jetzt erstmal ein bisschen mehr als die erste halbe Seite: The floating-point format in detail

Introduction

Floating-point numbers gain more and more importance in the range of graphics and terms like "FP24" and "FP32" are widely spread and well-known. But what does "Floating Point" mean exactly? It is clear that i.e. FP24 is a 24 bit number in floating point format. We want to examine what this concretely means in a three part article series.

First of all we will address the issue of integer and fix point representation. This "preparatory work" is necessary to allow for comparison of other common data types. Afterwards, we will look at the floating point numbers and explain how those formats are represented in hardware. With help of the FP16 example, we will form the basic principles in order to deepen interesting aspects and to take a look at FP24 up to FP80 formats. We will only cover negligibly the issues of how to compute with FP-numbers or what types of circuits are necessary to realise those calculations. Our goal is to provide the basic understanding, not a course in circuitry.

Mostly, we will use english terms (comment from translator: of course ;-) , but remember that the original article was written in German), particularly if those are common terms. That seemed to be more useful for us than spasmodically invent new (German) words. Numerical values in examples are mostly rounded to three digits, without additionally mentioning that rounding was used. If you like you may calculate yourself, if not rounded values should suffice.

The Byte - a basic format

In the 1980s, most homecomputers are based on 8 bit technology, whereas the first IBM-PCs were internally working with 16 bit word length after all. 16 bit word length means that data is being devided and processed in chunks of 16 bits. However, due to compatibility reasons 8 bit registers can still be used, even nowadays. Eight bit = one Byte, and this Byte is the base unit for storage capacity measurement. One bit can be in either two states: 0 or 1. With 8 bit (= 1 Byte) it is possible to encode 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 = 2^8 = 256 different states. Usually, those states are encoded to the number range of 0 to 255.

At the same time the stored number can be calculated on the basis of the bit pattern. This property is very important because the number format should imply the ability to compute with it. It is possible to draft relatively simple circuits with this "direct" storage, whereas other encoded representations require more complex circuits, which we will see shortly.

Within a byte, every of the eight bits is being assigned a valence. From right to left those valences are 1 - 2 - 4 - 8 - 16 - 32 - 64 - 128. With every digit the valence is doubled (which can be expressed by the sequence of powers of two: 2^0, 2^1, 2^2 and so on until 2^7). Adding the valance for alle digits if a bit is set, the corresponding sum is the number which is represented by the bit pattern. What looks at first glance like weired calculations, is nothing else than the "natural" representation of binary numbers. Encoding for example the decimal number 97 the second digit from left has the valence 10, therewith the result is 9*10 + 7*1 = 90 + 7 = 97. In the field of computers it is necessary to think in binary, that means taking 2 as basis.

Ich mach' hier erstmal Schluss, weil ich was essen gehe. Ansonsten muss ich gestehen, dass ich die Kommaregeln des Englischen vergessen habe. Wie war das nochmal mit den erforderlichen und nicht erfoderlichen Relativsätzen? (definig and non-defining relative clauses)?

KillerCookie
2004-04-17, 00:28:39
noch ein artikel??? könnten wir nicht erstmal den 30 - seiten artikel durcharbeiten? wenn wir wieder 2 oder 3 anfangen wird sowieso wieder nix fertig... bitte hilf doch erstmal bei dem über den nv40 mit, da dieser zur zeit sicher sehr gefragt ist.

MfG Maik

aths
2004-04-19, 08:59:00
Ich freue mich jedenfalls, wenn der FP-Artikel endlich angegangen wird :) Für Rückfragen stehe ich in diesem Thread natürlich zur Verfügung.

GloomY
2004-04-20, 01:50:26
Original geschrieben von Jason15
noch ein artikel??? könnten wir nicht erstmal den 30 - seiten artikel durcharbeiten? wenn wir wieder 2 oder 3 anfangen wird sowieso wieder nix fertig... bitte hilf doch erstmal bei dem über den nv40 mit, da dieser zur zeit sicher sehr gefragt ist.

MfG Maik Okay :)

aths
2004-05-03, 20:14:44
Original geschrieben von GloomY
Okay :) Fahnenflucht??

GloomY
2004-05-05, 23:27:41
Original geschrieben von aths
Fahnenflucht?? Ich nenne es mal temporäre Fahnenflucht :D

Ich möchte den Artikel irgendwann natürlich auch zu Ende bringen, aber momentan liegen die Prioritäten woanders.

GloomY
2004-08-10, 02:44:37
Ich nenne es mal temporäre Fahnenflucht :D

Ich möchte den Artikel irgendwann natürlich auch zu Ende bringen, aber momentan liegen die Prioritäten woanders.Hmm, da war doch mal was ;)


FX8 - The basis for color information

Now we take a look at a number format where the encoding is based on the unsigned byte (C syntax: unsigned char) but whose range of values is not from 0 to 255 but from 0.0 to 1.0 . Now, a "direct" assignment of digits to the number value is no longer given. A Byte, which we will alienate for the representation of the range from 0.0 to 1.0, specifies a 1/255th of the number.
We will name this format "FX8" ("Fixpoint 8 Bit"). Actually, this name is assigned to another rare 8 Bit format, but because there is no official nomenclature we choose this for us meaningful name for our purposes.

While the ALU can pretend with addition and subtraction as if the FX8-values were actually in Byte-format, multiplications must be payed more attention to: 1 * 1 equals 1. "1" is being encoded as "255" in Byte-format. Thus, the calculation is in Byte-format: "255" * "255" = "255" (and not "65025"). For MUL (multiplication) it is therefore not possible to reuse integer logic when calculation FX8 values.

We will by the way deal only with ADD, SUB (addition and substraction) and MUL. This is because DIV (division) is mostly executed internally with a combination of REPR (reciprocal) and MUL. Instead of calculation x / 5 , x is multiplied with (1/5). "Real" DIV-Units would be very expensive for the transistor-budget. Reciprocal calculations are needed for some purposes anyway, that's why these are used for DIV calculations.

Back to the MUL-topic. 1 * 1 must be 1 and in FX8 1.0 is coded as 1111'1111 (to simplify the enumeration the bits are presented in 4-Bit groups, also called nibbles). The calculation for 1 * 1 in FX8 looks in binary: 1111'1111 * 1111'1111 = 1111'1110'0000'0001. Taking the first eight bits from the result, it is 1111'1110, which is 254 / 255 = 0,996. The alpha blending units of the R300 actually compute this way and provide tendentially too small values. One Bit discrepancy is usually not a problem. If this happens multiple times, it will result in too dark colors. In order to calculate correctly, the result must be added by the most left bit. 1111'1110 + 1 results the correct number 1111'1111. We note this in order to make clear that the use of the FX8-format is less trivial than initially expected.

With FX8 there is the problem that the value 0.5 cannot be represented exactly. "127" is equivalent to 127/255 = 0.498 and "128" equals 128/255 = 0.502. However, because the Byte is very "handy" to the hardware and the resolution of 256 steps is sufficient for many purposes this representation is fairly widespreaded. For example, this includes the storage of color information in the frame buffer or in textures: Every base color of the additive color blending - that is red, green and blue - is each allocated 8 bits. Three color channel with each 8 bits = 24 bit color. That is 2^24 = 16777216 viewable colors. Apparently, more than enough.

Indeed, the human eye can only differ in some hundred colors, but in return for million steps of brightness! As with 24 bit color format every base color channel has only 256 steps, a problem occurs: There are many thousand colors representable, but only hundred brightness steps. On the one hand there is a finer graduation than the eye can read, on the other hand there is a lack of resolution. But because the 24 bit RGB format is suitable for calculations and the precision is sufficient for most cases, it has become accepted. For that purpose it is important to take a look at the range at which critical brightness graduations can be observed. Only if a graduation from black to white is wider than 256 pixel the rather too rough brightness graduation can be observed. In practice one mostly deals with smaller ranges.

For storage a FX8-value per base color is generally sufficient. If the color values are used in calculations, new rounding errors occur with virtually every new calculation. In the end, the result noticeably varies from the "true" value. But before needing higher precision, there is oftens the need for calculations in a larger number range, i.e. negative numbers.Das schlimmste sind die Passiv-Sätze im Deutschen: "Man muss..." oder "Es muss berücksichtigt werden,..."

btw: "Was ist "Farbverlauf" im Englischen? "color graduation"? :???:


Aber der Umfang des Artikels ist echt "Hell on earth"! :| Ich weiss nicht, ob ich den jemals alleine fertig bekomme... :| Weisst du, wie lange ich an dieser halben Seite gesessen bin?

Boah, war das schlecht gestern nacht. Ich habe gerade nochmal einige Stellen ausgebessert...

{Alone}
2004-08-11, 00:15:07
Farbverlauf = color gradient

aths
2004-08-12, 04:53:44
Der Artikel ist vom Umfang her wohl zu groß, als dass er von einem Mann übersetzt werden kann.

U. U. wird es mal einen Artikel zum Thema geben, ob Partial Precision ausreicht, dieser Artikel würde auf jeden Fall deutlich kürzer.

GloomY
2004-08-12, 16:33:48
Der Artikel ist vom Umfang her wohl zu groß, als dass er von einem Mann übersetzt werden kann.Meinst du, dass es dann überhaupt Sinn ergibt, wenn ich mich dann alleine da ranwage?

Wenn mir langweilig wäre ok, aber eigentlich hab' ich doch noch anderes zu tun...


btw: Danke, Alone :)

{Alone}
2004-08-12, 21:34:13
Evtl. könnte ich etwas Unterstützung leisten; ob dies eine Hilfe wäre ist die andere Frage, da mir das entsprechende Fach- und Hintergrundwissen fehlt, was für diesen Artikel wohl eminent ist.

BlackBirdSR
2004-08-15, 14:26:03
Meinst du, dass es dann überhaupt Sinn ergibt, wenn ich mich dann alleine da ranwage?

Wenn mir langweilig wäre ok, aber eigentlich hab' ich doch noch anderes zu tun...


btw: Danke, Alone :)

Um mal ganz erhlich zu sein, ich glaube es nicht.
Das ist keine Kritik an dir, da ich genau weiss wie schwer sowas ist;
Aber das ganze ließt sich für einen native speaker doch sehr entfremdet.

Das Problem liegt im Umfang des Ganzen. Keiner kann von dir verlangen einen flüssigen und attraktiven Stil über mehrere Seiten durchzuhalten.
Wenn du dir die Arbeit machst, und das Ganze am Ende doch übersetzt, wer stellt sich zur Verfügung, das Ganze nochmal gegenzukorrigeren?
Und das wäre einfach nötig, da egal wie gut der Übersetzer, einem Unbeteiligtem versch. Tonlagen, Satzkonstrukte und Unstimmigkeiten besser aufallen.