Re[9]: 42 битное число!!
От: Andrew S Россия http://alchemy-lab.com
Дата: 01.07.04 13:48
Оценка:
AS>>>>Распределение вещественных чисел, представляемых флоат (да и любым числом с плавающей точкой) на множестве вещественных чисел, неравномерно. Наиболее плотно числа представлены (отбросив знак) в районе единицы, далее, ближе к границам диапазона — значительно более разрежено. Т.е. далеко не все целые числа из диапазона флоата можно с точностью до +-0.5 им представить.
T>>>Наиболее плотно — в районе нуля

AS>>С чего это? Флоат хранится в нормализованом виде с неявной единицой.

T>Спорить не буду. Но мне всегда казалось, что от -0.1 до 0.1 флоатов больше, чем от 0.9 до 1.1. Но если окажется, что это не так, то я не очень расстроюсь.

Ну, значит вам таки надо будет хоть немного, но расстроиться
http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html


In order to maximize the quantity of representable numbers, floating-point numbers are typically stored in normalized form. This basically puts the radix point after the first non-zero digit. In normalized form, five is represented as 5.0 x 10^0.

A nice little optimization is available to us in base two, since the only possible non-zero digit is 1. Thus, we can just assume a leading digit of 1, and don't need to represent it explicitly. As a result, the mantissa has effectively 24 bits of resolution, by way of 23 fraction bits.

Putting it All Together
So, to sum up:


The sign bit is 0 for positive, 1 for negative.
The exponent's base is two.
The exponent field contains 127 plus the true exponent for single-precision, or 1023 plus the true exponent for double precision.
The first bit of the mantissa is typically assumed to be 1.f, where f is the field of fraction bits.

http://www.rusyaz.ru/pr — стараемся писАть по-русски
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.