Precision arithmetic and factorial overflow

Recall IEEE with double precision arithmetic . Now, what n > 1can binom(n,k)IEEE Double Precision compute for? In addition, in the same interval when intermediate factorial values ​​are overflowed?

In my first question, I found an interval . Not sure if this is true. n < 2^53

+4
source share
1 answer

For this, the ngreatest value is binom(n, k)reached for k = [n/2](the integer part n/2). In order to be binom(n, k)represented in a precision format with double precision, therefore binom(n, [n/2])must be representable.

Listed below are the number of bits (binary digits) required for an accurate representation binom(n, [n/2])(extracted from Wolfram Alpha using queries similar to this one ).

 n       binom(n, [n/2])

56          53 bits
57          54 bits

The following are the binary exponent values ​​for binom(n, [n/2]).

 n       binom(n, [n/2])

1029     1.1... * 2^1023
1030     1.1... * 2^1024

The maximum value nfor which everything binom(n, k)can be accurately represented in a floating point with double precision (53 bit mantissa) is 56.

n, binom(n, k) (11- ) 1029.

n! n = 18 ( ) n = 170 ( ).

+1

Source: https://habr.com/ru/post/1625942/


All Articles