El domingo, 15 de noviembre de 2015, 12:45:11 (UTC-6), Yichao Yu escribió: > > On Sun, Nov 15, 2015 at 1:25 PM, digxx <diger...@hotmail.com <javascript:>> > wrote: > > Is it possible to display the precision of a number to arbitrary > decimals > > points? > > For example if I want to display pi (or any other result) up to 1e6 > > decimals?! > > Note that the BigFloat precision is given in binary digits, not decimal digits, so you have to multiply the 10^6 that you want by log2(10) = 3.32...:
num_binary_digits = ceil(Int, 10^6 * log2(10)) set_bigfloat_precision(num_binary_digits) @time s = string(big(pi)) length(s) The results are 1000003 digits and 0.184317 seconds Of course, actually *displaying* the string takes a lot longer (output is slow).