Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
julia round函数是否包含大数错误?_Julia_Precision_Biginteger_Digits_Arbitrary Precision - Fatal编程技术网

julia round函数是否包含大数错误?

julia round函数是否包含大数错误?,julia,precision,biginteger,digits,arbitrary-precision,Julia,Precision,Biginteger,Digits,Arbitrary Precision,julia round函数在阶乘(75)之前似乎工作正常,但在阶乘76处中断。这是一个全面的错误吗 julia>round(factorial(big(75)), sigdigits=2) 2.5e+109 julia>round(factorial(big(76)), sigdigits=2) 1.900000000000000000000000000000000000000000000000000000000000000000000000000006e+111 您必须提高Bi

julia round函数在阶乘(75)之前似乎工作正常,但在阶乘76处中断。这是一个全面的错误吗

julia>round(factorial(big(75)), sigdigits=2)
2.5e+109

julia>round(factorial(big(76)), sigdigits=2)
1.900000000000000000000000000000000000000000000000000000000000000000000000000006e+111

您必须提高
BigFloat
计算的精度才能得到正确的结果,例如:

julia> setprecision(1000) do
       round(factorial(big(76)), sigdigits=2)
       end
1.9e+111

问题的根源是,当四舍五入时,Julia将
{base}^{number of digits to round}
表示为适当的浮点。在这种情况下,它是
BigFloat(10)^-110
,在默认情况下,精度不足以满足所需的位数。

这是一个很好的答案,准确地解释了我的问题。