# Float

From Avisynth wiki

(Difference between revisions)

Line 13: | Line 13: | ||

Examples: | Examples: | ||

− | 0x3F800000 = 00111111100000000000000000000000 (binary, see [http://easycalculation. | + | 0x3F800000 = 00111111100000000000000000000000 (binary, see [http://easycalculation.com/hex-converter.php]) |

Sign Bit Exp 1.Mantissa | Sign Bit Exp 1.Mantissa |

## Revision as of 00:46, 24 June 2014

Float (or fully IEEE floating point with single precision) is one of the samples types of AviSynth's audio. For a converter see here.

The samples of this type have values between -1.00000 (= 0xBF800000) and 1.000000 (= 0x3F800000).

The value of such a IEEE-754 number is computed as: sign * 2^exponent * 1.mantissa, using the following scheme:

[ 1 Sign Bit | 8 Bit Exponent | 23 Bit Mantissa ]

- The sign bit is 1 (negative) or 0 (positive).
- The exponent runs from -127 (00000000) to 0 (0111111) to 128 (11111111).
- The mantissa m1m2m3 ... means m1/2 + m2/4 + m3/8 + ... in decimal. Sometimes people denote "1.m1m2m3..." as the mantissa (like is done in the converter above).

Examples:

0x3F800000 = 00111111100000000000000000000000 (binary, see [1]) Sign Bit Exp 1.Mantissa 0 01111111 00000000000000000000000 127 - 127 = 0 1.0 bitshift 0 places Sign bit is positive, exponent = 0, 1.mantissa = 1, so the number is +1.0

and

0xBF800000 = 10111111100000000000000000000000

Sign Bit Exp 1.Mantissa 1 01111111 00000000000000000000000 127 - 127 = 0 1.0 bitshift 0 places Sign bit is negative, exponent = 0, 1.mantissa = 1, so the number is -1.0

source: [2]