| Alternative 1 | |
|---|---|
| Accuracy | 99.4% |
| Cost | 13576 |
(FPCore (x) :precision binary64 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
(FPCore (x)
:precision binary64
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -1.0)
(copysign (- (log (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.0)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (+ x (- x (/ -0.5 x)))) x)))))double code(double x) {
return copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
}
double code(double x) {
double t_0 = copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
double tmp;
if (t_0 <= -1.0) {
tmp = copysign(-log((hypot(1.0, x) - x)), x);
} else if (t_0 <= 0.0) {
tmp = copysign((x + (-0.16666666666666666 * pow(x, 3.0))), x);
} else {
tmp = copysign(log((x + (x - (-0.5 / x)))), x);
}
return tmp;
}
public static double code(double x) {
return Math.copySign(Math.log((Math.abs(x) + Math.sqrt(((x * x) + 1.0)))), x);
}
public static double code(double x) {
double t_0 = Math.copySign(Math.log((Math.abs(x) + Math.sqrt(((x * x) + 1.0)))), x);
double tmp;
if (t_0 <= -1.0) {
tmp = Math.copySign(-Math.log((Math.hypot(1.0, x) - x)), x);
} else if (t_0 <= 0.0) {
tmp = Math.copySign((x + (-0.16666666666666666 * Math.pow(x, 3.0))), x);
} else {
tmp = Math.copySign(Math.log((x + (x - (-0.5 / x)))), x);
}
return tmp;
}
def code(x): return math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x)
def code(x): t_0 = math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x) tmp = 0 if t_0 <= -1.0: tmp = math.copysign(-math.log((math.hypot(1.0, x) - x)), x) elif t_0 <= 0.0: tmp = math.copysign((x + (-0.16666666666666666 * math.pow(x, 3.0))), x) else: tmp = math.copysign(math.log((x + (x - (-0.5 / x)))), x) return tmp
function code(x) return copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x) end
function code(x) t_0 = copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x) tmp = 0.0 if (t_0 <= -1.0) tmp = copysign(Float64(-log(Float64(hypot(1.0, x) - x))), x); elseif (t_0 <= 0.0) tmp = copysign(Float64(x + Float64(-0.16666666666666666 * (x ^ 3.0))), x); else tmp = copysign(log(Float64(x + Float64(x - Float64(-0.5 / x)))), x); end return tmp end
function tmp = code(x) tmp = sign(x) * abs(log((abs(x) + sqrt(((x * x) + 1.0))))); end
function tmp_2 = code(x) t_0 = sign(x) * abs(log((abs(x) + sqrt(((x * x) + 1.0))))); tmp = 0.0; if (t_0 <= -1.0) tmp = sign(x) * abs(-log((hypot(1.0, x) - x))); elseif (t_0 <= 0.0) tmp = sign(x) * abs((x + (-0.16666666666666666 * (x ^ 3.0)))); else tmp = sign(x) * abs(log((x + (x - (-0.5 / x))))); end tmp_2 = tmp; end
code[x_] := N[With[{TMP1 = Abs[N[Log[N[(N[Abs[x], $MachinePrecision] + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x_] := Block[{t$95$0 = N[With[{TMP1 = Abs[N[Log[N[(N[Abs[x], $MachinePrecision] + N[Sqrt[N[(N[(x * x), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]}, If[LessEqual[t$95$0, -1.0], N[With[{TMP1 = Abs[(-N[Log[N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] - x), $MachinePrecision]], $MachinePrecision])], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[With[{TMP1 = Abs[N[(x + N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x + N[(x - N[(-0.5 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]]
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t_0 \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \left(x - \frac{-0.5}{x}\right)\right), x\right)\\
\end{array}
| Original | 29.6% |
|---|---|
| Target | 100.0% |
| Herbie | 98.6% |
if (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < -1Initial program 50.9%
Simplified100.0%
[Start]50.9 | \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\] |
|---|---|
+-commutative [=>]50.9 | \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right)
\] |
hypot-1-def [=>]100.0 | \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
Applied egg-rr1.8%
[Start]100.0 | \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \mathsf{hypot}\left(1, x\right)\right), x\right)
\] |
|---|---|
flip-+ [=>]1.8 | \[ \mathsf{copysign}\left(\log \color{blue}{\left(\frac{\left|x\right| \cdot \left|x\right| - \mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right)}, x\right)
\] |
div-sub [=>]1.8 | \[ \mathsf{copysign}\left(\log \color{blue}{\left(\frac{\left|x\right| \cdot \left|x\right|}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right)}, x\right)
\] |
pow2 [=>]1.8 | \[ \mathsf{copysign}\left(\log \left(\frac{\color{blue}{{\left(\left|x\right|\right)}^{2}}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
add-sqr-sqrt [=>]0.0 | \[ \mathsf{copysign}\left(\log \left(\frac{{\left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right|\right)}^{2}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
fabs-sqr [=>]0.0 | \[ \mathsf{copysign}\left(\log \left(\frac{{\color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}}^{2}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
add-sqr-sqrt [<=]1.8 | \[ \mathsf{copysign}\left(\log \left(\frac{{\color{blue}{x}}^{2}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
pow2 [<=]1.8 | \[ \mathsf{copysign}\left(\log \left(\frac{\color{blue}{x \cdot x}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
add-sqr-sqrt [=>]0.0 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
fabs-sqr [=>]0.0 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{\color{blue}{\sqrt{x} \cdot \sqrt{x}} - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
add-sqr-sqrt [<=]0.5 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{\color{blue}{x} - \mathsf{hypot}\left(1, x\right)} - \frac{\mathsf{hypot}\left(1, x\right) \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
hypot-udef [=>]0.5 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{x - \mathsf{hypot}\left(1, x\right)} - \frac{\color{blue}{\sqrt{1 \cdot 1 + x \cdot x}} \cdot \mathsf{hypot}\left(1, x\right)}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
hypot-udef [=>]0.5 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{x - \mathsf{hypot}\left(1, x\right)} - \frac{\sqrt{1 \cdot 1 + x \cdot x} \cdot \color{blue}{\sqrt{1 \cdot 1 + x \cdot x}}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
add-sqr-sqrt [<=]0.5 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{x - \mathsf{hypot}\left(1, x\right)} - \frac{\color{blue}{1 \cdot 1 + x \cdot x}}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
metadata-eval [=>]0.5 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{x - \mathsf{hypot}\left(1, x\right)} - \frac{\color{blue}{1} + x \cdot x}{\left|x\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
add-sqr-sqrt [=>]0.0 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{x - \mathsf{hypot}\left(1, x\right)} - \frac{1 + x \cdot x}{\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
fabs-sqr [=>]0.0 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{x - \mathsf{hypot}\left(1, x\right)} - \frac{1 + x \cdot x}{\color{blue}{\sqrt{x} \cdot \sqrt{x}} - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
add-sqr-sqrt [<=]1.8 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{x - \mathsf{hypot}\left(1, x\right)} - \frac{1 + x \cdot x}{\color{blue}{x} - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
Simplified100.0%
[Start]1.8 | \[ \mathsf{copysign}\left(\log \left(\frac{x \cdot x}{x - \mathsf{hypot}\left(1, x\right)} - \frac{1 + x \cdot x}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
|---|---|
unpow2 [<=]1.8 | \[ \mathsf{copysign}\left(\log \left(\frac{\color{blue}{{x}^{2}}}{x - \mathsf{hypot}\left(1, x\right)} - \frac{1 + x \cdot x}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
div-sub [<=]2.7 | \[ \mathsf{copysign}\left(\log \color{blue}{\left(\frac{{x}^{2} - \left(1 + x \cdot x\right)}{x - \mathsf{hypot}\left(1, x\right)}\right)}, x\right)
\] |
unpow2 [=>]2.7 | \[ \mathsf{copysign}\left(\log \left(\frac{\color{blue}{x \cdot x} - \left(1 + x \cdot x\right)}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
unpow2 [<=]2.7 | \[ \mathsf{copysign}\left(\log \left(\frac{\color{blue}{{x}^{2}} - \left(1 + x \cdot x\right)}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
unpow2 [<=]2.7 | \[ \mathsf{copysign}\left(\log \left(\frac{{x}^{2} - \left(1 + \color{blue}{{x}^{2}}\right)}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
+-commutative [=>]2.7 | \[ \mathsf{copysign}\left(\log \left(\frac{{x}^{2} - \color{blue}{\left({x}^{2} + 1\right)}}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
associate--r+ [=>]50.9 | \[ \mathsf{copysign}\left(\log \left(\frac{\color{blue}{\left({x}^{2} - {x}^{2}\right) - 1}}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
+-inverses [=>]100.0 | \[ \mathsf{copysign}\left(\log \left(\frac{\color{blue}{0} - 1}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
metadata-eval [=>]100.0 | \[ \mathsf{copysign}\left(\log \left(\frac{\color{blue}{-1}}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
metadata-eval [<=]100.0 | \[ \mathsf{copysign}\left(\log \left(\frac{\color{blue}{\frac{1}{-1}}}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
associate-/r* [<=]100.0 | \[ \mathsf{copysign}\left(\log \color{blue}{\left(\frac{1}{-1 \cdot \left(x - \mathsf{hypot}\left(1, x\right)\right)}\right)}, x\right)
\] |
neg-mul-1 [<=]100.0 | \[ \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{-\left(x - \mathsf{hypot}\left(1, x\right)\right)}}\right), x\right)
\] |
sub-neg [=>]100.0 | \[ \mathsf{copysign}\left(\log \left(\frac{1}{-\color{blue}{\left(x + \left(-\mathsf{hypot}\left(1, x\right)\right)\right)}}\right), x\right)
\] |
+-commutative [=>]100.0 | \[ \mathsf{copysign}\left(\log \left(\frac{1}{-\color{blue}{\left(\left(-\mathsf{hypot}\left(1, x\right)\right) + x\right)}}\right), x\right)
\] |
distribute-neg-in [=>]100.0 | \[ \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\left(-\left(-\mathsf{hypot}\left(1, x\right)\right)\right) + \left(-x\right)}}\right), x\right)
\] |
remove-double-neg [=>]100.0 | \[ \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\mathsf{hypot}\left(1, x\right)} + \left(-x\right)}\right), x\right)
\] |
sub-neg [<=]100.0 | \[ \mathsf{copysign}\left(\log \left(\frac{1}{\color{blue}{\mathsf{hypot}\left(1, x\right) - x}}\right), x\right)
\] |
Applied egg-rr100.0%
[Start]100.0 | \[ \mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)
\] |
|---|---|
log-div [=>]100.0 | \[ \mathsf{copysign}\left(\color{blue}{\log 1 - \log \left(\mathsf{hypot}\left(1, x\right) - x\right)}, x\right)
\] |
sub-neg [=>]100.0 | \[ \mathsf{copysign}\left(\color{blue}{\log 1 + \left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right)\right)}, x\right)
\] |
metadata-eval [=>]100.0 | \[ \mathsf{copysign}\left(\color{blue}{0} + \left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right)\right), x\right)
\] |
Simplified100.0%
[Start]100.0 | \[ \mathsf{copysign}\left(0 + \left(-\log \left(\mathsf{hypot}\left(1, x\right) - x\right)\right), x\right)
\] |
|---|---|
+-lft-identity [=>]100.0 | \[ \mathsf{copysign}\left(\color{blue}{-\log \left(\mathsf{hypot}\left(1, x\right) - x\right)}, x\right)
\] |
if -1 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < 0.0Initial program 7.0%
Simplified7.0%
[Start]7.0 | \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\] |
|---|---|
+-commutative [=>]7.0 | \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{\color{blue}{1 + x \cdot x}}\right), x\right)
\] |
hypot-1-def [=>]7.0 | \[ \mathsf{copysign}\left(\log \left(\left|x\right| + \color{blue}{\mathsf{hypot}\left(1, x\right)}\right), x\right)
\] |
Taylor expanded in x around 0 6.8%
Simplified6.8%
[Start]6.8 | \[ \mathsf{copysign}\left(\log \left(1 + \left(0.5 \cdot {x}^{2} + \left|x\right|\right)\right), x\right)
\] |
|---|---|
*-commutative [=>]6.8 | \[ \mathsf{copysign}\left(\log \left(1 + \left(\color{blue}{{x}^{2} \cdot 0.5} + \left|x\right|\right)\right), x\right)
\] |
unpow2 [=>]6.8 | \[ \mathsf{copysign}\left(\log \left(1 + \left(\color{blue}{\left(x \cdot x\right)} \cdot 0.5 + \left|x\right|\right)\right), x\right)
\] |
associate-*l* [=>]6.8 | \[ \mathsf{copysign}\left(\log \left(1 + \left(\color{blue}{x \cdot \left(x \cdot 0.5\right)} + \left|x\right|\right)\right), x\right)
\] |
fma-def [=>]6.8 | \[ \mathsf{copysign}\left(\log \left(1 + \color{blue}{\mathsf{fma}\left(x, x \cdot 0.5, \left|x\right|\right)}\right), x\right)
\] |
unpow1 [<=]6.8 | \[ \mathsf{copysign}\left(\log \left(1 + \mathsf{fma}\left(x, x \cdot 0.5, \left|\color{blue}{{x}^{1}}\right|\right)\right), x\right)
\] |
sqr-pow [=>]2.6 | \[ \mathsf{copysign}\left(\log \left(1 + \mathsf{fma}\left(x, x \cdot 0.5, \left|\color{blue}{{x}^{\left(\frac{1}{2}\right)} \cdot {x}^{\left(\frac{1}{2}\right)}}\right|\right)\right), x\right)
\] |
fabs-sqr [=>]2.6 | \[ \mathsf{copysign}\left(\log \left(1 + \mathsf{fma}\left(x, x \cdot 0.5, \color{blue}{{x}^{\left(\frac{1}{2}\right)} \cdot {x}^{\left(\frac{1}{2}\right)}}\right)\right), x\right)
\] |
sqr-pow [<=]6.8 | \[ \mathsf{copysign}\left(\log \left(1 + \mathsf{fma}\left(x, x \cdot 0.5, \color{blue}{{x}^{1}}\right)\right), x\right)
\] |
unpow1 [=>]6.8 | \[ \mathsf{copysign}\left(\log \left(1 + \mathsf{fma}\left(x, x \cdot 0.5, \color{blue}{x}\right)\right), x\right)
\] |
Taylor expanded in x around 0 99.8%
if 0.0 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) Initial program 50.2%
Taylor expanded in x around inf 95.2%
Simplified95.2%
[Start]95.2 | \[ \mathsf{copysign}\left(\log \left(0.5 \cdot \frac{1}{x} + \left(\left|x\right| + x\right)\right), x\right)
\] |
|---|---|
+-commutative [=>]95.2 | \[ \mathsf{copysign}\left(\log \color{blue}{\left(\left(\left|x\right| + x\right) + 0.5 \cdot \frac{1}{x}\right)}, x\right)
\] |
associate-+l+ [=>]95.2 | \[ \mathsf{copysign}\left(\log \color{blue}{\left(\left|x\right| + \left(x + 0.5 \cdot \frac{1}{x}\right)\right)}, x\right)
\] |
rem-square-sqrt [<=]95.2 | \[ \mathsf{copysign}\left(\log \left(\left|\color{blue}{\sqrt{x} \cdot \sqrt{x}}\right| + \left(x + 0.5 \cdot \frac{1}{x}\right)\right), x\right)
\] |
fabs-sqr [=>]95.2 | \[ \mathsf{copysign}\left(\log \left(\color{blue}{\sqrt{x} \cdot \sqrt{x}} + \left(x + 0.5 \cdot \frac{1}{x}\right)\right), x\right)
\] |
rem-square-sqrt [=>]95.2 | \[ \mathsf{copysign}\left(\log \left(\color{blue}{x} + \left(x + 0.5 \cdot \frac{1}{x}\right)\right), x\right)
\] |
*-commutative [=>]95.2 | \[ \mathsf{copysign}\left(\log \left(x + \left(x + \color{blue}{\frac{1}{x} \cdot 0.5}\right)\right), x\right)
\] |
cancel-sign-sub [<=]95.2 | \[ \mathsf{copysign}\left(\log \left(x + \color{blue}{\left(x - \left(-\frac{1}{x}\right) \cdot 0.5\right)}\right), x\right)
\] |
distribute-lft-neg-in [<=]95.2 | \[ \mathsf{copysign}\left(\log \left(x + \left(x - \color{blue}{\left(-\frac{1}{x} \cdot 0.5\right)}\right)\right), x\right)
\] |
*-commutative [<=]95.2 | \[ \mathsf{copysign}\left(\log \left(x + \left(x - \left(-\color{blue}{0.5 \cdot \frac{1}{x}}\right)\right)\right), x\right)
\] |
associate-*r/ [=>]95.2 | \[ \mathsf{copysign}\left(\log \left(x + \left(x - \left(-\color{blue}{\frac{0.5 \cdot 1}{x}}\right)\right)\right), x\right)
\] |
metadata-eval [=>]95.2 | \[ \mathsf{copysign}\left(\log \left(x + \left(x - \left(-\frac{\color{blue}{0.5}}{x}\right)\right)\right), x\right)
\] |
distribute-neg-frac [=>]95.2 | \[ \mathsf{copysign}\left(\log \left(x + \left(x - \color{blue}{\frac{-0.5}{x}}\right)\right), x\right)
\] |
metadata-eval [=>]95.2 | \[ \mathsf{copysign}\left(\log \left(x + \left(x - \frac{\color{blue}{-0.5}}{x}\right)\right), x\right)
\] |
Final simplification98.6%
| Alternative 1 | |
|---|---|
| Accuracy | 99.4% |
| Cost | 13576 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.5% |
| Cost | 13576 |
| Alternative 3 | |
|---|---|
| Accuracy | 99.3% |
| Cost | 13512 |
| Alternative 4 | |
|---|---|
| Accuracy | 82.2% |
| Cost | 13320 |
| Alternative 5 | |
|---|---|
| Accuracy | 99.1% |
| Cost | 13320 |
| Alternative 6 | |
|---|---|
| Accuracy | 64.3% |
| Cost | 13124 |
| Alternative 7 | |
|---|---|
| Accuracy | 58.1% |
| Cost | 13060 |
| Alternative 8 | |
|---|---|
| Accuracy | 51.8% |
| Cost | 6528 |
herbie shell --seed 2023147
(FPCore (x)
:name "Rust f64::asinh"
:precision binary64
:herbie-target
(copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 (/ 1.0 (fabs x))) (/ 1.0 (fabs x)))))) x)
(copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))