Minkowski question-mark function: Difference between revisions

Content deleted Content added
Rdm (talk | contribs)
J: it's not ieee 754 representation, it's the algorithm
Rdm (talk | contribs)
m J: make it easier to experiment with longer continued fractions (though it's not clear that this length should match for minkowski and its inverse)
Line 469:
Implementation:
 
<lang J>minkowskiITERCOUNT=: {{52
 
minkowski=: {{
f=. 1|y
node=. *i.2 2 NB. node of Stern-Brocot tree
B=.''
for.i.52ITERCOUNT do.
B=.B, b=. f>:%/t=. +/node
node=. t (1-b)} node
end.
(<.y)+B+/ .*22x^-1+i.52ITERCOUNT
}}
 
Line 485 ⟶ 487:
cur=. 0 NB. 1 if generating "top" side of cf
cnt=. 1 NB. bits
for.i.52ITERCOUNT do.
if. f=<. f do.
cf=. cf,%cnt break.