| Alternative 1 | |
|---|---|
| Accuracy | 99.2% |
| 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 (* x 0.5))))
double code(double x) {
return log(((1.0 / x) + (sqrt((1.0 - (x * x))) / x)));
}
double code(double x) {
return -log((x * 0.5));
}
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((x * 0.5d0))
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((x * 0.5));
}
def code(x): return math.log(((1.0 / x) + (math.sqrt((1.0 - (x * x))) / x)))
def code(x): return -math.log((x * 0.5))
function code(x) return log(Float64(Float64(1.0 / x) + Float64(sqrt(Float64(1.0 - Float64(x * x))) / x))) end
function code(x) return Float64(-log(Float64(x * 0.5))) end
function tmp = code(x) tmp = log(((1.0 / x) + (sqrt((1.0 - (x * x))) / x))); end
function tmp = code(x) tmp = -log((x * 0.5)); 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[(x * 0.5), $MachinePrecision]], $MachinePrecision])
\log \left(\frac{1}{x} + \frac{\sqrt{1 - x \cdot x}}{x}\right)
-\log \left(x \cdot 0.5\right)
Results
Initial program 99.6%
Taylor expanded in x around 0 99.3%
Applied egg-rr99.7%
[Start]99.3 | \[ \log \left(\frac{2}{x}\right)
\] |
|---|---|
clear-num [=>]99.3 | \[ \log \color{blue}{\left(\frac{1}{\frac{x}{2}}\right)}
\] |
log-div [=>]99.7 | \[ \color{blue}{\log 1 - \log \left(\frac{x}{2}\right)}
\] |
metadata-eval [=>]99.7 | \[ \color{blue}{0} - \log \left(\frac{x}{2}\right)
\] |
div-inv [=>]99.7 | \[ 0 - \log \color{blue}{\left(x \cdot \frac{1}{2}\right)}
\] |
metadata-eval [=>]99.7 | \[ 0 - \log \left(x \cdot \color{blue}{0.5}\right)
\] |
Simplified99.7%
[Start]99.7 | \[ 0 - \log \left(x \cdot 0.5\right)
\] |
|---|---|
neg-sub0 [<=]99.7 | \[ \color{blue}{-\log \left(x \cdot 0.5\right)}
\] |
Final simplification99.7%
| Alternative 1 | |
|---|---|
| Accuracy | 99.2% |
| Cost | 6592 |
herbie shell --seed 2023157
(FPCore (x)
:name "Hyperbolic arc-(co)secant"
:precision binary64
(log (+ (/ 1.0 x) (/ (sqrt (- 1.0 (* x x))) x))))