On Thursday, May 14, 2015 at 1:25:44 PM UTC-4, Stefan Karpinski wrote:
>
> 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.
>
>
I think the right thing would be for log(b,x) to first promote its
arguments to the same type. Otherwise, you run into the problem here
where you have a spurious loss of accuracy. I'll file a PR.