
(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 12 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 (pow (+ x 1.0) 2.0))
(t_1 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_1 -1.0)
(copysign (log (- (hypot 1.0 x) x)) x)
(if (<= t_1 0.0002)
(copysign
(fma
(pow x 2.0)
(fma
(pow x 2.0)
(fma
0.001388888888888889
(*
(pow x 2.0)
(+
(/ 45.0 (+ x 1.0))
(+ (/ 45.0 t_0) (/ 30.0 (pow (+ x 1.0) 3.0)))))
(+ (/ -0.125 (+ x 1.0)) (/ -0.125 t_0)))
(/ 0.5 (+ x 1.0)))
(log1p x))
x)
(copysign (log (+ (fabs x) (hypot 1.0 x))) x)))))
double code(double x) {
double t_0 = pow((x + 1.0), 2.0);
double t_1 = copysign(log((fabs(x) + sqrt(((x * x) + 1.0)))), x);
double tmp;
if (t_1 <= -1.0) {
tmp = copysign(log((hypot(1.0, x) - x)), x);
} else if (t_1 <= 0.0002) {
tmp = copysign(fma(pow(x, 2.0), fma(pow(x, 2.0), fma(0.001388888888888889, (pow(x, 2.0) * ((45.0 / (x + 1.0)) + ((45.0 / t_0) + (30.0 / pow((x + 1.0), 3.0))))), ((-0.125 / (x + 1.0)) + (-0.125 / t_0))), (0.5 / (x + 1.0))), log1p(x)), x);
} else {
tmp = copysign(log((fabs(x) + hypot(1.0, x))), x);
}
return tmp;
}
function code(x) t_0 = Float64(x + 1.0) ^ 2.0 t_1 = copysign(log(Float64(abs(x) + sqrt(Float64(Float64(x * x) + 1.0)))), x) tmp = 0.0 if (t_1 <= -1.0) tmp = copysign(log(Float64(hypot(1.0, x) - x)), x); elseif (t_1 <= 0.0002) tmp = copysign(fma((x ^ 2.0), fma((x ^ 2.0), fma(0.001388888888888889, Float64((x ^ 2.0) * Float64(Float64(45.0 / Float64(x + 1.0)) + Float64(Float64(45.0 / t_0) + Float64(30.0 / (Float64(x + 1.0) ^ 3.0))))), Float64(Float64(-0.125 / Float64(x + 1.0)) + Float64(-0.125 / t_0))), Float64(0.5 / Float64(x + 1.0))), log1p(x)), x); else tmp = copysign(log(Float64(abs(x) + hypot(1.0, x))), x); end return tmp end
code[x_] := Block[{t$95$0 = N[Power[N[(x + 1.0), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = 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$1, -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$1, 0.0002], N[With[{TMP1 = Abs[N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[Power[x, 2.0], $MachinePrecision] * N[(0.001388888888888889 * N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(45.0 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(45.0 / t$95$0), $MachinePrecision] + N[(30.0 / N[Power[N[(x + 1.0), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.125 / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(-0.125 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 / N[(x + 1.0), $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[(N[Abs[x], $MachinePrecision] + 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 := {\left(x + 1\right)}^{2}\\
t_1 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t\_1 \leq -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;t\_1 \leq 0.0002:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{fma}\left({x}^{2}, \mathsf{fma}\left({x}^{2}, \mathsf{fma}\left(0.001388888888888889, {x}^{2} \cdot \left(\frac{45}{x + 1} + \left(\frac{45}{t\_0} + \frac{30}{{\left(x + 1\right)}^{3}}\right)\right), \frac{-0.125}{x + 1} + \frac{-0.125}{t\_0}\right), \frac{0.5}{x + 1}\right), \mathsf{log1p}\left(x\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \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) #s(literal 1 binary64))))) x) < -1Initial program 39.9%
flip-+2.3%
clear-num2.3%
log-div2.3%
metadata-eval2.3%
+-commutative2.3%
hypot-1-def2.3%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt3.4%
Applied egg-rr3.4%
neg-sub03.4%
div-sub3.4%
*-rgt-identity3.4%
associate-/l*3.4%
fmm-def3.4%
fma-undefine3.4%
unpow23.4%
associate--r+3.4%
+-inverses3.4%
metadata-eval3.4%
metadata-eval3.4%
*-rgt-identity3.4%
associate-/l*3.4%
fma-undefine3.4%
unpow23.4%
associate--r+37.9%
Simplified100.0%
*-un-lft-identity100.0%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod99.1%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -1 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) < 2.0000000000000001e-4Initial program 8.1%
Taylor expanded in x around 0 9.0%
Simplified100.0%
if 2.0000000000000001e-4 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) Initial program 68.9%
+-commutative68.9%
hypot-1-def99.7%
Simplified99.7%
(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.0002)
(copysign
(*
x
(+
1.0
(*
(pow x 2.0)
(-
(* (* x x) (+ 0.075 (* (* x x) -0.044642857142857144)))
0.16666666666666666))))
x)
(copysign (log (+ (fabs 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 <= -1.0) {
tmp = copysign(log((hypot(1.0, x) - x)), x);
} else if (t_0 <= 0.0002) {
tmp = copysign((x * (1.0 + (pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x);
} else {
tmp = copysign(log((fabs(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 <= -1.0) {
tmp = Math.copySign(Math.log((Math.hypot(1.0, x) - x)), x);
} else if (t_0 <= 0.0002) {
tmp = Math.copySign((x * (1.0 + (Math.pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x);
} else {
tmp = Math.copySign(Math.log((Math.abs(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 <= -1.0: tmp = math.copysign(math.log((math.hypot(1.0, x) - x)), x) elif t_0 <= 0.0002: tmp = math.copysign((x * (1.0 + (math.pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x) else: tmp = math.copysign(math.log((math.fabs(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 <= -1.0) tmp = copysign(log(Float64(hypot(1.0, x) - x)), x); elseif (t_0 <= 0.0002) tmp = copysign(Float64(x * Float64(1.0 + Float64((x ^ 2.0) * Float64(Float64(Float64(x * x) * Float64(0.075 + Float64(Float64(x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x); else tmp = copysign(log(Float64(abs(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 <= -1.0) tmp = sign(x) * abs(log((hypot(1.0, x) - x))); elseif (t_0 <= 0.0002) tmp = sign(x) * abs((x * (1.0 + ((x ^ 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666))))); else tmp = sign(x) * abs(log((abs(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, -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.0002], N[With[{TMP1 = Abs[N[(x * N[(1.0 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * N[(0.075 + N[(N[(x * x), $MachinePrecision] * -0.044642857142857144), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(N[Abs[x], $MachinePrecision] + 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 -1:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;t\_0 \leq 0.0002:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + {x}^{2} \cdot \left(\left(x \cdot x\right) \cdot \left(0.075 + \left(x \cdot x\right) \cdot -0.044642857142857144\right) - 0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\left|x\right| + \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) #s(literal 1 binary64))))) x) < -1Initial program 39.9%
flip-+2.3%
clear-num2.3%
log-div2.3%
metadata-eval2.3%
+-commutative2.3%
hypot-1-def2.3%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt3.4%
Applied egg-rr3.4%
neg-sub03.4%
div-sub3.4%
*-rgt-identity3.4%
associate-/l*3.4%
fmm-def3.4%
fma-undefine3.4%
unpow23.4%
associate--r+3.4%
+-inverses3.4%
metadata-eval3.4%
metadata-eval3.4%
*-rgt-identity3.4%
associate-/l*3.4%
fma-undefine3.4%
unpow23.4%
associate--r+37.9%
Simplified100.0%
*-un-lft-identity100.0%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod99.1%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -1 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) < 2.0000000000000001e-4Initial program 8.1%
flip-+8.0%
clear-num8.0%
log-div7.9%
metadata-eval7.9%
+-commutative7.9%
hypot-1-def7.9%
add-sqr-sqrt5.3%
fabs-sqr5.3%
add-sqr-sqrt7.9%
Applied egg-rr8.0%
neg-sub08.0%
div-sub7.9%
*-rgt-identity7.9%
associate-/l*7.9%
fmm-def7.9%
fma-undefine7.9%
unpow27.9%
associate--r+7.9%
+-inverses7.9%
metadata-eval7.9%
metadata-eval7.9%
*-rgt-identity7.9%
associate-/l*7.9%
fma-undefine7.9%
unpow27.9%
associate--r+8.0%
Simplified8.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
Applied egg-rr100.0%
unpow2100.0%
Applied egg-rr100.0%
if 2.0000000000000001e-4 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) Initial program 68.9%
+-commutative68.9%
hypot-1-def99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (x)
:precision binary64
(if (<= x -0.022)
(copysign (log (- (hypot 1.0 x) x)) x)
(if (<= x 0.0245)
(copysign
(*
x
(+
1.0
(*
(pow x 2.0)
(-
(* (* x x) (+ 0.075 (* (* x x) -0.044642857142857144)))
0.16666666666666666))))
x)
(copysign (log (+ x (hypot 1.0 x))) x))))
double code(double x) {
double tmp;
if (x <= -0.022) {
tmp = copysign(log((hypot(1.0, x) - x)), x);
} else if (x <= 0.0245) {
tmp = copysign((x * (1.0 + (pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x);
} else {
tmp = copysign(log((x + hypot(1.0, x))), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -0.022) {
tmp = Math.copySign(Math.log((Math.hypot(1.0, x) - x)), x);
} else if (x <= 0.0245) {
tmp = Math.copySign((x * (1.0 + (Math.pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x);
} else {
tmp = Math.copySign(Math.log((x + Math.hypot(1.0, x))), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -0.022: tmp = math.copysign(math.log((math.hypot(1.0, x) - x)), x) elif x <= 0.0245: tmp = math.copysign((x * (1.0 + (math.pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), 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.022) tmp = copysign(log(Float64(hypot(1.0, x) - x)), x); elseif (x <= 0.0245) tmp = copysign(Float64(x * Float64(1.0 + Float64((x ^ 2.0) * Float64(Float64(Float64(x * x) * Float64(0.075 + Float64(Float64(x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x); else tmp = copysign(log(Float64(x + hypot(1.0, x))), x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -0.022) tmp = sign(x) * abs(log((hypot(1.0, x) - x))); elseif (x <= 0.0245) tmp = sign(x) * abs((x * (1.0 + ((x ^ 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666))))); else tmp = sign(x) * abs(log((x + hypot(1.0, x)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -0.022], 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[x, 0.0245], N[With[{TMP1 = Abs[N[(x * N[(1.0 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * N[(0.075 + N[(N[(x * x), $MachinePrecision] * -0.044642857142857144), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;x \leq -0.022:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;x \leq 0.0245:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + {x}^{2} \cdot \left(\left(x \cdot x\right) \cdot \left(0.075 + \left(x \cdot x\right) \cdot -0.044642857142857144\right) - 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 x < -0.021999999999999999Initial program 39.9%
flip-+2.3%
clear-num2.3%
log-div2.3%
metadata-eval2.3%
+-commutative2.3%
hypot-1-def2.3%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt3.4%
Applied egg-rr3.4%
neg-sub03.4%
div-sub3.4%
*-rgt-identity3.4%
associate-/l*3.4%
fmm-def3.4%
fma-undefine3.4%
unpow23.4%
associate--r+3.4%
+-inverses3.4%
metadata-eval3.4%
metadata-eval3.4%
*-rgt-identity3.4%
associate-/l*3.4%
fma-undefine3.4%
unpow23.4%
associate--r+37.9%
Simplified100.0%
*-un-lft-identity100.0%
add-sqr-sqrt0.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod99.1%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
*-lft-identity100.0%
Simplified100.0%
if -0.021999999999999999 < x < 0.024500000000000001Initial program 8.1%
flip-+8.0%
clear-num8.0%
log-div7.9%
metadata-eval7.9%
+-commutative7.9%
hypot-1-def7.9%
add-sqr-sqrt5.3%
fabs-sqr5.3%
add-sqr-sqrt7.9%
Applied egg-rr8.0%
neg-sub08.0%
div-sub7.9%
*-rgt-identity7.9%
associate-/l*7.9%
fmm-def7.9%
fma-undefine7.9%
unpow27.9%
associate--r+7.9%
+-inverses7.9%
metadata-eval7.9%
metadata-eval7.9%
*-rgt-identity7.9%
associate-/l*7.9%
fma-undefine7.9%
unpow27.9%
associate--r+8.0%
Simplified8.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
Applied egg-rr100.0%
unpow2100.0%
Applied egg-rr100.0%
if 0.024500000000000001 < x Initial program 68.9%
Taylor expanded in x around 0 68.9%
rem-square-sqrt68.9%
fabs-sqr68.9%
metadata-eval68.9%
unpow268.9%
hypot-undefine99.7%
rem-square-sqrt99.7%
Simplified99.7%
Final simplification99.9%
(FPCore (x)
:precision binary64
(if (<= x -1.25)
(copysign (log (/ -0.5 x)) x)
(if (<= x 0.0245)
(copysign
(*
x
(+
1.0
(*
(pow x 2.0)
(-
(* (* x x) (+ 0.075 (* (* x x) -0.044642857142857144)))
0.16666666666666666))))
x)
(copysign (log (+ x (hypot 1.0 x))) x))))
double code(double x) {
double tmp;
if (x <= -1.25) {
tmp = copysign(log((-0.5 / x)), x);
} else if (x <= 0.0245) {
tmp = copysign((x * (1.0 + (pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x);
} else {
tmp = copysign(log((x + hypot(1.0, 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.0245) {
tmp = Math.copySign((x * (1.0 + (Math.pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x);
} else {
tmp = Math.copySign(Math.log((x + Math.hypot(1.0, 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.0245: tmp = math.copysign((x * (1.0 + (math.pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x) else: tmp = math.copysign(math.log((x + math.hypot(1.0, 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.0245) tmp = copysign(Float64(x * Float64(1.0 + Float64((x ^ 2.0) * Float64(Float64(Float64(x * x) * Float64(0.075 + Float64(Float64(x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x); else tmp = copysign(log(Float64(x + hypot(1.0, 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.0245) tmp = sign(x) * abs((x * (1.0 + ((x ^ 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666))))); else tmp = sign(x) * abs(log((x + hypot(1.0, 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.0245], N[With[{TMP1 = Abs[N[(x * N[(1.0 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * N[(0.075 + N[(N[(x * x), $MachinePrecision] * -0.044642857142857144), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;x \leq -1.25:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-0.5}{x}\right), x\right)\\
\mathbf{elif}\;x \leq 0.0245:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + {x}^{2} \cdot \left(\left(x \cdot x\right) \cdot \left(0.075 + \left(x \cdot x\right) \cdot -0.044642857142857144\right) - 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 x < -1.25Initial program 39.9%
Taylor expanded in x around 0 39.9%
rem-square-sqrt0.0%
fabs-sqr0.0%
metadata-eval0.0%
unpow20.0%
hypot-undefine0.0%
rem-square-sqrt5.3%
Simplified5.3%
Taylor expanded in x around -inf 98.7%
if -1.25 < x < 0.024500000000000001Initial program 8.1%
flip-+8.0%
clear-num8.0%
log-div7.9%
metadata-eval7.9%
+-commutative7.9%
hypot-1-def7.9%
add-sqr-sqrt5.3%
fabs-sqr5.3%
add-sqr-sqrt7.9%
Applied egg-rr8.0%
neg-sub08.0%
div-sub7.9%
*-rgt-identity7.9%
associate-/l*7.9%
fmm-def7.9%
fma-undefine7.9%
unpow27.9%
associate--r+7.9%
+-inverses7.9%
metadata-eval7.9%
metadata-eval7.9%
*-rgt-identity7.9%
associate-/l*7.9%
fma-undefine7.9%
unpow27.9%
associate--r+8.0%
Simplified8.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
Applied egg-rr100.0%
unpow2100.0%
Applied egg-rr100.0%
if 0.024500000000000001 < x Initial program 68.9%
Taylor expanded in x around 0 68.9%
rem-square-sqrt68.9%
fabs-sqr68.9%
metadata-eval68.9%
unpow268.9%
hypot-undefine99.7%
rem-square-sqrt99.7%
Simplified99.7%
Final simplification99.6%
(FPCore (x)
:precision binary64
(if (<= x -1.25)
(copysign (log (/ -0.5 x)) x)
(if (<= x 1.25)
(copysign
(*
x
(+
1.0
(*
(pow x 2.0)
(-
(* (* x x) (+ 0.075 (* (* x x) -0.044642857142857144)))
0.16666666666666666))))
x)
(copysign (log (* x 2.0)) 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 * (1.0 + (pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x);
} else {
tmp = copysign(log((x * 2.0)), 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 * (1.0 + (Math.pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x);
} else {
tmp = Math.copySign(Math.log((x * 2.0)), 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 * (1.0 + (math.pow(x, 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x) else: tmp = math.copysign(math.log((x * 2.0)), 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(Float64(x * Float64(1.0 + Float64((x ^ 2.0) * Float64(Float64(Float64(x * x) * Float64(0.075 + Float64(Float64(x * x) * -0.044642857142857144))) - 0.16666666666666666)))), x); else tmp = copysign(log(Float64(x * 2.0)), 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 * (1.0 + ((x ^ 2.0) * (((x * x) * (0.075 + ((x * x) * -0.044642857142857144))) - 0.16666666666666666))))); else tmp = sign(x) * abs(log((x * 2.0))); 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[N[(x * N[(1.0 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(N[(x * x), $MachinePrecision] * N[(0.075 + N[(N[(x * x), $MachinePrecision] * -0.044642857142857144), $MachinePrecision]), $MachinePrecision]), $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 * 2.0), $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 \cdot \left(1 + {x}^{2} \cdot \left(\left(x \cdot x\right) \cdot \left(0.075 + \left(x \cdot x\right) \cdot -0.044642857142857144\right) - 0.16666666666666666\right)\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\
\end{array}
\end{array}
if x < -1.25Initial program 39.9%
Taylor expanded in x around 0 39.9%
rem-square-sqrt0.0%
fabs-sqr0.0%
metadata-eval0.0%
unpow20.0%
hypot-undefine0.0%
rem-square-sqrt5.3%
Simplified5.3%
Taylor expanded in x around -inf 98.7%
if -1.25 < x < 1.25Initial program 10.6%
flip-+10.6%
clear-num10.6%
log-div10.5%
metadata-eval10.5%
+-commutative10.5%
hypot-1-def10.5%
add-sqr-sqrt7.9%
fabs-sqr7.9%
add-sqr-sqrt10.5%
Applied egg-rr10.6%
neg-sub010.6%
div-sub10.5%
*-rgt-identity10.5%
associate-/l*10.5%
fmm-def10.5%
fma-undefine10.5%
unpow210.5%
associate--r+10.5%
+-inverses10.5%
metadata-eval10.5%
metadata-eval10.5%
*-rgt-identity10.5%
associate-/l*10.5%
fma-undefine10.5%
unpow210.5%
associate--r+10.6%
Simplified10.6%
Taylor expanded in x around 0 99.2%
unpow299.2%
Applied egg-rr99.2%
unpow299.2%
Applied egg-rr99.2%
if 1.25 < x Initial program 67.2%
Taylor expanded in x around inf 100.0%
rem-square-sqrt100.0%
fabs-sqr100.0%
rem-square-sqrt100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification99.3%
(FPCore (x)
:precision binary64
(if (<= x -1.25)
(copysign (log (/ -0.5 x)) x)
(if (<= x 1.25)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) x)
(copysign (log (* x 2.0)) 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 + (-0.16666666666666666 * pow(x, 3.0))), x);
} else {
tmp = copysign(log((x * 2.0)), 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 + (-0.16666666666666666 * Math.pow(x, 3.0))), x);
} else {
tmp = Math.copySign(Math.log((x * 2.0)), 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 + (-0.16666666666666666 * math.pow(x, 3.0))), x) else: tmp = math.copysign(math.log((x * 2.0)), 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(Float64(x + Float64(-0.16666666666666666 * (x ^ 3.0))), x); else tmp = copysign(log(Float64(x * 2.0)), 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 + (-0.16666666666666666 * (x ^ 3.0)))); else tmp = sign(x) * abs(log((x * 2.0))); 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[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 * 2.0), $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 + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\
\end{array}
\end{array}
if x < -1.25Initial program 39.9%
Taylor expanded in x around 0 39.9%
rem-square-sqrt0.0%
fabs-sqr0.0%
metadata-eval0.0%
unpow20.0%
hypot-undefine0.0%
rem-square-sqrt5.3%
Simplified5.3%
Taylor expanded in x around -inf 98.7%
if -1.25 < x < 1.25Initial program 10.6%
flip-+10.6%
clear-num10.6%
log-div10.5%
metadata-eval10.5%
+-commutative10.5%
hypot-1-def10.5%
add-sqr-sqrt7.9%
fabs-sqr7.9%
add-sqr-sqrt10.5%
Applied egg-rr10.6%
neg-sub010.6%
div-sub10.5%
*-rgt-identity10.5%
associate-/l*10.5%
fmm-def10.5%
fma-undefine10.5%
unpow210.5%
associate--r+10.5%
+-inverses10.5%
metadata-eval10.5%
metadata-eval10.5%
*-rgt-identity10.5%
associate-/l*10.5%
fma-undefine10.5%
unpow210.5%
associate--r+10.6%
Simplified10.6%
Taylor expanded in x around 0 98.2%
distribute-rgt-in98.2%
*-lft-identity98.2%
associate-*l*98.2%
unpow298.2%
unpow398.2%
Simplified98.2%
if 1.25 < x Initial program 67.2%
Taylor expanded in x around inf 100.0%
rem-square-sqrt100.0%
fabs-sqr100.0%
rem-square-sqrt100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
(FPCore (x)
:precision binary64
(if (<= x -1.25)
(copysign (log (/ -0.5 x)) x)
(if (<= x 1.25)
(copysign (* x (+ 1.0 (* (* x x) -0.16666666666666666))) x)
(copysign (log (* x 2.0)) 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 * (1.0 + ((x * x) * -0.16666666666666666))), x);
} else {
tmp = copysign(log((x * 2.0)), 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 * (1.0 + ((x * x) * -0.16666666666666666))), x);
} else {
tmp = Math.copySign(Math.log((x * 2.0)), 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 * (1.0 + ((x * x) * -0.16666666666666666))), x) else: tmp = math.copysign(math.log((x * 2.0)), 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(Float64(x * Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666))), x); else tmp = copysign(log(Float64(x * 2.0)), 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 * (1.0 + ((x * x) * -0.16666666666666666)))); else tmp = sign(x) * abs(log((x * 2.0))); 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[N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x * 2.0), $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 \cdot \left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\
\end{array}
\end{array}
if x < -1.25Initial program 39.9%
Taylor expanded in x around 0 39.9%
rem-square-sqrt0.0%
fabs-sqr0.0%
metadata-eval0.0%
unpow20.0%
hypot-undefine0.0%
rem-square-sqrt5.3%
Simplified5.3%
Taylor expanded in x around -inf 98.7%
if -1.25 < x < 1.25Initial program 10.6%
flip-+10.6%
clear-num10.6%
log-div10.5%
metadata-eval10.5%
+-commutative10.5%
hypot-1-def10.5%
add-sqr-sqrt7.9%
fabs-sqr7.9%
add-sqr-sqrt10.5%
Applied egg-rr10.6%
neg-sub010.6%
div-sub10.5%
*-rgt-identity10.5%
associate-/l*10.5%
fmm-def10.5%
fma-undefine10.5%
unpow210.5%
associate--r+10.5%
+-inverses10.5%
metadata-eval10.5%
metadata-eval10.5%
*-rgt-identity10.5%
associate-/l*10.5%
fma-undefine10.5%
unpow210.5%
associate--r+10.6%
Simplified10.6%
Taylor expanded in x around 0 98.2%
*-commutative98.2%
Simplified98.2%
unpow299.2%
Applied egg-rr98.2%
if 1.25 < x Initial program 67.2%
Taylor expanded in x around inf 100.0%
rem-square-sqrt100.0%
fabs-sqr100.0%
rem-square-sqrt100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
(FPCore (x)
:precision binary64
(if (<= x -3.5)
(copysign (log (- x)) x)
(if (<= x 1.25)
(copysign (* x (+ 1.0 (* (* x x) -0.16666666666666666))) x)
(copysign (log (* x 2.0)) x))))
double code(double x) {
double tmp;
if (x <= -3.5) {
tmp = copysign(log(-x), x);
} else if (x <= 1.25) {
tmp = copysign((x * (1.0 + ((x * x) * -0.16666666666666666))), x);
} else {
tmp = copysign(log((x * 2.0)), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -3.5) {
tmp = Math.copySign(Math.log(-x), x);
} else if (x <= 1.25) {
tmp = Math.copySign((x * (1.0 + ((x * x) * -0.16666666666666666))), x);
} else {
tmp = Math.copySign(Math.log((x * 2.0)), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -3.5: tmp = math.copysign(math.log(-x), x) elif x <= 1.25: tmp = math.copysign((x * (1.0 + ((x * x) * -0.16666666666666666))), x) else: tmp = math.copysign(math.log((x * 2.0)), x) return tmp
function code(x) tmp = 0.0 if (x <= -3.5) tmp = copysign(log(Float64(-x)), x); elseif (x <= 1.25) tmp = copysign(Float64(x * Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666))), x); else tmp = copysign(log(Float64(x * 2.0)), x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= -3.5) tmp = sign(x) * abs(log(-x)); elseif (x <= 1.25) tmp = sign(x) * abs((x * (1.0 + ((x * x) * -0.16666666666666666)))); else tmp = sign(x) * abs(log((x * 2.0))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -3.5], 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[N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(x * 2.0), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(-x\right), x\right)\\
\mathbf{elif}\;x \leq 1.25:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\
\end{array}
\end{array}
if x < -3.5Initial program 38.8%
Taylor expanded in x around -inf 31.9%
neg-mul-131.9%
Simplified31.9%
if -3.5 < x < 1.25Initial program 11.3%
flip-+11.2%
clear-num11.2%
log-div11.2%
metadata-eval11.2%
+-commutative11.2%
hypot-1-def11.1%
add-sqr-sqrt7.9%
fabs-sqr7.9%
add-sqr-sqrt11.1%
Applied egg-rr11.2%
neg-sub011.2%
div-sub11.2%
*-rgt-identity11.2%
associate-/l*11.2%
fmm-def11.2%
fma-undefine11.2%
unpow211.2%
associate--r+11.2%
+-inverses11.2%
metadata-eval11.2%
metadata-eval11.2%
*-rgt-identity11.2%
associate-/l*11.2%
fma-undefine11.2%
unpow211.2%
associate--r+11.3%
Simplified11.3%
Taylor expanded in x around 0 97.7%
*-commutative97.7%
Simplified97.7%
unpow298.6%
Applied egg-rr97.7%
if 1.25 < x Initial program 67.2%
Taylor expanded in x around inf 100.0%
rem-square-sqrt100.0%
fabs-sqr100.0%
rem-square-sqrt100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
(FPCore (x) :precision binary64 (if (<= x -1.0) (copysign (log (- x)) x) (copysign (log1p x) x)))
double code(double x) {
double tmp;
if (x <= -1.0) {
tmp = copysign(log(-x), x);
} else {
tmp = copysign(log1p(x), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -1.0) {
tmp = Math.copySign(Math.log(-x), x);
} else {
tmp = Math.copySign(Math.log1p(x), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -1.0: 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 <= -1.0) tmp = copysign(log(Float64(-x)), x); else tmp = copysign(log1p(x), x); end return tmp end
code[x_] := If[LessEqual[x, -1.0], 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 -1:\\
\;\;\;\;\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 < -1Initial program 39.9%
Taylor expanded in x around -inf 31.7%
neg-mul-131.7%
Simplified31.7%
if -1 < x Initial program 28.3%
Taylor expanded in x around 0 14.9%
log1p-define75.7%
rem-square-sqrt51.0%
fabs-sqr51.0%
rem-square-sqrt75.7%
Simplified75.7%
(FPCore (x) :precision binary64 (if (<= x 1.55) (copysign (* x (+ 1.0 (* (* x x) -0.16666666666666666))) x) (copysign (log1p x) x)))
double code(double x) {
double tmp;
if (x <= 1.55) {
tmp = copysign((x * (1.0 + ((x * x) * -0.16666666666666666))), x);
} else {
tmp = copysign(log1p(x), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 1.55) {
tmp = Math.copySign((x * (1.0 + ((x * x) * -0.16666666666666666))), x);
} else {
tmp = Math.copySign(Math.log1p(x), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.55: tmp = math.copysign((x * (1.0 + ((x * x) * -0.16666666666666666))), x) else: tmp = math.copysign(math.log1p(x), x) return tmp
function code(x) tmp = 0.0 if (x <= 1.55) tmp = copysign(Float64(x * Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666))), x); else tmp = copysign(log1p(x), x); end return tmp end
code[x_] := If[LessEqual[x, 1.55], N[With[{TMP1 = Abs[N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $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 1.55:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\mathsf{log1p}\left(x\right), x\right)\\
\end{array}
\end{array}
if x < 1.55000000000000004Initial program 19.4%
flip-+8.1%
clear-num8.1%
log-div8.1%
metadata-eval8.1%
+-commutative8.1%
hypot-1-def8.0%
add-sqr-sqrt5.6%
fabs-sqr5.6%
add-sqr-sqrt8.4%
Applied egg-rr8.4%
neg-sub08.4%
div-sub8.4%
*-rgt-identity8.4%
associate-/l*8.4%
fmm-def8.4%
fma-undefine8.4%
unpow28.4%
associate--r+8.4%
+-inverses8.4%
metadata-eval8.4%
metadata-eval8.4%
*-rgt-identity8.4%
associate-/l*8.4%
fma-undefine8.4%
unpow28.4%
associate--r+18.8%
Simplified37.3%
Taylor expanded in x around 0 70.0%
*-commutative70.0%
Simplified70.0%
unpow270.6%
Applied egg-rr70.0%
if 1.55000000000000004 < x Initial program 67.2%
Taylor expanded in x around 0 30.9%
log1p-define30.9%
rem-square-sqrt30.9%
fabs-sqr30.9%
rem-square-sqrt30.9%
Simplified30.9%
(FPCore (x) :precision binary64 (if (<= x 3.4) (copysign (* x (+ 1.0 (* (* x x) -0.16666666666666666))) x) (copysign (log x) x)))
double code(double x) {
double tmp;
if (x <= 3.4) {
tmp = copysign((x * (1.0 + ((x * x) * -0.16666666666666666))), x);
} else {
tmp = copysign(log(x), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= 3.4) {
tmp = Math.copySign((x * (1.0 + ((x * x) * -0.16666666666666666))), x);
} else {
tmp = Math.copySign(Math.log(x), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 3.4: tmp = math.copysign((x * (1.0 + ((x * x) * -0.16666666666666666))), x) else: tmp = math.copysign(math.log(x), x) return tmp
function code(x) tmp = 0.0 if (x <= 3.4) tmp = copysign(Float64(x * Float64(1.0 + Float64(Float64(x * x) * -0.16666666666666666))), x); else tmp = copysign(log(x), x); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 3.4) tmp = sign(x) * abs((x * (1.0 + ((x * x) * -0.16666666666666666)))); else tmp = sign(x) * abs(log(x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 3.4], N[With[{TMP1 = Abs[N[(x * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[x], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + \left(x \cdot x\right) \cdot -0.16666666666666666\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log x, x\right)\\
\end{array}
\end{array}
if x < 3.39999999999999991Initial program 19.4%
flip-+8.1%
clear-num8.1%
log-div8.1%
metadata-eval8.1%
+-commutative8.1%
hypot-1-def8.0%
add-sqr-sqrt5.6%
fabs-sqr5.6%
add-sqr-sqrt8.4%
Applied egg-rr8.4%
neg-sub08.4%
div-sub8.4%
*-rgt-identity8.4%
associate-/l*8.4%
fmm-def8.4%
fma-undefine8.4%
unpow28.4%
associate--r+8.4%
+-inverses8.4%
metadata-eval8.4%
metadata-eval8.4%
*-rgt-identity8.4%
associate-/l*8.4%
fma-undefine8.4%
unpow28.4%
associate--r+18.8%
Simplified37.3%
Taylor expanded in x around 0 70.0%
*-commutative70.0%
Simplified70.0%
unpow270.6%
Applied egg-rr70.0%
if 3.39999999999999991 < x Initial program 67.2%
Taylor expanded in x around inf 30.9%
mul-1-neg30.9%
log-rec30.9%
remove-double-neg30.9%
Simplified30.9%
(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 31.0%
flip-+6.1%
clear-num6.1%
log-div6.1%
metadata-eval6.1%
+-commutative6.1%
hypot-1-def6.1%
add-sqr-sqrt4.3%
fabs-sqr4.3%
add-sqr-sqrt6.4%
Applied egg-rr6.4%
neg-sub06.4%
div-sub6.4%
*-rgt-identity6.4%
associate-/l*6.4%
fmm-def6.4%
fma-undefine6.4%
unpow26.4%
associate--r+6.4%
+-inverses6.4%
metadata-eval6.4%
metadata-eval6.4%
*-rgt-identity6.4%
associate-/l*6.4%
fma-undefine6.4%
unpow26.4%
associate--r+14.7%
Simplified29.1%
Taylor expanded in x around 0 54.2%
(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 2024181
(FPCore (x)
:name "Rust f64::asinh"
:precision binary64
:alt
(! :herbie-platform default (let* ((ax (fabs x)) (ix (/ 1 ax))) (copysign (log1p (+ ax (/ ax (+ (hypot 1 ix) ix)))) x)))
(copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x))