Average Error: 0.6 → 0.6
Time: 11.2s
Precision: binary64
Cost: 33472
$\left(10 \leq v \land v \leq 1000000000\right) \land \left(10 \leq x \land x \leq 1000\right)$
$e^{v \cdot \log \left(\frac{x}{v + \sqrt{\left(v + x\right) \cdot \left(v - x\right)}}\right) + \sqrt{\left(v + x\right) \cdot \left(v - x\right)}}$
$\begin{array}{l} t_0 := \sqrt{v \cdot v - x \cdot x}\\ e^{3 \cdot \left(0.3333333333333333 \cdot \mathsf{fma}\left(v, \log \left(\frac{x}{v + t_0}\right), t_0\right)\right)} \end{array}$
(FPCore (v x)
:precision binary64
(exp
(+
(* v (log (/ x (+ v (sqrt (* (+ v x) (- v x)))))))
(sqrt (* (+ v x) (- v x))))))
(FPCore (v x)
:precision binary64
(let* ((t_0 (sqrt (- (* v v) (* x x)))))
(exp (* 3.0 (* 0.3333333333333333 (fma v (log (/ x (+ v t_0))) t_0))))))
double code(double v, double x) {
return exp(((v * log((x / (v + sqrt(((v + x) * (v - x))))))) + sqrt(((v + x) * (v - x)))));
}

double code(double v, double x) {
double t_0 = sqrt(((v * v) - (x * x)));
return exp((3.0 * (0.3333333333333333 * fma(v, log((x / (v + t_0))), t_0))));
}

function code(v, x)
return exp(Float64(Float64(v * log(Float64(x / Float64(v + sqrt(Float64(Float64(v + x) * Float64(v - x))))))) + sqrt(Float64(Float64(v + x) * Float64(v - x)))))
end

function code(v, x)
t_0 = sqrt(Float64(Float64(v * v) - Float64(x * x)))
return exp(Float64(3.0 * Float64(0.3333333333333333 * fma(v, log(Float64(x / Float64(v + t_0))), t_0))))
end

code[v_, x_] := N[Exp[N[(N[(v * N[Log[N[(x / N[(v + N[Sqrt[N[(N[(v + x), $MachinePrecision] * N[(v - x),$MachinePrecision]), $MachinePrecision]],$MachinePrecision]), $MachinePrecision]),$MachinePrecision]], $MachinePrecision]),$MachinePrecision] + N[Sqrt[N[(N[(v + x), $MachinePrecision] * N[(v - x),$MachinePrecision]), $MachinePrecision]],$MachinePrecision]), $MachinePrecision]],$MachinePrecision]

code[v_, x_] := Block[{t$95$0 = N[Sqrt[N[(N[(v * v), $MachinePrecision] - N[(x * x),$MachinePrecision]), $MachinePrecision]],$MachinePrecision]}, N[Exp[N[(3.0 * N[(0.3333333333333333 * N[(v * N[Log[N[(x / N[(v + t$95$0), $MachinePrecision]),$MachinePrecision]], $MachinePrecision] + t$95$0),$MachinePrecision]), $MachinePrecision]),$MachinePrecision]], \$MachinePrecision]]

e^{v \cdot \log \left(\frac{x}{v + \sqrt{\left(v + x\right) \cdot \left(v - x\right)}}\right) + \sqrt{\left(v + x\right) \cdot \left(v - x\right)}}

\begin{array}{l}
t_0 := \sqrt{v \cdot v - x \cdot x}\\
e^{3 \cdot \left(0.3333333333333333 \cdot \mathsf{fma}\left(v, \log \left(\frac{x}{v + t_0}\right), t_0\right)\right)}
\end{array}


# Derivation

1. Initial program 0.6

$e^{v \cdot \log \left(\frac{x}{v + \sqrt{\left(v + x\right) \cdot \left(v - x\right)}}\right) + \sqrt{\left(v + x\right) \cdot \left(v - x\right)}}$
2. Applied egg-rr0.6

$\leadsto e^{\color{blue}{3 \cdot \left(0.3333333333333333 \cdot \mathsf{fma}\left(v, \log \left(\frac{x}{v + \sqrt{v \cdot v - x \cdot x}}\right), \sqrt{v \cdot v - x \cdot x}\right)\right)}}$
3. Final simplification0.6

$\leadsto e^{3 \cdot \left(0.3333333333333333 \cdot \mathsf{fma}\left(v, \log \left(\frac{x}{v + \sqrt{v \cdot v - x \cdot x}}\right), \sqrt{v \cdot v - x \cdot x}\right)\right)}$

# Alternatives

Alternative 1
Error0.6
Cost33216
$\begin{array}{l} t_0 := \sqrt{v \cdot v - x \cdot x}\\ e^{\mathsf{fma}\left(v, \log \left(\frac{x}{v + t_0}\right), t_0\right)} \end{array}$
Alternative 2
Error0.7
Cost27072
$e^{v \cdot \log \left(x \cdot \frac{1}{v + \sqrt{v \cdot v - x \cdot x}}\right) + \sqrt{\left(v + x\right) \cdot \left(v - x\right)}}$
Alternative 3
Error1.8
Cost27012
$\begin{array}{l} t_0 := \sqrt{v \cdot v - x \cdot x}\\ \mathbf{if}\;v \leq 500:\\ \;\;\;\;{\left(\frac{x}{v + t_0}\right)}^{v} \cdot e^{t_0}\\ \mathbf{else}:\\ \;\;\;\;e^{v + \mathsf{fma}\left(v, \log \left(\frac{0.5}{v}\right) + \log x, -0.25 \cdot \frac{x}{\frac{v}{x}}\right)}\\ \end{array}$
Alternative 4
Error0.6
Cost26944
$\begin{array}{l} t_0 := \sqrt{\left(v + x\right) \cdot \left(v - x\right)}\\ e^{t_0 + v \cdot \log \left(\frac{x}{v + t_0}\right)} \end{array}$
Alternative 5
Error5.2
Cost26560
$e^{v + \mathsf{fma}\left(v, \log \left(\frac{0.5}{v}\right) + \log x, -0.25 \cdot \frac{x}{\frac{v}{x}}\right)}$
Alternative 6
Error5.8
Cost20160
$e^{\mathsf{fma}\left(v, \log \left(0.5 \cdot \frac{x}{v}\right), v\right) + -0.5 \cdot \left(x \cdot \frac{x}{v}\right)}$
Alternative 7
Error5.8
Cost20160
$e^{v \cdot \log \left(0.5 \cdot \frac{x}{v}\right) + \mathsf{fma}\left(-0.5, x \cdot \frac{x}{v}, v\right)}$
Alternative 8
Error5.8
Cost13376
$e^{v + v \cdot \log \left(0.5 \cdot \frac{x}{v}\right)}$
Alternative 9
Error61.9
Cost13312
$e^{v} \cdot {\left(0.5 \cdot \frac{x}{v}\right)}^{v}$
Alternative 10
Error64.0
Cost12992
$e^{x \cdot \sqrt{-1}}$

# Reproduce

herbie shell --seed 1
(FPCore (v x)
:name "exp(v * log(x / (v + sqrt((v + x) * (v - x)))) + sqrt((v + x) * (v - x)))"
:precision binary64
:pre (and (and (<= 10.0 v) (<= v 1000000000.0)) (and (<= 10.0 x) (<= x 1000.0)))
(exp (+ (* v (log (/ x (+ v (sqrt (* (+ v x) (- v x))))))) (sqrt (* (+ v x) (- v x))))))