Using the log2 function does what you expect: julia> log2(big(2)^100) 1e+02 with 256 bits of precision
log(b,x) is defined as log(x)./log(b) <https://github.com/JuliaLang/julia/blob/9a47c3b833758c1170ffc428eb6162fdae887111/base/math.jl#L94> whereas log2 makes a direct call to the mpfr_log2 function. I'm not sure if there's a clever way to make this work better besides having cases in the definition of log(b,x) that call log(x), log2(x) and log10(x) when appropriate. On Thu, May 14, 2015 at 12:29 PM, harven <[email protected]> wrote: > There is something I don't understand with bigfloat precision. I have some > task where I need to compute exactly with a thousand significant digit. I > wrote a small benchmark, just by taking a power of two and its logarithm. > > julia> with_bigfloat_precision(10_000) do > log(2,big(2)^100) > end > 1.000000000000000033456773379254076470278870835616524546375 [long > string of random digits] > 9219723375649773e+02 with 10000 bits of precision > > I would have expected to obtain 1.000... with a far better precision (at > least 600 zeros after the point). What I am doing wrong here? >
