
(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 13 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)))
(if (<= t_0 -4.0)
(copysign (log (- (hypot 1.0 x) x)) x)
(if (<= t_0 0.02)
(copysign
(+
x
(*
(fma
(pow x 2.0)
(fma (pow x 2.0) -0.044642857142857144 0.075)
-0.16666666666666666)
(pow x 3.0)))
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 <= -4.0) {
tmp = copysign(log((hypot(1.0, x) - x)), x);
} else if (t_0 <= 0.02) {
tmp = copysign((x + (fma(pow(x, 2.0), fma(pow(x, 2.0), -0.044642857142857144, 0.075), -0.16666666666666666) * pow(x, 3.0))), 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) tmp = 0.0 if (t_0 <= -4.0) tmp = copysign(log(Float64(hypot(1.0, x) - x)), x); elseif (t_0 <= 0.02) tmp = copysign(Float64(x + Float64(fma((x ^ 2.0), fma((x ^ 2.0), -0.044642857142857144, 0.075), -0.16666666666666666) * (x ^ 3.0))), 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, -4.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.02], N[With[{TMP1 = Abs[N[(x + N[(N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[Power[x, 2.0], $MachinePrecision] * -0.044642857142857144 + 0.075), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * 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[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 -4:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;\mathsf{copysign}\left(x + \mathsf{fma}\left({x}^{2}, \mathsf{fma}\left({x}^{2}, -0.044642857142857144, 0.075\right), -0.16666666666666666\right) \cdot {x}^{3}, 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) #s(literal 1 binary64))))) x) < -4Initial program 48.1%
add-cube-cbrt48.0%
pow348.0%
*-un-lft-identity48.0%
*-un-lft-identity48.0%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt4.5%
+-commutative4.5%
hypot-1-def4.5%
Applied egg-rr4.5%
rem-cube-cbrt4.5%
+-commutative4.5%
Applied egg-rr4.5%
add-exp-log4.5%
add-sqr-sqrt0.0%
sqrt-unprod4.5%
sqr-neg4.5%
+-commutative4.5%
log-rec4.5%
+-commutative4.5%
log-rec4.5%
sqrt-unprod4.5%
add-sqr-sqrt4.5%
add-exp-log4.5%
flip-+1.4%
associate-/r/1.4%
Applied egg-rr1.4%
+-commutative1.4%
associate--r+46.4%
+-inverses100.0%
metadata-eval100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
if -4 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) < 0.0200000000000000004Initial program 7.9%
add-cube-cbrt7.8%
pow37.8%
*-un-lft-identity7.8%
*-un-lft-identity7.8%
add-sqr-sqrt3.1%
fabs-sqr3.1%
add-sqr-sqrt7.9%
+-commutative7.9%
hypot-1-def7.9%
Applied egg-rr7.9%
Taylor expanded in x around 0 100.0%
distribute-rgt-in100.0%
*-lft-identity100.0%
*-commutative100.0%
associate-*l*100.0%
fma-neg100.0%
+-commutative100.0%
*-commutative100.0%
fma-define100.0%
metadata-eval100.0%
unpow2100.0%
unpow3100.0%
Simplified100.0%
if 0.0200000000000000004 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) Initial program 54.9%
*-un-lft-identity54.9%
*-commutative54.9%
log-prod54.9%
+-commutative54.9%
hypot-1-def98.3%
add-sqr-sqrt98.3%
fabs-sqr98.3%
add-sqr-sqrt98.3%
metadata-eval98.3%
Applied egg-rr98.3%
+-rgt-identity98.3%
Simplified98.3%
(FPCore (x)
:precision binary64
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -4.0)
(copysign (log (- (hypot 1.0 x) x)) x)
(if (<= t_0 0.02)
(copysign
(*
x
(+
1.0
(*
(pow x 2.0)
(-
(* (pow x 2.0) (+ 0.075 (* (pow x 2.0) -0.044642857142857144)))
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 <= -4.0) {
tmp = copysign(log((hypot(1.0, x) - x)), x);
} else if (t_0 <= 0.02) {
tmp = copysign((x * (1.0 + (pow(x, 2.0) * ((pow(x, 2.0) * (0.075 + (pow(x, 2.0) * -0.044642857142857144))) - 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 <= -4.0) {
tmp = Math.copySign(Math.log((Math.hypot(1.0, x) - x)), x);
} else if (t_0 <= 0.02) {
tmp = Math.copySign((x * (1.0 + (Math.pow(x, 2.0) * ((Math.pow(x, 2.0) * (0.075 + (Math.pow(x, 2.0) * -0.044642857142857144))) - 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 <= -4.0: tmp = math.copysign(math.log((math.hypot(1.0, x) - x)), x) elif t_0 <= 0.02: tmp = math.copysign((x * (1.0 + (math.pow(x, 2.0) * ((math.pow(x, 2.0) * (0.075 + (math.pow(x, 2.0) * -0.044642857142857144))) - 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 <= -4.0) tmp = copysign(log(Float64(hypot(1.0, x) - x)), x); elseif (t_0 <= 0.02) tmp = copysign(Float64(x * Float64(1.0 + Float64((x ^ 2.0) * Float64(Float64((x ^ 2.0) * Float64(0.075 + Float64((x ^ 2.0) * -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) t_0 = sign(x) * abs(log((abs(x) + sqrt(((x * x) + 1.0))))); tmp = 0.0; if (t_0 <= -4.0) tmp = sign(x) * abs(log((hypot(1.0, x) - x))); elseif (t_0 <= 0.02) tmp = sign(x) * abs((x * (1.0 + ((x ^ 2.0) * (((x ^ 2.0) * (0.075 + ((x ^ 2.0) * -0.044642857142857144))) - 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, -4.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.02], N[With[{TMP1 = Abs[N[(x * N[(1.0 + N[(N[Power[x, 2.0], $MachinePrecision] * N[(N[(N[Power[x, 2.0], $MachinePrecision] * N[(0.075 + N[(N[Power[x, 2.0], $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}
t_0 := \mathsf{copysign}\left(\log \left(\left|x\right| + \sqrt{x \cdot x + 1}\right), x\right)\\
\mathbf{if}\;t\_0 \leq -4:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;t\_0 \leq 0.02:\\
\;\;\;\;\mathsf{copysign}\left(x \cdot \left(1 + {x}^{2} \cdot \left({x}^{2} \cdot \left(0.075 + {x}^{2} \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 (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) < -4Initial program 48.1%
add-cube-cbrt48.0%
pow348.0%
*-un-lft-identity48.0%
*-un-lft-identity48.0%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt4.5%
+-commutative4.5%
hypot-1-def4.5%
Applied egg-rr4.5%
rem-cube-cbrt4.5%
+-commutative4.5%
Applied egg-rr4.5%
add-exp-log4.5%
add-sqr-sqrt0.0%
sqrt-unprod4.5%
sqr-neg4.5%
+-commutative4.5%
log-rec4.5%
+-commutative4.5%
log-rec4.5%
sqrt-unprod4.5%
add-sqr-sqrt4.5%
add-exp-log4.5%
flip-+1.4%
associate-/r/1.4%
Applied egg-rr1.4%
+-commutative1.4%
associate--r+46.4%
+-inverses100.0%
metadata-eval100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
if -4 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) < 0.0200000000000000004Initial program 7.9%
add-cube-cbrt7.8%
pow37.8%
*-un-lft-identity7.8%
*-un-lft-identity7.8%
add-sqr-sqrt3.1%
fabs-sqr3.1%
add-sqr-sqrt7.9%
+-commutative7.9%
hypot-1-def7.9%
Applied egg-rr7.9%
Taylor expanded in x around 0 100.0%
if 0.0200000000000000004 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) Initial program 54.9%
*-un-lft-identity54.9%
*-commutative54.9%
log-prod54.9%
+-commutative54.9%
hypot-1-def98.3%
add-sqr-sqrt98.3%
fabs-sqr98.3%
add-sqr-sqrt98.3%
metadata-eval98.3%
Applied egg-rr98.3%
+-rgt-identity98.3%
Simplified98.3%
Final simplification99.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -4.0)
(copysign (log (- (hypot 1.0 x) x)) x)
(if (<= t_0 0.0)
(copysign
(+ x (* (pow x 3.0) (- (* (pow x 2.0) 0.075) 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 <= -4.0) {
tmp = copysign(log((hypot(1.0, x) - x)), x);
} else if (t_0 <= 0.0) {
tmp = copysign((x + (pow(x, 3.0) * ((pow(x, 2.0) * 0.075) - 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 <= -4.0) {
tmp = Math.copySign(Math.log((Math.hypot(1.0, x) - x)), x);
} else if (t_0 <= 0.0) {
tmp = Math.copySign((x + (Math.pow(x, 3.0) * ((Math.pow(x, 2.0) * 0.075) - 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 <= -4.0: tmp = math.copysign(math.log((math.hypot(1.0, x) - x)), x) elif t_0 <= 0.0: tmp = math.copysign((x + (math.pow(x, 3.0) * ((math.pow(x, 2.0) * 0.075) - 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 <= -4.0) tmp = copysign(log(Float64(hypot(1.0, x) - x)), x); elseif (t_0 <= 0.0) tmp = copysign(Float64(x + Float64((x ^ 3.0) * Float64(Float64((x ^ 2.0) * 0.075) - 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 <= -4.0) tmp = sign(x) * abs(log((hypot(1.0, x) - x))); elseif (t_0 <= 0.0) tmp = sign(x) * abs((x + ((x ^ 3.0) * (((x ^ 2.0) * 0.075) - 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, -4.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[(N[Power[x, 3.0], $MachinePrecision] * N[(N[(N[Power[x, 2.0], $MachinePrecision] * 0.075), $MachinePrecision] - 0.16666666666666666), $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 -4:\\
\;\;\;\;\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 + {x}^{3} \cdot \left({x}^{2} \cdot 0.075 - 0.16666666666666666\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) #s(literal 1 binary64))))) x) < -4Initial program 48.1%
add-cube-cbrt48.0%
pow348.0%
*-un-lft-identity48.0%
*-un-lft-identity48.0%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt4.5%
+-commutative4.5%
hypot-1-def4.5%
Applied egg-rr4.5%
rem-cube-cbrt4.5%
+-commutative4.5%
Applied egg-rr4.5%
add-exp-log4.5%
add-sqr-sqrt0.0%
sqrt-unprod4.5%
sqr-neg4.5%
+-commutative4.5%
log-rec4.5%
+-commutative4.5%
log-rec4.5%
sqrt-unprod4.5%
add-sqr-sqrt4.5%
add-exp-log4.5%
flip-+1.4%
associate-/r/1.4%
Applied egg-rr1.4%
+-commutative1.4%
associate--r+46.4%
+-inverses100.0%
metadata-eval100.0%
metadata-eval100.0%
neg-mul-1100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
sub-neg100.0%
Simplified100.0%
if -4 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) < -0.0Initial program 7.3%
add-cube-cbrt7.2%
pow37.2%
*-un-lft-identity7.2%
*-un-lft-identity7.2%
add-sqr-sqrt2.4%
fabs-sqr2.4%
add-sqr-sqrt7.2%
+-commutative7.2%
hypot-1-def7.2%
Applied egg-rr7.2%
Taylor expanded in x around 0 100.0%
distribute-rgt-in100.0%
*-lft-identity100.0%
*-commutative100.0%
associate-*l*100.0%
fma-neg100.0%
+-commutative100.0%
*-commutative100.0%
fma-define100.0%
metadata-eval100.0%
unpow2100.0%
unpow3100.0%
Simplified100.0%
Taylor expanded in x around 0 99.9%
if -0.0 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) Initial program 55.6%
*-un-lft-identity55.6%
*-commutative55.6%
log-prod55.6%
+-commutative55.6%
hypot-1-def98.2%
add-sqr-sqrt98.2%
fabs-sqr98.2%
add-sqr-sqrt98.2%
metadata-eval98.2%
Applied egg-rr98.2%
+-rgt-identity98.2%
Simplified98.2%
Final simplification99.5%
(FPCore (x)
:precision binary64
(let* ((t_0 (copysign (log (+ (fabs x) (sqrt (+ (* x x) 1.0)))) x)))
(if (<= t_0 -0.005)
(copysign (* 2.0 (log (pow (- (hypot 1.0 x) x) -0.5))) x)
(if (<= t_0 0.0) (copysign 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.005) {
tmp = copysign((2.0 * log(pow((hypot(1.0, x) - x), -0.5))), x);
} else if (t_0 <= 0.0) {
tmp = copysign(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.005) {
tmp = Math.copySign((2.0 * Math.log(Math.pow((Math.hypot(1.0, x) - x), -0.5))), x);
} else if (t_0 <= 0.0) {
tmp = Math.copySign(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.005: tmp = math.copysign((2.0 * math.log(math.pow((math.hypot(1.0, x) - x), -0.5))), x) elif t_0 <= 0.0: tmp = math.copysign(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.005) tmp = copysign(Float64(2.0 * log((Float64(hypot(1.0, x) - x) ^ -0.5))), x); elseif (t_0 <= 0.0) tmp = copysign(x, 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 <= -0.005) tmp = sign(x) * abs((2.0 * log(((hypot(1.0, x) - x) ^ -0.5)))); elseif (t_0 <= 0.0) tmp = sign(x) * abs(x); 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, -0.005], N[With[{TMP1 = Abs[N[(2.0 * N[Log[N[Power[N[(N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision] - x), $MachinePrecision], -0.5], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[With[{TMP1 = Abs[x], 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.005:\\
\;\;\;\;\mathsf{copysign}\left(2 \cdot \log \left({\left(\mathsf{hypot}\left(1, x\right) - x\right)}^{-0.5}\right), x\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{copysign}\left(x, 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) #s(literal 1 binary64))))) x) < -0.0050000000000000001Initial program 48.6%
add-cube-cbrt48.6%
pow348.6%
*-un-lft-identity48.6%
*-un-lft-identity48.6%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt5.7%
+-commutative5.7%
hypot-1-def5.7%
Applied egg-rr5.7%
rem-cube-cbrt5.7%
flip-+4.1%
div-sub4.1%
pow24.1%
hypot-1-def4.1%
hypot-1-def4.1%
add-sqr-sqrt4.0%
pow24.0%
Applied egg-rr4.0%
div-sub4.1%
remove-double-neg4.1%
distribute-frac-neg24.1%
distribute-frac-neg4.1%
+-commutative4.1%
associate--r+47.0%
+-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
+-commutative99.8%
sub-neg99.8%
Simplified99.8%
add-sqr-sqrt99.8%
log-prod99.9%
inv-pow99.9%
sqrt-pow199.9%
metadata-eval99.9%
inv-pow99.9%
sqrt-pow199.9%
metadata-eval99.9%
Applied egg-rr99.9%
count-299.9%
Simplified99.9%
if -0.0050000000000000001 < (copysign.f64 (log.f64 (+.f64 (fabs.f64 x) (sqrt.f64 (+.f64 (*.f64 x x) #s(literal 1 binary64))))) x) < -0.0Initial program 6.6%
add-cube-cbrt6.6%
pow36.6%
*-un-lft-identity6.6%
*-un-lft-identity6.6%
add-sqr-sqrt2.4%
fabs-sqr2.4%
add-sqr-sqrt6.5%
+-commutative6.5%
hypot-1-def6.5%
Applied egg-rr6.5%
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) #s(literal 1 binary64))))) x) Initial program 55.6%
*-un-lft-identity55.6%
*-commutative55.6%
log-prod55.6%
+-commutative55.6%
hypot-1-def98.2%
add-sqr-sqrt98.2%
fabs-sqr98.2%
add-sqr-sqrt98.2%
metadata-eval98.2%
Applied egg-rr98.2%
+-rgt-identity98.2%
Simplified98.2%
(FPCore (x) :precision binary64 (if (<= x -5.8e-6) (copysign (log (/ -1.0 (- x (hypot 1.0 x)))) x) (if (<= x 8e-6) (copysign x x) (copysign (log (+ x (hypot 1.0 x))) x))))
double code(double x) {
double tmp;
if (x <= -5.8e-6) {
tmp = copysign(log((-1.0 / (x - hypot(1.0, x)))), x);
} else if (x <= 8e-6) {
tmp = copysign(x, x);
} else {
tmp = copysign(log((x + hypot(1.0, x))), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -5.8e-6) {
tmp = Math.copySign(Math.log((-1.0 / (x - Math.hypot(1.0, x)))), x);
} else if (x <= 8e-6) {
tmp = Math.copySign(x, x);
} else {
tmp = Math.copySign(Math.log((x + Math.hypot(1.0, x))), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -5.8e-6: tmp = math.copysign(math.log((-1.0 / (x - math.hypot(1.0, x)))), x) elif x <= 8e-6: tmp = math.copysign(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 <= -5.8e-6) tmp = copysign(log(Float64(-1.0 / Float64(x - hypot(1.0, x)))), x); elseif (x <= 8e-6) tmp = copysign(x, 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 <= -5.8e-6) tmp = sign(x) * abs(log((-1.0 / (x - hypot(1.0, x))))); elseif (x <= 8e-6) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((x + hypot(1.0, x)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -5.8e-6], N[With[{TMP1 = Abs[N[Log[N[(-1.0 / N[(x - N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], If[LessEqual[x, 8e-6], N[With[{TMP1 = Abs[x], 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 -5.8 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{-1}{x - \mathsf{hypot}\left(1, x\right)}\right), x\right)\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{copysign}\left(x, 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 < -5.8000000000000004e-6Initial program 48.6%
+-commutative48.6%
hypot-1-def99.8%
flip-+2.6%
hypot-1-def2.6%
hypot-1-def2.6%
add-sqr-sqrt2.6%
+-commutative2.6%
hypot-1-def2.6%
+-commutative2.6%
div-sub2.5%
Applied egg-rr4.0%
div-sub4.1%
fma-undefine4.1%
unpow24.1%
associate--r+47.0%
+-inverses99.8%
metadata-eval99.8%
Simplified99.8%
if -5.8000000000000004e-6 < x < 7.99999999999999964e-6Initial program 6.6%
add-cube-cbrt6.6%
pow36.6%
*-un-lft-identity6.6%
*-un-lft-identity6.6%
add-sqr-sqrt2.4%
fabs-sqr2.4%
add-sqr-sqrt6.5%
+-commutative6.5%
hypot-1-def6.5%
Applied egg-rr6.5%
Taylor expanded in x around 0 100.0%
if 7.99999999999999964e-6 < x Initial program 55.6%
*-un-lft-identity55.6%
*-commutative55.6%
log-prod55.6%
+-commutative55.6%
hypot-1-def98.2%
add-sqr-sqrt98.2%
fabs-sqr98.2%
add-sqr-sqrt98.2%
metadata-eval98.2%
Applied egg-rr98.2%
+-rgt-identity98.2%
Simplified98.2%
(FPCore (x) :precision binary64 (if (<= x -5.5e-6) (copysign (log (- (hypot 1.0 x) x)) x) (if (<= x 8e-6) (copysign x x) (copysign (log (+ x (hypot 1.0 x))) x))))
double code(double x) {
double tmp;
if (x <= -5.5e-6) {
tmp = copysign(log((hypot(1.0, x) - x)), x);
} else if (x <= 8e-6) {
tmp = copysign(x, x);
} else {
tmp = copysign(log((x + hypot(1.0, x))), x);
}
return tmp;
}
public static double code(double x) {
double tmp;
if (x <= -5.5e-6) {
tmp = Math.copySign(Math.log((Math.hypot(1.0, x) - x)), x);
} else if (x <= 8e-6) {
tmp = Math.copySign(x, x);
} else {
tmp = Math.copySign(Math.log((x + Math.hypot(1.0, x))), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= -5.5e-6: tmp = math.copysign(math.log((math.hypot(1.0, x) - x)), x) elif x <= 8e-6: tmp = math.copysign(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 <= -5.5e-6) tmp = copysign(log(Float64(hypot(1.0, x) - x)), x); elseif (x <= 8e-6) tmp = copysign(x, 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 <= -5.5e-6) tmp = sign(x) * abs(log((hypot(1.0, x) - x))); elseif (x <= 8e-6) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((x + hypot(1.0, x)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, -5.5e-6], 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, 8e-6], N[With[{TMP1 = Abs[x], 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 -5.5 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\mathsf{hypot}\left(1, x\right) - x\right), x\right)\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{copysign}\left(x, 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 < -5.4999999999999999e-6Initial program 48.6%
add-cube-cbrt48.6%
pow348.6%
*-un-lft-identity48.6%
*-un-lft-identity48.6%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt5.7%
+-commutative5.7%
hypot-1-def5.7%
Applied egg-rr5.7%
rem-cube-cbrt5.7%
+-commutative5.7%
Applied egg-rr5.7%
add-exp-log5.7%
add-sqr-sqrt0.0%
sqrt-unprod5.7%
sqr-neg5.7%
+-commutative5.7%
log-rec5.7%
+-commutative5.7%
log-rec5.7%
sqrt-unprod5.7%
add-sqr-sqrt5.7%
add-exp-log5.7%
flip-+2.7%
associate-/r/2.7%
Applied egg-rr2.7%
+-commutative2.7%
associate--r+47.0%
+-inverses99.8%
metadata-eval99.8%
metadata-eval99.8%
neg-mul-199.8%
sub-neg99.8%
+-commutative99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
sub-neg99.8%
Simplified99.8%
if -5.4999999999999999e-6 < x < 7.99999999999999964e-6Initial program 6.6%
add-cube-cbrt6.6%
pow36.6%
*-un-lft-identity6.6%
*-un-lft-identity6.6%
add-sqr-sqrt2.4%
fabs-sqr2.4%
add-sqr-sqrt6.5%
+-commutative6.5%
hypot-1-def6.5%
Applied egg-rr6.5%
Taylor expanded in x around 0 100.0%
if 7.99999999999999964e-6 < x Initial program 55.6%
*-un-lft-identity55.6%
*-commutative55.6%
log-prod55.6%
+-commutative55.6%
hypot-1-def98.2%
add-sqr-sqrt98.2%
fabs-sqr98.2%
add-sqr-sqrt98.2%
metadata-eval98.2%
Applied egg-rr98.2%
+-rgt-identity98.2%
Simplified98.2%
(FPCore (x)
:precision binary64
(if (<= x -1.25)
(copysign (log (/ -0.5 x)) x)
(if (<= x 0.00086)
(copysign (+ x (* -0.16666666666666666 (pow x 3.0))) 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.00086) {
tmp = copysign((x + (-0.16666666666666666 * pow(x, 3.0))), 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.00086) {
tmp = Math.copySign((x + (-0.16666666666666666 * Math.pow(x, 3.0))), 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.00086: tmp = math.copysign((x + (-0.16666666666666666 * math.pow(x, 3.0))), 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.00086) tmp = copysign(Float64(x + Float64(-0.16666666666666666 * (x ^ 3.0))), 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.00086) tmp = sign(x) * abs((x + (-0.16666666666666666 * (x ^ 3.0)))); 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.00086], 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[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.00086:\\
\;\;\;\;\mathsf{copysign}\left(x + -0.16666666666666666 \cdot {x}^{3}, 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 48.1%
add-cube-cbrt48.0%
pow348.0%
*-un-lft-identity48.0%
*-un-lft-identity48.0%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt4.5%
+-commutative4.5%
hypot-1-def4.5%
Applied egg-rr4.5%
Taylor expanded in x around -inf 99.2%
if -1.25 < x < 8.59999999999999979e-4Initial program 7.3%
add-cube-cbrt7.2%
pow37.2%
*-un-lft-identity7.2%
*-un-lft-identity7.2%
add-sqr-sqrt2.4%
fabs-sqr2.4%
add-sqr-sqrt7.2%
+-commutative7.2%
hypot-1-def7.2%
Applied egg-rr7.2%
Taylor expanded in x around 0 99.7%
distribute-rgt-in99.7%
*-lft-identity99.7%
associate-*l*99.7%
unpow299.7%
unpow399.7%
Simplified99.7%
if 8.59999999999999979e-4 < x Initial program 55.6%
*-un-lft-identity55.6%
*-commutative55.6%
log-prod55.6%
+-commutative55.6%
hypot-1-def98.2%
add-sqr-sqrt98.2%
fabs-sqr98.2%
add-sqr-sqrt98.2%
metadata-eval98.2%
Applied egg-rr98.2%
+-rgt-identity98.2%
Simplified98.2%
(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 (/ 0.5 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 + (-0.16666666666666666 * pow(x, 3.0))), x);
} else {
tmp = copysign(log((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 <= 1.25) {
tmp = Math.copySign((x + (-0.16666666666666666 * Math.pow(x, 3.0))), x);
} else {
tmp = Math.copySign(Math.log((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 <= 1.25: tmp = math.copysign((x + (-0.16666666666666666 * math.pow(x, 3.0))), x) else: tmp = math.copysign(math.log((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 <= 1.25) tmp = copysign(Float64(x + Float64(-0.16666666666666666 * (x ^ 3.0))), x); else tmp = copysign(log(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 <= 1.25) tmp = sign(x) * abs((x + (-0.16666666666666666 * (x ^ 3.0)))); else tmp = sign(x) * abs(log((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, 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[(0.5 / 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 + -0.16666666666666666 \cdot {x}^{3}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(\frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -1.25Initial program 48.1%
add-cube-cbrt48.0%
pow348.0%
*-un-lft-identity48.0%
*-un-lft-identity48.0%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt4.5%
+-commutative4.5%
hypot-1-def4.5%
Applied egg-rr4.5%
Taylor expanded in x around -inf 99.2%
if -1.25 < x < 1.25Initial program 7.9%
add-cube-cbrt7.8%
pow37.8%
*-un-lft-identity7.8%
*-un-lft-identity7.8%
add-sqr-sqrt3.1%
fabs-sqr3.1%
add-sqr-sqrt7.9%
+-commutative7.9%
hypot-1-def7.9%
Applied egg-rr7.9%
Taylor expanded in x around 0 99.5%
distribute-rgt-in99.5%
*-lft-identity99.5%
associate-*l*99.5%
unpow299.5%
unpow399.5%
Simplified99.5%
if 1.25 < x Initial program 54.9%
add-cube-cbrt54.9%
pow354.9%
*-un-lft-identity54.9%
*-un-lft-identity54.9%
add-sqr-sqrt54.9%
fabs-sqr54.9%
add-sqr-sqrt54.9%
+-commutative54.9%
hypot-1-def98.3%
Applied egg-rr98.3%
rem-cube-cbrt98.3%
+-commutative98.3%
Applied egg-rr98.3%
add-exp-log98.3%
add-sqr-sqrt97.7%
sqrt-unprod98.3%
sqr-neg98.3%
+-commutative98.3%
log-rec98.3%
+-commutative98.3%
log-rec98.3%
sqrt-unprod0.0%
add-sqr-sqrt98.3%
add-exp-log98.3%
flip-+3.8%
associate-/r/3.8%
Applied egg-rr3.6%
+-commutative3.6%
associate--r+5.1%
+-inverses6.6%
metadata-eval6.6%
metadata-eval6.6%
neg-mul-16.6%
sub-neg6.6%
+-commutative6.6%
distribute-neg-in6.6%
remove-double-neg6.6%
sub-neg6.6%
Simplified6.6%
Taylor expanded in x around inf 97.9%
(FPCore (x) :precision binary64 (if (<= x -1.25) (copysign (log (/ -0.5 x)) x) (if (<= x 1.25) (copysign x x) (copysign (log (/ 0.5 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((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 <= 1.25) {
tmp = Math.copySign(x, x);
} else {
tmp = Math.copySign(Math.log((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 <= 1.25: tmp = math.copysign(x, x) else: tmp = math.copysign(math.log((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 <= 1.25) tmp = copysign(x, x); else tmp = copysign(log(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 <= 1.25) tmp = sign(x) * abs(x); else tmp = sign(x) * abs(log((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, 1.25], N[With[{TMP1 = Abs[x], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision], N[With[{TMP1 = Abs[N[Log[N[(0.5 / 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(\frac{0.5}{x}\right), x\right)\\
\end{array}
\end{array}
if x < -1.25Initial program 48.1%
add-cube-cbrt48.0%
pow348.0%
*-un-lft-identity48.0%
*-un-lft-identity48.0%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt4.5%
+-commutative4.5%
hypot-1-def4.5%
Applied egg-rr4.5%
Taylor expanded in x around -inf 99.2%
if -1.25 < x < 1.25Initial program 7.9%
add-cube-cbrt7.8%
pow37.8%
*-un-lft-identity7.8%
*-un-lft-identity7.8%
add-sqr-sqrt3.1%
fabs-sqr3.1%
add-sqr-sqrt7.9%
+-commutative7.9%
hypot-1-def7.9%
Applied egg-rr7.9%
Taylor expanded in x around 0 99.1%
if 1.25 < x Initial program 54.9%
add-cube-cbrt54.9%
pow354.9%
*-un-lft-identity54.9%
*-un-lft-identity54.9%
add-sqr-sqrt54.9%
fabs-sqr54.9%
add-sqr-sqrt54.9%
+-commutative54.9%
hypot-1-def98.3%
Applied egg-rr98.3%
rem-cube-cbrt98.3%
+-commutative98.3%
Applied egg-rr98.3%
add-exp-log98.3%
add-sqr-sqrt97.7%
sqrt-unprod98.3%
sqr-neg98.3%
+-commutative98.3%
log-rec98.3%
+-commutative98.3%
log-rec98.3%
sqrt-unprod0.0%
add-sqr-sqrt98.3%
add-exp-log98.3%
flip-+3.8%
associate-/r/3.8%
Applied egg-rr3.6%
+-commutative3.6%
associate--r+5.1%
+-inverses6.6%
metadata-eval6.6%
metadata-eval6.6%
neg-mul-16.6%
sub-neg6.6%
+-commutative6.6%
distribute-neg-in6.6%
remove-double-neg6.6%
sub-neg6.6%
Simplified6.6%
Taylor expanded in x around inf 97.9%
(FPCore (x) :precision binary64 (if (<= x -1.25) (copysign (log (/ -0.5 x)) x) (if (<= x 1.25) (copysign x 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, 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, 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, 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(x, 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); 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[x], 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, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\
\end{array}
\end{array}
if x < -1.25Initial program 48.1%
add-cube-cbrt48.0%
pow348.0%
*-un-lft-identity48.0%
*-un-lft-identity48.0%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt4.5%
+-commutative4.5%
hypot-1-def4.5%
Applied egg-rr4.5%
Taylor expanded in x around -inf 99.2%
if -1.25 < x < 1.25Initial program 7.9%
add-cube-cbrt7.8%
pow37.8%
*-un-lft-identity7.8%
*-un-lft-identity7.8%
add-sqr-sqrt3.1%
fabs-sqr3.1%
add-sqr-sqrt7.9%
+-commutative7.9%
hypot-1-def7.9%
Applied egg-rr7.9%
Taylor expanded in x around 0 99.1%
if 1.25 < x Initial program 54.9%
add-cube-cbrt54.9%
pow354.9%
*-un-lft-identity54.9%
*-un-lft-identity54.9%
add-sqr-sqrt54.9%
fabs-sqr54.9%
add-sqr-sqrt54.9%
+-commutative54.9%
hypot-1-def98.3%
Applied egg-rr98.3%
Taylor expanded in x around inf 96.2%
*-commutative96.2%
Simplified96.2%
(FPCore (x) :precision binary64 (if (<= x 1.25) (copysign x x) (copysign (log (* x 2.0)) x)))
double code(double x) {
double tmp;
if (x <= 1.25) {
tmp = copysign(x, 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(x, 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(x, 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(x, 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(x); 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[x], 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(x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{copysign}\left(\log \left(x \cdot 2\right), x\right)\\
\end{array}
\end{array}
if x < 1.25Initial program 21.9%
add-cube-cbrt21.8%
pow321.8%
*-un-lft-identity21.8%
*-un-lft-identity21.8%
add-sqr-sqrt2.0%
fabs-sqr2.0%
add-sqr-sqrt6.7%
+-commutative6.7%
hypot-1-def6.7%
Applied egg-rr6.7%
Taylor expanded in x around 0 66.4%
if 1.25 < x Initial program 54.9%
add-cube-cbrt54.9%
pow354.9%
*-un-lft-identity54.9%
*-un-lft-identity54.9%
add-sqr-sqrt54.9%
fabs-sqr54.9%
add-sqr-sqrt54.9%
+-commutative54.9%
hypot-1-def98.3%
Applied egg-rr98.3%
Taylor expanded in x around inf 96.2%
*-commutative96.2%
Simplified96.2%
(FPCore (x) :precision binary64 (if (<= x 1.55) (copysign x x) (copysign (log1p x) x)))
double code(double x) {
double tmp;
if (x <= 1.55) {
tmp = copysign(x, 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, x);
} else {
tmp = Math.copySign(Math.log1p(x), x);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.55: tmp = math.copysign(x, x) else: tmp = math.copysign(math.log1p(x), x) return tmp
function code(x) tmp = 0.0 if (x <= 1.55) tmp = copysign(x, x); else tmp = copysign(log1p(x), x); end return tmp end
code[x_] := If[LessEqual[x, 1.55], 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.55:\\
\;\;\;\;\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.55000000000000004Initial program 21.9%
add-cube-cbrt21.8%
pow321.8%
*-un-lft-identity21.8%
*-un-lft-identity21.8%
add-sqr-sqrt2.0%
fabs-sqr2.0%
add-sqr-sqrt6.7%
+-commutative6.7%
hypot-1-def6.7%
Applied egg-rr6.7%
Taylor expanded in x around 0 66.4%
if 1.55000000000000004 < x Initial program 54.9%
Taylor expanded in x around 0 31.3%
log1p-define31.3%
rem-square-sqrt31.3%
fabs-sqr31.3%
rem-square-sqrt31.3%
Simplified31.3%
(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.4%
add-cube-cbrt29.3%
pow329.3%
*-un-lft-identity29.3%
*-un-lft-identity29.3%
add-sqr-sqrt14.0%
fabs-sqr14.0%
add-sqr-sqrt17.6%
+-commutative17.6%
hypot-1-def27.4%
Applied egg-rr27.4%
Taylor expanded in x around 0 52.7%
(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 2024106
(FPCore (x)
:name "Rust f64::asinh"
:precision binary64
:alt
(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))