APL(NARS), 68 chars
r←D w;e;v;⎕FPC
⎕FPC+←4×w⋄e←÷10*w+v←1v
r←2○v⋄→3×⍳e>∣v-r⋄v←r⋄→2
r←w⍕r
//15+23+24+6=68
It seems that is possible approssimate the number c where cos(c)=c, with the succession {x_i} that is build
in this way:
x_1=1 and x_(i+1)=cos(x_i), where lim_(i->+oo)x_i=c.
The D function is the one implement the succession, has argument the decimal precision where decimal
precision is a positive integer number. ⎕FPC would be a local variable that not change outside the
function D, it should represent the precision (in base 2) of the float calculations type'v' of number
we run inside the D function. Because
Ndigits_base_2(Number)=1+⌊Ndigits_base_10(Number) x 3.32192809
I choose the 4 in 4×w in D function, but in other functions that number could not be the right number,
because this speach it seems not right, for some other problem.
Test:
⍪D¨⍳46
0.7
0.73
0.739
0.7390
0.73908
0.739085
0.7390851
0.73908513
0.739085133
0.7390851332
0.73908513321
0.739085133215
0.7390851332151
0.73908513321516
0.739085133215160
0.7390851332151606
0.73908513321516064
0.739085133215160641
0.7390851332151606416
0.73908513321516064165
0.739085133215160641655
0.7390851332151606416553
0.73908513321516064165531
0.739085133215160641655312
0.7390851332151606416553120
0.73908513321516064165531208
0.739085133215160641655312087
0.7390851332151606416553120876
0.73908513321516064165531208767
0.739085133215160641655312087673
0.7390851332151606416553120876738
0.73908513321516064165531208767387
0.739085133215160641655312087673873
0.7390851332151606416553120876738734
0.73908513321516064165531208767387340
0.739085133215160641655312087673873404
0.7390851332151606416553120876738734040
0.73908513321516064165531208767387340401
0.739085133215160641655312087673873404013
0.7390851332151606416553120876738734040134
0.73908513321516064165531208767387340401341
0.739085133215160641655312087673873404013411
0.7390851332151606416553120876738734040134117
0.73908513321516064165531208767387340401341175
0.739085133215160641655312087673873404013411758
0.7390851332151606416553120876738734040134117589
here no round at last digit?... possible i change the mode of print? Yes could be
e←÷10*w+v←1v
It stop the number one digit more the digit
It have to print. For 300 digits Dottie number:
D 300
0.7390851332151606416553120876738734040134117589007574649656806357
7328465488354759459937610693176653184980124664398716302771490
3691308420315780440574620778688524903891539289438845095234801
3356312767722315809563537765724512043734199364335125384097800
34340646700479402143478080271801883771136138204206631
⎕FPC
128
Decimal? \$\endgroup\$ÆẠȷ¡realizes it's invalid. Tries Brachylog; oh no Brachylog doesn't even do floats. \$\endgroup\$x=cos(x)? \$\endgroup\$