| Alternative 1 | |
|---|---|
| Accuracy | 99.1% |
| Cost | 6592 |
\[\log \left(\frac{2}{x}\right)
\]
(FPCore (x) :precision binary64 (log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))
(FPCore (x) :precision binary64 (log (+ (* -0.5 x) (* 2.0 (/ 1.0 x)))))
double code(double x) {
return log(((1.0 / x) + (sqrt((1.0 - (x * x))) / x)));
}
double code(double x) {
return log(((-0.5 * x) + (2.0 * (1.0 / x))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = log(((1.0d0 / x) + (sqrt((1.0d0 - (x * x))) / x)))
end function
real(8) function code(x)
real(8), intent (in) :: x
code = log((((-0.5d0) * x) + (2.0d0 * (1.0d0 / x))))
end function
public static double code(double x) {
return Math.log(((1.0 / x) + (Math.sqrt((1.0 - (x * x))) / x)));
}
public static double code(double x) {
return Math.log(((-0.5 * x) + (2.0 * (1.0 / x))));
}
def code(x): return math.log(((1.0 / x) + (math.sqrt((1.0 - (x * x))) / x)))
def code(x): return math.log(((-0.5 * x) + (2.0 * (1.0 / x))))
function code(x) return log(Float64(Float64(1.0 / x) + Float64(sqrt(Float64(1.0 - Float64(x * x))) / x))) end
function code(x) return log(Float64(Float64(-0.5 * x) + Float64(2.0 * Float64(1.0 / x)))) end
function tmp = code(x) tmp = log(((1.0 / x) + (sqrt((1.0 - (x * x))) / x))); end
function tmp = code(x) tmp = log(((-0.5 * x) + (2.0 * (1.0 / x)))); end
code[x_] := N[Log[N[(N[(1.0 / x), $MachinePrecision] + N[(N[Sqrt[N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Log[N[(N[(-0.5 * x), $MachinePrecision] + N[(2.0 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
\log \left(-0.5 \cdot x + 2 \cdot \frac{1}{x}\right)
Results
Initial program 100.0%
Taylor expanded in x around 0 99.6%
Final simplification99.6%
| Alternative 1 | |
|---|---|
| Accuracy | 99.1% |
| Cost | 6592 |
herbie shell --seed 2023146
(FPCore (x)
:name "Hyperbolic arc-(co)secant"
:precision binary64
(log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))