Python, 84 bytes
def f(x):
g=i=999;s=1|-(x>1);x=x**s-1
while i:g=i+x*(i*i/g-(i:=i-1))
return x*s/g
Thanks @xnor for -1.
How?
Evaluates a continued fraction https://en.wikipedia.org/wiki/Euler%27s_continued_fraction_formula
def f(x):
g=i=999;s=1|-(x>1);x=x**s-1
while i:g=i+x*(i*i/g-(i:=i-1))
return x*s/g
Evaluates a continued fraction https://en.wikipedia.org/wiki/Euler%27s_continued_fraction_formula