
(FPCore (x) :precision binary64 (asinh x))
double code(double x) {
return asinh(x);
}
def code(x): return math.asinh(x)
function code(x) return asinh(x) end
function tmp = code(x) tmp = asinh(x); end
code[x_] := N[ArcSinh[x], $MachinePrecision]
\begin{array}{l}
\\
\sinh^{-1} x
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
double code(double x) {
return copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
}
public static double code(double x) {
return Math.copySign(Math.log((Math.abs(x) + Math.sqrt(((x * x) + 1.0)))), x);
}
def code(x): return math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x)
function code(x) return copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x) end
function tmp = code(x) tmp = sign(x) * abs(log((abs(x) + sqrt(((x * x) + 1.0))))); 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]
\begin{array}{l}
\\
\mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))
(t_1 (+ (fabs x) 1.0))
(t_2 (pow t_1 2.0)))
(if (<= t_0 -10.0)
(copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.0)
(copysign
(fma
-0.041666666666666664
(* (+ (/ 3.0 t_1) (/ 3.0 t_2)) (pow x 4.0))
(fma
0.001388888888888889
(*
(+ (/ 45.0 t_1) (+ (/ 30.0 (pow t_1 3.0)) (/ 45.0 t_2)))
(pow x 6.0))
(fma 0.5 (/ (* x x) t_1) (log1p (fabs x)))))
x)
(copysign (log (+ x (hypot 1.0 x))) x)))))
double code(double x) {
double t_0 = copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
double t_1 = fabs(x) + 1.0;
double t_2 = pow(t_1, 2.0);
double tmp;
if (t_0 <= -10.0) {
tmp = copysign(log((1.0 / (hypot(1.0, x) - x))), x);
} else if (t_0 <= 0.0) {
tmp = copysign(fma(-0.041666666666666664, (((3.0 / t_1) + (3.0 / t_2)) * pow(x, 4.0)), fma(0.001388888888888889, (((45.0 / t_1) + ((30.0 / pow(t_1, 3.0)) + (45.0 / t_2))) * pow(x, 6.0)), fma(0.5, ((x * x) / t_1), log1p(fabs(x))))), x);
} else {
tmp = copysign(log((x + hypot(1.0, x))), x);
}
return tmp;
}
function code(x) t_0 = copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x) t_1 = Float64(abs(x) + 1.0) t_2 = t_1 ^ 2.0 tmp = 0.0 if (t_0 <= -10.0) tmp = copysign(log(Float64(1.0 / Float64(hypot(1.0, x) - x))), x); elseif (t_0 <= 0.0) tmp = copysign(fma(-0.041666666666666664, Float64(Float64(Float64(3.0 / t_1) + Float64(3.0 / t_2)) * (x ^ 4.0)), fma(0.001388888888888889, Float64(Float64(Float64(45.0 / t_1) + Float64(Float64(30.0 / (t_1 ^ 3.0)) + Float64(45.0 / t_2))) * (x ^ 6.0)), fma(0.5, Float64(Float64(x * x) / t_1), log1p(abs(x))))), x); else tmp = copysign(log(Float64(x + hypot(1.0, x))), x); end return tmp end
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]}, Block[{t$95$1 = N[(N[Abs[x], $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 2.0], $MachinePrecision]}, If[LessEqual[t$95$0, -10.0], N[With[{TMP1 = Abs[N[Log[N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[With[{TMP1 = Abs[N[(-0.041666666666666664 * N[(N[(N[(3.0 / t$95$1), $MachinePrecision] + N[(3.0 / t$95$2), $MachinePrecision]), $MachinePrecision] * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(0.001388888888888889 * N[(N[(N[(45.0 / t$95$1), $MachinePrecision] + N[(N[(30.0 / N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision] + N[(45.0 / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[x, 6.0], $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(N[(x * x), $MachinePrecision] / t$95$1), $MachinePrecision] + N[Log[1 + N[Abs[x], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
t_1 := \left|x\right| + 1\\
t_2 := {t_1}^{2}\\
\mathbf{if}\;t_0 \leq -10:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left(-0.041666666666666664, \left(\frac{3}{t_1} + \frac{3}{t_2}\right) \cdot {x}^{4}, \mathsf{fma}\left(0.001388888888888889, \left(\frac{45}{t_1} + \left(\frac{30}{{t_1}^{3}} + \frac{45}{t_2}\right)\right) \cdot {x}^{6}, \mathsf{fma}\left(0.5, \frac{x \cdot x}{t_1}, \mathsf{log1p}\left(\left|x\right|\right)\right)\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < -10Initial program 50.8%
+-commutative50.8%
hypot-1-def100.0%
Simplified100.0%
flip-+0.9%
div-sub0.9%
pow20.9%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt0.9%
pow20.9%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt0.3%
hypot-udef0.3%
hypot-udef0.3%
add-sqr-sqrt0.3%
metadata-eval0.3%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt2.5%
Applied egg-rr2.5%
unpow22.5%
div-sub3.0%
unpow23.0%
unpow23.0%
unpow23.0%
+-commutative3.0%
associate--r+49.2%
+-inverses100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
if -10 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < -0.0Initial program 9.4%
+-commutative9.4%
hypot-1-def9.5%
Simplified9.5%
Taylor expanded in x around 0 10.4%
fma-def10.4%
associate-*r/10.4%
metadata-eval10.4%
associate-*r/10.4%
metadata-eval10.4%
Simplified100.0%
if -0.0 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) Initial program 52.3%
+-commutative52.3%
hypot-1-def99.9%
Simplified99.9%
*-un-lft-identity99.9%
log-prod99.9%
metadata-eval99.9%
*-un-lft-identity99.9%
*-un-lft-identity99.9%
add-sqr-sqrt99.9%
fabs-sqr99.9%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
+-lft-identity99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -10.0)
(copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.0)
(copysign
(+
(* -0.16666666666666666 (pow x 3.0))
(+ (* 0.075 (pow x 5.0)) (+ x (* (pow x 6.0) -0.16666666666666666))))
x)
(copysign (log (+ x (hypot 1.0 x))) x)))))
double code(double x) {
double t_0 = copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
double tmp;
if (t_0 <= -10.0) {
tmp = copysign(log((1.0 / (hypot(1.0, x) - x))), x);
} else if (t_0 <= 0.0) {
tmp = copysign(((-0.16666666666666666 * pow(x, 3.0)) + ((0.075 * pow(x, 5.0)) + (x + (pow(x, 6.0) * -0.16666666666666666)))), x);
} else {
tmp = copysign(log((x + hypot(1.0, x))), x);
}
return tmp;
}
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 <= -10.0) {
tmp = Math.copySign(Math.log((1.0 / (Math.hypot(1.0, x) - x))), x);
} else if (t_0 <= 0.0) {
tmp = Math.copySign(((-0.16666666666666666 * Math.pow(x, 3.0)) + ((0.075 * Math.pow(x, 5.0)) + (x + (Math.pow(x, 6.0) * -0.16666666666666666)))), x);
} else {
tmp = Math.copySign(Math.log((x + Math.hypot(1.0, x))), x);
}
return tmp;
}
def code(x): t_0 = math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x) tmp = 0 if t_0 <= -10.0: tmp = math.copysign(math.log((1.0 / (math.hypot(1.0, x) - x))), x) elif t_0 <= 0.0: tmp = math.copysign(((-0.16666666666666666 * math.pow(x, 3.0)) + ((0.075 * math.pow(x, 5.0)) + (x + (math.pow(x, 6.0) * -0.16666666666666666)))), x) else: tmp = math.copysign(math.log((x + math.hypot(1.0, x))), x) return tmp
function code(x) t_0 = copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x) tmp = 0.0 if (t_0 <= -10.0) tmp = copysign(log(Float64(1.0 / Float64(hypot(1.0, x) - x))), x); elseif (t_0 <= 0.0) tmp = copysign(Float64(Float64(-0.16666666666666666 * (x ^ 3.0)) + Float64(Float64(0.075 * (x ^ 5.0)) + Float64(x + Float64((x ^ 6.0) * -0.16666666666666666)))), x); else tmp = copysign(log(Float64(x + hypot(1.0, x))), x); end return tmp 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 <= -10.0) tmp = sign(x) * abs(log((1.0 / (hypot(1.0, x) - x)))); elseif (t_0 <= 0.0) tmp = sign(x) * abs(((-0.16666666666666666 * (x ^ 3.0)) + ((0.075 * (x ^ 5.0)) + (x + ((x ^ 6.0) * -0.16666666666666666))))); else tmp = sign(x) * abs(log((x + hypot(1.0, x)))); end tmp_2 = tmp; end
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, -10.0], N[With[{TMP1 = Abs[N[Log[N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[With[{TMP1 = Abs[N[(N[(-0.16666666666666666 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[(0.075 * N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision] + N[(x + N[(N[Power[x, 6.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]]
\begin{array}{l}
\\
\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 -10:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\mathsf{copysign}\left(-0.16666666666666666 \cdot {x}^{3} + \left(0.075 \cdot {x}^{5} + \left(x + {x}^{6} \cdot -0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < -10Initial program 50.8%
+-commutative50.8%
hypot-1-def100.0%
Simplified100.0%
flip-+0.9%
div-sub0.9%
pow20.9%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt0.9%
pow20.9%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt0.3%
hypot-udef0.3%
hypot-udef0.3%
add-sqr-sqrt0.3%
metadata-eval0.3%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt2.5%
Applied egg-rr2.5%
unpow22.5%
div-sub3.0%
unpow23.0%
unpow23.0%
unpow23.0%
+-commutative3.0%
associate--r+49.2%
+-inverses100.0%
metadata-eval100.0%
metadata-eval100.0%
associate-/r*100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
if -10 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < -0.0Initial program 9.4%
+-commutative9.4%
hypot-1-def9.5%
Simplified9.5%
Taylor expanded in x around 0 10.4%
associate-*r*10.4%
*-commutative10.4%
fma-def10.4%
Simplified100.0%
Taylor expanded in x around 0 100.0%
if -0.0 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) Initial program 52.3%
+-commutative52.3%
hypot-1-def99.9%
Simplified99.9%
*-un-lft-identity99.9%
log-prod99.9%
metadata-eval99.9%
*-un-lft-identity99.9%
*-un-lft-identity99.9%
add-sqr-sqrt99.9%
fabs-sqr99.9%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
+-lft-identity99.9%
Simplified99.9%
Final simplification100.0%
(FPCore (x)
:precision binary64
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -0.0005)
(copysign (log (/ 1.0 (- (hypot 1.0 x) x))) x)
(if (<= t_0 0.0)
(copysign (+ (* 0.5 (/ x (/ (+ x 1.0) x))) (log1p x)) x)
(copysign (log (+ x (hypot 1.0 x))) x)))))
double code(double x) {
double t_0 = copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
double tmp;
if (t_0 <= -0.0005) {
tmp = copysign(log((1.0 / (hypot(1.0, x) - x))), x);
} else if (t_0 <= 0.0) {
tmp = copysign(((0.5 * (x / ((x + 1.0) / x))) + log1p(x)), x);
} else {
tmp = copysign(log((x + hypot(1.0, x))), x);
}
return tmp;
}
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 <= -0.0005) {
tmp = Math.copySign(Math.log((1.0 / (Math.hypot(1.0, x) - x))), x);
} else if (t_0 <= 0.0) {
tmp = Math.copySign(((0.5 * (x / ((x + 1.0) / x))) + Math.log1p(x)), x);
} else {
tmp = Math.copySign(Math.log((x + Math.hypot(1.0, x))), x);
}
return tmp;
}
def code(x): t_0 = math.copysign(math.log((math.fabs(x) + math.sqrt(((x * x) + 1.0)))), x) tmp = 0 if t_0 <= -0.0005: tmp = math.copysign(math.log((1.0 / (math.hypot(1.0, x) - x))), x) elif t_0 <= 0.0: tmp = math.copysign(((0.5 * (x / ((x + 1.0) / x))) + math.log1p(x)), x) else: tmp = math.copysign(math.log((x + math.hypot(1.0, x))), x) return tmp
function code(x) t_0 = copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x) tmp = 0.0 if (t_0 <= -0.0005) tmp = copysign(log(Float64(1.0 / Float64(hypot(1.0, x) - x))), x); elseif (t_0 <= 0.0) tmp = copysign(Float64(Float64(0.5 * Float64(x / Float64(Float64(x + 1.0) / x))) + log1p(x)), x); else tmp = copysign(log(Float64(x + hypot(1.0, x))), x); end return tmp end
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, -0.0005], N[With[{TMP1 = Abs[N[Log[N[(1.0 / N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[With[{TMP1 = Abs[N[(N[(0.5 * N[(x / N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Log[1 + x], $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]]
\begin{array}{l}
\\
\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 -0.0005:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{1}{\mathsf{hypot}\left(1, x\right) - x}\right), x\right)\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\mathsf{copysign}\left(0.5 \cdot \frac{x}{\frac{x + 1}{x}} + \mathsf{log1p}\left(x\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < -5.0000000000000001e-4Initial program 51.9%
+-commutative51.9%
hypot-1-def99.6%
Simplified99.6%
flip-+3.4%
div-sub3.4%
pow23.4%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt3.4%
pow23.4%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt1.7%
hypot-udef1.7%
hypot-udef1.7%
add-sqr-sqrt1.7%
metadata-eval1.7%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt4.9%
Applied egg-rr4.9%
unpow24.9%
div-sub5.5%
unpow25.5%
unpow25.5%
unpow25.5%
+-commutative5.5%
associate--r+50.3%
+-inverses99.6%
metadata-eval99.6%
metadata-eval99.6%
associate-/r*99.6%
neg-mul-199.6%
sub-neg99.6%
+-commutative99.6%
distribute-neg-in99.6%
remove-double-neg99.6%
sub-neg99.6%
Simplified99.6%
if -5.0000000000000001e-4 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) < -0.0Initial program 8.2%
+-commutative8.2%
hypot-1-def8.3%
Simplified8.3%
Taylor expanded in x around 0 9.3%
fma-def9.3%
unpow29.3%
log1p-def99.8%
Simplified99.8%
add-log-exp8.4%
fma-udef8.4%
exp-sum8.3%
add-sqr-sqrt2.6%
fabs-sqr2.6%
add-sqr-sqrt8.0%
log1p-udef8.0%
add-exp-log8.0%
add-sqr-sqrt2.6%
fabs-sqr2.6%
add-sqr-sqrt8.4%
add-exp-log8.4%
log1p-udef8.4%
exp-sum8.4%
Applied egg-rr99.8%
if -0.0 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) 1)))) x) Initial program 52.3%
+-commutative52.3%
hypot-1-def99.9%
Simplified99.9%
*-un-lft-identity99.9%
log-prod99.9%
metadata-eval99.9%
*-un-lft-identity99.9%
*-un-lft-identity99.9%
add-sqr-sqrt99.9%
fabs-sqr99.9%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
+-lft-identity99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (x)
:precision binary64
(if (<= x -0.72)
(copysign (log (/ -0.5 x)) x)
(if (<= x 0.000135)
(copysign (+ (* 0.5 (/ x (/ (+ x 1.0) x))) (log1p x)) x)
(copysign (log (+ x (hypot 1.0 x))) x))))
double code(double x) {
double tmp;
if (x <= -0.72) {
tmp = copysign(log((-0.5 / x)), x);
} else if (x <= 0.000135) {
tmp = copysign(((0.5 * (x / ((x + 1.0) / x))) + log1p(x)), x);
} else {
tmp = copysign(log((x + hypot(1.0, x))), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.72) {
tmp = Math.copySign(Math.log((-0.5 / x)), x);
} else if (x <= 0.000135) {
tmp = Math.copySign(((0.5 * (x / ((x + 1.0) / x))) + Math.log1p(x)), x);
} else {
tmp = Math.copySign(Math.log((x + Math.hypot(1.0, x))), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.72: tmp = math.copysign(math.log((-0.5 / x)), x) elif x <= 0.000135: tmp = math.copysign(((0.5 * (x / ((x + 1.0) / x))) + math.log1p(x)), x) else: tmp = math.copysign(math.log((x + math.hypot(1.0, x))), x) return tmp
function code(x) tmp = 0.0 if (x <= -0.72) tmp = copysign(log(Float64(-0.5 / x)), x); elseif (x <= 0.000135) tmp = copysign(Float64(Float64(0.5 * Float64(x / Float64(Float64(x + 1.0) / x))) + log1p(x)), x); else tmp = copysign(log(Float64(x + hypot(1.0, x))), x); end return tmp end
code[x_] := If[LessEqual[x, -0.72], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 0.000135], N[With[{TMP1 = Abs[N[(N[(0.5 * N[(x / N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Log[1 + x], $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x + N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.72:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.000135:\\
\;\;\;\;\mathsf{copysign}\left(0.5 \cdot \frac{x}{\frac{x + 1}{x}} + \mathsf{log1p}\left(x\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \mathsf{hypot}\left(1, x\right)\right), x\right)\\
\end{array}
\end{array}
if x < -0.71999999999999997Initial program 50.8%
+-commutative50.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 100.0%
associate--l+100.0%
unpow1100.0%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow4.1%
unpow14.1%
associate-+r-99.6%
mul-1-neg99.6%
sub-neg99.6%
+-inverses99.6%
neg-sub099.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -0.71999999999999997 < x < 1.35000000000000002e-4Initial program 9.4%
+-commutative9.4%
hypot-1-def9.5%
Simplified9.5%
Taylor expanded in x around 0 10.2%
fma-def10.2%
unpow210.2%
log1p-def99.3%
Simplified99.3%
add-log-exp9.3%
fma-udef9.3%
exp-sum9.2%
add-sqr-sqrt2.5%
fabs-sqr2.5%
add-sqr-sqrt8.6%
log1p-udef8.6%
add-exp-log8.6%
add-sqr-sqrt2.5%
fabs-sqr2.5%
add-sqr-sqrt9.4%
add-exp-log9.4%
log1p-udef9.4%
exp-sum9.4%
Applied egg-rr99.3%
if 1.35000000000000002e-4 < x Initial program 52.3%
+-commutative52.3%
hypot-1-def99.9%
Simplified99.9%
*-un-lft-identity99.9%
log-prod99.9%
metadata-eval99.9%
*-un-lft-identity99.9%
*-un-lft-identity99.9%
add-sqr-sqrt99.9%
fabs-sqr99.9%
add-sqr-sqrt99.9%
Applied egg-rr99.9%
+-lft-identity99.9%
Simplified99.9%
Final simplification99.5%
(FPCore (x)
:precision binary64
(if (<= x -0.72)
(copysign (log (/ -0.5 x)) x)
(if (<= x 0.91)
(copysign (+ (* 0.5 (/ x (/ (+ x 1.0) x))) (log1p x)) x)
(copysign (log (+ x (+ x (/ 0.5 x)))) x))))
double code(double x) {
double tmp;
if (x <= -0.72) {
tmp = copysign(log((-0.5 / x)), x);
} else if (x <= 0.91) {
tmp = copysign(((0.5 * (x / ((x + 1.0) / x))) + log1p(x)), x);
} else {
tmp = copysign(log((x + (x + (0.5 / x)))), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.72) {
tmp = Math.copySign(Math.log((-0.5 / x)), x);
} else if (x <= 0.91) {
tmp = Math.copySign(((0.5 * (x / ((x + 1.0) / x))) + Math.log1p(x)), x);
} else {
tmp = Math.copySign(Math.log((x + (x + (0.5 / x)))), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.72: tmp = math.copysign(math.log((-0.5 / x)), x) elif x <= 0.91: tmp = math.copysign(((0.5 * (x / ((x + 1.0) / x))) + math.log1p(x)), x) else: tmp = math.copysign(math.log((x + (x + (0.5 / x)))), x) return tmp
function code(x) tmp = 0.0 if (x <= -0.72) tmp = copysign(log(Float64(-0.5 / x)), x); elseif (x <= 0.91) tmp = copysign(Float64(Float64(0.5 * Float64(x / Float64(Float64(x + 1.0) / x))) + log1p(x)), x); else tmp = copysign(log(Float64(x + Float64(x + Float64(0.5 / x)))), x); end return tmp end
code[x_] := If[LessEqual[x, -0.72], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 0.91], N[With[{TMP1 = Abs[N[(N[(0.5 * N[(x / N[(N[(x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Log[1 + x], $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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.72:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.91:\\
\;\;\;\;\mathsf{copysign}\left(0.5 \cdot \frac{x}{\frac{x + 1}{x}} + \mathsf{log1p}\left(x\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \left(x + \frac{0.5}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if x < -0.71999999999999997Initial program 50.8%
+-commutative50.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 100.0%
associate--l+100.0%
unpow1100.0%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow4.1%
unpow14.1%
associate-+r-99.6%
mul-1-neg99.6%
sub-neg99.6%
+-inverses99.6%
neg-sub099.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -0.71999999999999997 < x < 0.910000000000000031Initial program 10.7%
+-commutative10.7%
hypot-1-def10.8%
Simplified10.8%
Taylor expanded in x around 0 10.5%
fma-def10.5%
unpow210.5%
log1p-def98.3%
Simplified98.3%
add-log-exp9.6%
fma-udef9.6%
exp-sum9.5%
add-sqr-sqrt2.9%
fabs-sqr2.9%
add-sqr-sqrt8.9%
log1p-udef8.9%
add-exp-log8.9%
add-sqr-sqrt2.9%
fabs-sqr2.9%
add-sqr-sqrt9.6%
add-exp-log9.6%
log1p-udef9.6%
exp-sum9.7%
Applied egg-rr98.3%
if 0.910000000000000031 < x Initial program 50.7%
+-commutative50.7%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
associate-+r+100.0%
+-commutative100.0%
+-commutative100.0%
unpow1100.0%
sqr-pow100.0%
fabs-sqr100.0%
sqr-pow100.0%
unpow1100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.0%
(FPCore (x) :precision binary64 (if (<= x -1.25) (copysign (log (/ -0.5 x)) x) (if (<= x 0.8) (copysign x x) (copysign (log (+ x (+ x (/ 0.5 x)))) x))))
double code(double x) {
double tmp;
if (x <= -1.25) {
tmp = copysign(log((-0.5 / x)), x);
} else if (x <= 0.8) {
tmp = copysign(x, x);
} else {
tmp = copysign(log((x + (x + (0.5 / x)))), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -1.25) {
tmp = Math.copySign(Math.log((-0.5 / x)), x);
} else if (x <= 0.8) {
tmp = Math.copySign(x, x);
} else {
tmp = Math.copySign(Math.log((x + (x + (0.5 / x)))), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -1.25: tmp = math.copysign(math.log((-0.5 / x)), x) elif x <= 0.8: tmp = math.copysign(x, x) else: tmp = math.copysign(math.log((x + (x + (0.5 / x)))), x) return tmp
function code(x) tmp = 0.0 if (x <= -1.25) tmp = copysign(log(Float64(-0.5 / x)), x); elseif (x <= 0.8) tmp = copysign(x, x); else tmp = copysign(log(Float64(x + Float64(x + Float64(0.5 / x)))), x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -1.25) tmp = sign(x) * abs(log((-0.5 / x))); elseif (x <= 0.8) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((x + (x + (0.5 / x))))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -1.25], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 0.8], N[With[{TMP1 = Abs[x], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.8:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + \left(x + \frac{0.5}{x}\right)\right), x\right)\\
\end{array}
\end{array}
if x < -1.25Initial program 50.8%
+-commutative50.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 100.0%
associate--l+100.0%
unpow1100.0%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow4.1%
unpow14.1%
associate-+r-99.6%
mul-1-neg99.6%
sub-neg99.6%
+-inverses99.6%
neg-sub099.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -1.25 < x < 0.80000000000000004Initial program 10.7%
+-commutative10.7%
hypot-1-def10.8%
Simplified10.8%
Taylor expanded in x around 0 8.0%
unpow18.0%
sqr-pow2.8%
fabs-sqr2.8%
sqr-pow8.1%
unpow18.1%
Simplified8.1%
Taylor expanded in x around 0 97.4%
if 0.80000000000000004 < x Initial program 50.7%
+-commutative50.7%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
associate-+r+100.0%
+-commutative100.0%
+-commutative100.0%
unpow1100.0%
sqr-pow100.0%
fabs-sqr100.0%
sqr-pow100.0%
unpow1100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification98.6%
(FPCore (x) :precision binary64 (if (<= x -3.2) (copysign (log (- x)) x) (if (<= x 1.25) (copysign x x) (copysign (log (+ x x)) x))))
double code(double x) {
double tmp;
if (x <= -3.2) {
tmp = copysign(log(-x), x);
} else if (x <= 1.25) {
tmp = copysign(x, x);
} else {
tmp = copysign(log((x + x)), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -3.2) {
tmp = Math.copySign(Math.log(-x), x);
} else if (x <= 1.25) {
tmp = Math.copySign(x, x);
} else {
tmp = Math.copySign(Math.log((x + x)), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -3.2: tmp = math.copysign(math.log(-x), x) elif x <= 1.25: tmp = math.copysign(x, x) else: tmp = math.copysign(math.log((x + x)), x) return tmp
function code(x) tmp = 0.0 if (x <= -3.2) tmp = copysign(log(Float64(-x)), x); elseif (x <= 1.25) tmp = copysign(x, x); else tmp = copysign(log(Float64(x + x)), x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -3.2) tmp = sign(x) * abs(log(-x)); elseif (x <= 1.25) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((x + x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -3.2], N[With[{TMP1 = Abs[N[Log[(-x)], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 1.25], N[With[{TMP1 = Abs[x], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x + x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\
\mathbf{elif}\;x \leq 1.25:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\
\end{array}
\end{array}
if x < -3.2000000000000002Initial program 50.8%
+-commutative50.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 31.5%
mul-1-neg31.5%
Simplified31.5%
if -3.2000000000000002 < x < 1.25Initial program 10.7%
+-commutative10.7%
hypot-1-def10.8%
Simplified10.8%
Taylor expanded in x around 0 8.0%
unpow18.0%
sqr-pow2.8%
fabs-sqr2.8%
sqr-pow8.1%
unpow18.1%
Simplified8.1%
Taylor expanded in x around 0 97.4%
if 1.25 < x Initial program 50.7%
+-commutative50.7%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 99.7%
unpow199.7%
sqr-pow99.7%
fabs-sqr99.7%
sqr-pow99.7%
unpow199.7%
Simplified99.7%
Final simplification81.2%
(FPCore (x) :precision binary64 (if (<= x -1.25) (copysign (log (/ -0.5 x)) x) (if (<= x 1.25) (copysign x x) (copysign (log (+ x x)) x))))
double code(double x) {
double tmp;
if (x <= -1.25) {
tmp = copysign(log((-0.5 / x)), x);
} else if (x <= 1.25) {
tmp = copysign(x, x);
} else {
tmp = copysign(log((x + x)), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -1.25) {
tmp = Math.copySign(Math.log((-0.5 / x)), x);
} else if (x <= 1.25) {
tmp = Math.copySign(x, x);
} else {
tmp = Math.copySign(Math.log((x + x)), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -1.25: tmp = math.copysign(math.log((-0.5 / x)), x) elif x <= 1.25: tmp = math.copysign(x, x) else: tmp = math.copysign(math.log((x + x)), x) return tmp
function code(x) tmp = 0.0 if (x <= -1.25) tmp = copysign(log(Float64(-0.5 / x)), x); elseif (x <= 1.25) tmp = copysign(x, x); else tmp = copysign(log(Float64(x + x)), x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -1.25) tmp = sign(x) * abs(log((-0.5 / x))); elseif (x <= 1.25) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((x + x))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -1.25], N[With[{TMP1 = Abs[N[Log[N[(-0.5 / x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 1.25], N[With[{TMP1 = Abs[x], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x + x), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 1.25:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x + x\right), x\right)\\
\end{array}
\end{array}
if x < -1.25Initial program 50.8%
+-commutative50.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 100.0%
associate--l+100.0%
unpow1100.0%
sqr-pow0.0%
fabs-sqr0.0%
sqr-pow4.1%
unpow14.1%
associate-+r-99.6%
mul-1-neg99.6%
sub-neg99.6%
+-inverses99.6%
neg-sub099.6%
associate-*r/99.6%
metadata-eval99.6%
distribute-neg-frac99.6%
metadata-eval99.6%
Simplified99.6%
if -1.25 < x < 1.25Initial program 10.7%
+-commutative10.7%
hypot-1-def10.8%
Simplified10.8%
Taylor expanded in x around 0 8.0%
unpow18.0%
sqr-pow2.8%
fabs-sqr2.8%
sqr-pow8.1%
unpow18.1%
Simplified8.1%
Taylor expanded in x around 0 97.4%
if 1.25 < x Initial program 50.7%
+-commutative50.7%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around inf 99.7%
unpow199.7%
sqr-pow99.7%
fabs-sqr99.7%
sqr-pow99.7%
unpow199.7%
Simplified99.7%
Final simplification98.5%
(FPCore (x) :precision binary64 (if (<= x -0.5) (copysign (log (- x)) x) (copysign (log1p x) x)))
double code(double x) {
double tmp;
if (x <= -0.5) {
tmp = copysign(log(-x), x);
} else {
tmp = copysign(log1p(x), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.5) {
tmp = Math.copySign(Math.log(-x), x);
} else {
tmp = Math.copySign(Math.log1p(x), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.5: tmp = math.copysign(math.log(-x), x) else: tmp = math.copysign(math.log1p(x), x) return tmp
function code(x) tmp = 0.0 if (x <= -0.5) tmp = copysign(log(Float64(-x)), x); else tmp = copysign(log1p(x), x); end return tmp end
code[x_] := If[LessEqual[x, -0.5], N[With[{TMP1 = Abs[N[Log[(-x)], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + x], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < -0.5Initial program 50.8%
+-commutative50.8%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around -inf 31.5%
mul-1-neg31.5%
Simplified31.5%
if -0.5 < x Initial program 22.7%
+-commutative22.7%
hypot-1-def37.4%
Simplified37.4%
Taylor expanded in x around 0 15.0%
log1p-def76.7%
unpow176.7%
sqr-pow41.8%
fabs-sqr41.8%
sqr-pow76.7%
unpow176.7%
Simplified76.7%
Final simplification65.2%
(FPCore (x) :precision binary64 (if (<= x 1.6) (copysign x x) (copysign (log1p x) x)))
double code(double x) {
double tmp;
if (x <= 1.6) {
tmp = copysign(x, x);
} else {
tmp = copysign(log1p(x), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.6) {
tmp = Math.copySign(x, x);
} else {
tmp = Math.copySign(Math.log1p(x), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.6: tmp = math.copysign(x, x) else: tmp = math.copysign(math.log1p(x), x) return tmp
function code(x) tmp = 0.0 if (x <= 1.6) tmp = copysign(x, x); else tmp = copysign(log1p(x), x); end return tmp end
code[x_] := If[LessEqual[x, 1.6], N[With[{TMP1 = Abs[x], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[1 + x], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.6:\\
\;\;\;\;\mathsf{copysign}\left(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < 1.6000000000000001Initial program 23.8%
+-commutative23.8%
hypot-1-def40.0%
Simplified40.0%
Taylor expanded in x around 0 15.7%
unpow115.7%
sqr-pow1.9%
fabs-sqr1.9%
sqr-pow5.5%
unpow15.5%
Simplified5.5%
Taylor expanded in x around 0 67.4%
if 1.6000000000000001 < x Initial program 50.7%
+-commutative50.7%
hypot-1-def100.0%
Simplified100.0%
Taylor expanded in x around 0 31.4%
log1p-def31.4%
unpow131.4%
sqr-pow31.4%
fabs-sqr31.4%
sqr-pow31.4%
unpow131.4%
Simplified31.4%
Final simplification59.4%
(FPCore (x) :precision binary64 (copysign x x))
double code(double x) {
return copysign(x, x);
}
public static double code(double x) {
return Math.copySign(x, x);
}
def code(x): return math.copysign(x, x)
function code(x) return copysign(x, x) end
function tmp = code(x) tmp = sign(x) * abs(x); end
code[x_] := N[With[{TMP1 = Abs[x], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
\begin{array}{l}
\\
\mathsf{copysign}\left(x, x\right)
\end{array}
Initial program 29.8%
+-commutative29.8%
hypot-1-def53.3%
Simplified53.3%
Taylor expanded in x around 0 19.2%
unpow119.2%
sqr-pow8.5%
fabs-sqr8.5%
sqr-pow11.2%
unpow111.2%
Simplified11.2%
Taylor expanded in x around 0 53.6%
Final simplification53.6%
(FPCore (x) :precision binary64 (let* ((t_0 (/ 1.0 (fabs x)))) (copysign (log1p (+ (fabs x) (/ (fabs x) (+ (hypot 1.0 t_0) t_0)))) x)))
double code(double x) {
double t_0 = 1.0 / fabs(x);
return copysign(log1p((fabs(x) + (fabs(x) / (hypot(1.0, t_0) + t_0)))), x);
}
public static double code(double x) {
double t_0 = 1.0 / Math.abs(x);
return Math.copySign(Math.log1p((Math.abs(x) + (Math.abs(x) / (Math.hypot(1.0, t_0) + t_0)))), x);
}
def code(x): t_0 = 1.0 / math.fabs(x) return math.copysign(math.log1p((math.fabs(x) + (math.fabs(x) / (math.hypot(1.0, t_0) + t_0)))), x)
function code(x) t_0 = Float64(1.0 / abs(x)) return copysign(log1p(Float64(abs(x) + Float64(abs(x) / Float64(hypot(1.0, t_0) + t_0)))), x) end
code[x_] := Block[{t$95$0 = N[(1.0 / N[Abs[x], $MachinePrecision]), $MachinePrecision]}, N[With[{TMP1 = Abs[N[Log[1 + N[(N[Abs[x], $MachinePrecision] + N[(N[Abs[x], $MachinePrecision] / N[(N[Sqrt[1.0 ^ 2 + t$95$0 ^ 2], $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{\left|x\right|}\\
\mathsf{copysign}\left(\mathsf{log1p}\left(\left|x\right| + \frac{\left|x\right|}{\mathsf{hypot}\left(1, t_0\right) + t_0}\right), x\right)
\end{array}
\end{array}
herbie shell --seed 2023278
(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))