Каково различие между операцией плавающей точки одинарной точности и двойной точности?

Возможно, вы захотите попробовать PyDriller , это проще:

for commit in RepositoryMining("path_to_repo", from_commit="STARTING COMMIT").traverse_commits():
    print(commit.msg)

Если вы хотите коммиты определенной ветви, добавьте параметр only_in_branch="BRANCH_NAME". Документы: http://pydriller.readthedocs.io/en/latest/

147
задан Peter Mortensen 17 November 2017 в 22:03
поделиться

6 ответов

Note: the Nintendo 64 does have a 64-bit processor, however:

Many games took advantage of the chip's 32-bit processing mode as the greater data precision available with 64-bit data types is not typically required by 3D games, as well as the fact that processing 64-bit data uses twice as much RAM, cache, and bandwidth, thereby reducing the overall system performance.

From Webopedia:

The term double precision is something of a misnomer because the precision is not really double.
The word double derives from the fact that a double-precision number uses twice as many bits as a regular floating-point number.
For example, if a single-precision number requires 32 bits, its double-precision counterpart will be 64 bits long.

The extra bits increase not only the precision but also the range of magnitudes that can be represented.
The exact amount by which the precision and range of magnitudes are increased depends on what format the program is using to represent floating-point values.
Most computers use a standard format known as the IEEE floating-point format.

From the IEEE standard for floating point arithmetic

Single Precision

The IEEE single precision floating point standard representation requires a 32 bit word, which may be represented as numbered from 0 to 31, left to right.

  • The first bit is the sign bit, S,
  • the next eight bits are the exponent bits, 'E', and
  • the final 23 bits are the fraction 'F':

    S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF
    0 1 8 9 31
    

Значение V, представленное словом, может быть определено следующим образом:

  • Если E = 255 и F не равен нулю, то V = NaN («Не число»)
  • Если E = 255 и F равно нулю и S равно 1, тогда V = -Infinity
  • Если E = 255 и F равно нулю и S равно 0, то V = Бесконечность
  • Если 0 , то V = (- 1) ** S * 2 ** (E-127) * (1.F) где "1.F" предназначен для представления двоичного числа, созданного с помощью префикса F с неявное ведение 1 и двоичная точка.
  • Если E = 0 и F ненулевое, то V = (- 1) ** S * 2 ** (-126) * (0.F) , Эти are "unnormalized" values.
  • If E=0 and F is zero and S is 1, then V=-0
  • If E=0 and F is zero and S is 0, then V=0

In particular,

0 00000000 00000000000000000000000 = 0
1 00000000 00000000000000000000000 = -0

0 11111111 00000000000000000000000 = Infinity
1 11111111 00000000000000000000000 = -Infinity

0 11111111 00000100000000000000000 = NaN
1 11111111 00100010001001010101010 = NaN

0 10000000 00000000000000000000000 = +1 * 2**(128-127) * 1.0 = 2
0 10000001 10100000000000000000000 = +1 * 2**(129-127) * 1.101 = 6.5
1 10000001 10100000000000000000000 = -1 * 2**(129-127) * 1.101 = -6.5

0 00000001 00000000000000000000000 = +1 * 2**(1-127) * 1.0 = 2**(-126)
0 00000000 10000000000000000000000 = +1 * 2**(-126) * 0.1 = 2**(-127) 
0 00000000 00000000000000000000001 = +1 * 2**(-126) * 
                                     0.00000000000000000000001 = 
                                     2**(-149)  (Smallest positive value)

Double Precision

The IEEE double precision floating point standard representation requires a 64 bit word, which may be represented as numbered from 0 to 63, left to right.

  • The first bit is the sign bit, S,
  • the next eleven bits are the exponent bits, 'E', and
  • the final 52 bits are the fraction 'F':

    S EEEEEEEEEEE FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    0 1 11 12 63
    

The value V represented by the word may be determined as follows:

  • If E=2047 and F is nonzero, then V=NaN ("Not a number")
  • If E=2047 and F is zero and S is 1, then V=-Infinity
  • If E=2047 and F is zero and S is 0, then V=Infinity
  • If 0 then V=(-1)**S * 2 ** (E-1023) * (1.F) where "1.F" is intended to represent the binary number created by prefixing F with an implicit leading 1 and a binary point.
  • If E=0 and F is nonzero, then V=(-1)**S * 2 ** (-1022) * (0.F) These are "unnormalized" values.
  • If E=0 and F is zero and S is 1, then V=-0
  • If E=0 and F is zero and S is 0, then V=0

Reference:
ANSI/IEEE Standard 754-1985,
Standard for Binary Floating Point Arithmetic.

198
ответ дан 23 November 2019 в 22:36
поделиться

Single precision number uses 32 bits, with the MSB being sign bit, whereas double precision number uses 64bits, MSB being sign bit

Single precision

SEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFF.(SIGN+EXPONENT+SIGNIFICAND)

Double precision:

SEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.(SIGN+EXPONENT+SIGNIFICAND)

-3
ответ дан 23 November 2019 в 22:36
поделиться

Okay, the basic difference at the machine is that double precision uses twice as many bits as single. In the usual implementation,that's 32 bits for single, 64 bits for double.

But what does that mean? If we assume the IEEE standard, then a single precision number has about 23 bits of the mantissa, and a maximum exponent of about 38; a double precision has 52 bits for the mantissa, and a maximum exponent of about 308.

The details are at Wikipedia, as usual.

17
ответ дан 23 November 2019 в 22:36
поделиться

Относительно вопроса "Могут ли ps3 и xbxo 360 выполнять операции с плавающей запятой двойной точности или только одинарную точность, и при общем использовании используются возможности двойной точности (если они существуют?) "

Я полагаю, что обе платформы неспособны к двойной плавающей запятой. Оригинальный процессор Cell имел только 32-разрядные числа с плавающей запятой, то же самое с аппаратным обеспечением ATI, на котором основан XBox 360 (R600). Позже Cell получил двойную поддержку с плавающей запятой, но я уверен, что PS3 не использует этот чип.

6
ответ дан 23 November 2019 в 22:36
поделиться

Basically single precision floating point arithmetic deals with 32 bit floating point numbers whereas double precision deals with 64 bit.

The number of bits in double precision increases the maximum value that can be stored as well as increasing the precision (ie the number of significant digits).

4
ответ дан 23 November 2019 в 22:36
поделиться

Двойная точность означает, что для хранения чисел требуется вдвое больше слова. На 32-битном процессоре все слова 32-битные, поэтому двойные 64-битные. С точки зрения производительности это означает, что для выполнения операций с числами двойной точности требуется немного больше времени. Таким образом, вы получаете лучший диапазон, но это незначительно сказывается на производительности. Этот удар немного смягчается аппаратными модулями с плавающей запятой, но он все еще там.

N64 использовал 64-битный процессор на базе MIPS R4300i, который представляет собой 64-битный процессор, , но процессор связывается с остальными системы через 32-битную шину. Таким образом, большинство разработчиков использовали 32-битные числа, потому что они быстрее, и большинство игр в то время не нуждались в дополнительной точности (поэтому они использовали числа с плавающей точкой, а не двойные).

Все три системы могут выполнять операции с плавающей запятой одинарной и двойной точности, но это может быть связано не с производительностью. (хотя почти все после n64 использовало 32-битную шину, так что ...)

1
ответ дан 23 November 2019 в 22:36
поделиться
Другие вопросы по тегам:

Похожие вопросы: