(FPCore (x) :precision binary64 (log (+ x (sqrt (- (* x x) 1.0)))))
(FPCore (x) :precision binary64 (+ (log1p 1.0) (log x)))
double code(double x) {
return log((x + sqrt(((x * x) - 1.0))));
}
double code(double x) {
return log1p(1.0) + log(x);
}
public static double code(double x) {
return Math.log((x + Math.sqrt(((x * x) - 1.0))));
}
public static double code(double x) {
return Math.log1p(1.0) + Math.log(x);
}
def code(x): return math.log((x + math.sqrt(((x * x) - 1.0))))
def code(x): return math.log1p(1.0) + math.log(x)
function code(x) return log(Float64(x + sqrt(Float64(Float64(x * x) - 1.0)))) end
function code(x) return Float64(log1p(1.0) + log(x)) end
code[x_] := N[Log[N[(x + N[Sqrt[N[(N[(x * x), $MachinePrecision] - 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[(N[Log[1 + 1.0], $MachinePrecision] + N[Log[x], $MachinePrecision]), $MachinePrecision]
\log \left(x + \sqrt{x \cdot x - 1}\right)
\mathsf{log1p}\left(1\right) + \log x



Bits error versus x
Results
Initial program 31.3
Simplified31.3
Taylor expanded in x around inf 0.8
Simplified0.8
Applied egg-rr1.1
Applied egg-rr0.8
Final simplification0.8
herbie shell --seed 2022160
(FPCore (x)
:name "Hyperbolic arc-cosine"
:precision binary64
(log (+ x (sqrt (- (* x x) 1.0)))))