
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))))
(-
1.0
(*
(*
t_0
(+
0.254829592
(*
t_0
(+
-0.284496736
(*
t_0
(+ 1.421413741 (* t_0 (+ -1.453152027 (* t_0 1.061405429)))))))))
(exp (- (* (fabs x) (fabs x))))))))
double code(double x) {
double t_0 = 1.0 / (1.0 + (0.3275911 * fabs(x)));
return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * exp(-(fabs(x) * fabs(x))));
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = 1.0d0 / (1.0d0 + (0.3275911d0 * abs(x)))
code = 1.0d0 - ((t_0 * (0.254829592d0 + (t_0 * ((-0.284496736d0) + (t_0 * (1.421413741d0 + (t_0 * ((-1.453152027d0) + (t_0 * 1.061405429d0))))))))) * exp(-(abs(x) * abs(x))))
end function
public static double code(double x) {
double t_0 = 1.0 / (1.0 + (0.3275911 * Math.abs(x)));
return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * Math.exp(-(Math.abs(x) * Math.abs(x))));
}
def code(x): t_0 = 1.0 / (1.0 + (0.3275911 * math.fabs(x))) return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * math.exp(-(math.fabs(x) * math.fabs(x))))
function code(x) t_0 = Float64(1.0 / Float64(1.0 + Float64(0.3275911 * abs(x)))) return Float64(1.0 - Float64(Float64(t_0 * Float64(0.254829592 + Float64(t_0 * Float64(-0.284496736 + Float64(t_0 * Float64(1.421413741 + Float64(t_0 * Float64(-1.453152027 + Float64(t_0 * 1.061405429))))))))) * exp(Float64(-Float64(abs(x) * abs(x)))))) end
function tmp = code(x) t_0 = 1.0 / (1.0 + (0.3275911 * abs(x))); tmp = 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * exp(-(abs(x) * abs(x)))); end
code[x_] := Block[{t$95$0 = N[(1.0 / N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(N[(t$95$0 * N[(0.254829592 + N[(t$95$0 * N[(-0.284496736 + N[(t$95$0 * N[(1.421413741 + N[(t$95$0 * N[(-1.453152027 + N[(t$95$0 * 1.061405429), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{1 + 0.3275911 \cdot \left|x\right|}\\
1 - \left(t_0 \cdot \left(0.254829592 + t_0 \cdot \left(-0.284496736 + t_0 \cdot \left(1.421413741 + t_0 \cdot \left(-1.453152027 + t_0 \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x)
:precision binary64
(let* ((t_0 (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x))))))
(-
1.0
(*
(*
t_0
(+
0.254829592
(*
t_0
(+
-0.284496736
(*
t_0
(+ 1.421413741 (* t_0 (+ -1.453152027 (* t_0 1.061405429)))))))))
(exp (- (* (fabs x) (fabs x))))))))
double code(double x) {
double t_0 = 1.0 / (1.0 + (0.3275911 * fabs(x)));
return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * exp(-(fabs(x) * fabs(x))));
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
t_0 = 1.0d0 / (1.0d0 + (0.3275911d0 * abs(x)))
code = 1.0d0 - ((t_0 * (0.254829592d0 + (t_0 * ((-0.284496736d0) + (t_0 * (1.421413741d0 + (t_0 * ((-1.453152027d0) + (t_0 * 1.061405429d0))))))))) * exp(-(abs(x) * abs(x))))
end function
public static double code(double x) {
double t_0 = 1.0 / (1.0 + (0.3275911 * Math.abs(x)));
return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * Math.exp(-(Math.abs(x) * Math.abs(x))));
}
def code(x): t_0 = 1.0 / (1.0 + (0.3275911 * math.fabs(x))) return 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * math.exp(-(math.fabs(x) * math.fabs(x))))
function code(x) t_0 = Float64(1.0 / Float64(1.0 + Float64(0.3275911 * abs(x)))) return Float64(1.0 - Float64(Float64(t_0 * Float64(0.254829592 + Float64(t_0 * Float64(-0.284496736 + Float64(t_0 * Float64(1.421413741 + Float64(t_0 * Float64(-1.453152027 + Float64(t_0 * 1.061405429))))))))) * exp(Float64(-Float64(abs(x) * abs(x)))))) end
function tmp = code(x) t_0 = 1.0 / (1.0 + (0.3275911 * abs(x))); tmp = 1.0 - ((t_0 * (0.254829592 + (t_0 * (-0.284496736 + (t_0 * (1.421413741 + (t_0 * (-1.453152027 + (t_0 * 1.061405429))))))))) * exp(-(abs(x) * abs(x)))); end
code[x_] := Block[{t$95$0 = N[(1.0 / N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(N[(t$95$0 * N[(0.254829592 + N[(t$95$0 * N[(-0.284496736 + N[(t$95$0 * N[(1.421413741 + N[(t$95$0 * N[(-1.453152027 + N[(t$95$0 * 1.061405429), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(N[Abs[x], $MachinePrecision] * N[Abs[x], $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{1}{1 + 0.3275911 \cdot \left|x\right|}\\
1 - \left(t_0 \cdot \left(0.254829592 + t_0 \cdot \left(-0.284496736 + t_0 \cdot \left(1.421413741 + t_0 \cdot \left(-1.453152027 + t_0 \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|}
\end{array}
\end{array}
(FPCore (x)
:precision binary64
(let* ((t_0 (fma 0.3275911 (fabs x) 1.0)) (t_1 (sqrt t_0)))
(if (<= (fabs x) 4e-8)
(/
(+
1.999999999e-9
(fma x 2.256772713883663 (* x (* x -1.2734922589667106))))
(+
1.0
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(* (fma 0.3275911 x 1.0) (pow (exp x) x)))))
(exp
(log1p
(*
(/ (pow (exp x) (- x)) (* t_1 t_1))
(+
-0.254829592
(-
(fma 1.453152027 (pow t_0 -3.0) (/ 0.284496736 t_0))
(fma
1.061405429
(pow t_0 -4.0)
(* 1.421413741 (pow t_0 -2.0)))))))))))
double code(double x) {
double t_0 = fma(0.3275911, fabs(x), 1.0);
double t_1 = sqrt(t_0);
double tmp;
if (fabs(x) <= 4e-8) {
tmp = (1.999999999e-9 + fma(x, 2.256772713883663, (x * (x * -1.2734922589667106)))) / (1.0 + ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / (fma(0.3275911, x, 1.0) * pow(exp(x), x))));
} else {
tmp = exp(log1p(((pow(exp(x), -x) / (t_1 * t_1)) * (-0.254829592 + (fma(1.453152027, pow(t_0, -3.0), (0.284496736 / t_0)) - fma(1.061405429, pow(t_0, -4.0), (1.421413741 * pow(t_0, -2.0))))))));
}
return tmp;
}
function code(x) t_0 = fma(0.3275911, abs(x), 1.0) t_1 = sqrt(t_0) tmp = 0.0 if (abs(x) <= 4e-8) tmp = Float64(Float64(1.999999999e-9 + fma(x, 2.256772713883663, Float64(x * Float64(x * -1.2734922589667106)))) / Float64(1.0 + Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / Float64(fma(0.3275911, x, 1.0) * (exp(x) ^ x))))); else tmp = exp(log1p(Float64(Float64((exp(x) ^ Float64(-x)) / Float64(t_1 * t_1)) * Float64(-0.254829592 + Float64(fma(1.453152027, (t_0 ^ -3.0), Float64(0.284496736 / t_0)) - fma(1.061405429, (t_0 ^ -4.0), Float64(1.421413741 * (t_0 ^ -2.0)))))))); end return tmp end
code[x_] := Block[{t$95$0 = N[(0.3275911 * N[Abs[x], $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[t$95$0], $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 4e-8], N[(N[(1.999999999e-9 + N[(x * 2.256772713883663 + N[(x * N[(x * -1.2734922589667106), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.3275911 * x + 1.0), $MachinePrecision] * N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Exp[N[Log[1 + N[(N[(N[Power[N[Exp[x], $MachinePrecision], (-x)], $MachinePrecision] / N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(-0.254829592 + N[(N[(1.453152027 * N[Power[t$95$0, -3.0], $MachinePrecision] + N[(0.284496736 / t$95$0), $MachinePrecision]), $MachinePrecision] - N[(1.061405429 * N[Power[t$95$0, -4.0], $MachinePrecision] + N[(1.421413741 * N[Power[t$95$0, -2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)\\
t_1 := \sqrt{t_0}\\
\mathbf{if}\;\left|x\right| \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\frac{1.999999999 \cdot 10^{-9} + \mathsf{fma}\left(x, 2.256772713883663, x \cdot \left(x \cdot -1.2734922589667106\right)\right)}{1 + \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right) \cdot {\left(e^{x}\right)}^{x}}}\\
\mathbf{else}:\\
\;\;\;\;e^{\mathsf{log1p}\left(\frac{{\left(e^{x}\right)}^{\left(-x\right)}}{t_1 \cdot t_1} \cdot \left(-0.254829592 + \left(\mathsf{fma}\left(1.453152027, {t_0}^{-3}, \frac{0.284496736}{t_0}\right) - \mathsf{fma}\left(1.061405429, {t_0}^{-4}, 1.421413741 \cdot {t_0}^{-2}\right)\right)\right)\right)}\\
\end{array}
\end{array}
if (fabs.f64 x) < 4.0000000000000001e-8Initial program 57.8%
associate-*l*57.8%
Simplified57.8%
Applied egg-rr57.8%
Simplified57.8%
Taylor expanded in x around 0 99.4%
+-commutative99.4%
*-commutative99.4%
fma-def99.4%
unpow299.4%
associate-*r*99.4%
Simplified99.4%
if 4.0000000000000001e-8 < (fabs.f64 x) Initial program 99.5%
associate-*l*99.5%
Simplified99.5%
Taylor expanded in x around inf 99.4%
Simplified99.4%
Applied egg-rr99.5%
distribute-lft-neg-in99.5%
distribute-rgt-neg-in99.5%
distribute-neg-in99.5%
metadata-eval99.5%
Simplified99.5%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x)
:precision binary64
(let* ((t_0 (* (fabs x) 0.3275911)) (t_1 (+ 1.0 t_0)) (t_2 (/ 1.0 t_1)))
(if (<= (fabs x) 4e-8)
(/
(+
1.999999999e-9
(fma x 2.256772713883663 (* x (* x -1.2734922589667106))))
(+
1.0
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(* (fma 0.3275911 x 1.0) (pow (exp x) x)))))
(+
1.0
(*
(*
(+
0.254829592
(*
t_2
(+
-0.284496736
(*
t_2
(+
1.421413741
(*
t_2
(+
-1.453152027
(/ 1.061405429 (+ 1.0 (pow (cbrt t_0) 3.0))))))))))
(exp (* x (- x))))
(/ -1.0 t_1))))))
double code(double x) {
double t_0 = fabs(x) * 0.3275911;
double t_1 = 1.0 + t_0;
double t_2 = 1.0 / t_1;
double tmp;
if (fabs(x) <= 4e-8) {
tmp = (1.999999999e-9 + fma(x, 2.256772713883663, (x * (x * -1.2734922589667106)))) / (1.0 + ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / (fma(0.3275911, x, 1.0) * pow(exp(x), x))));
} else {
tmp = 1.0 + (((0.254829592 + (t_2 * (-0.284496736 + (t_2 * (1.421413741 + (t_2 * (-1.453152027 + (1.061405429 / (1.0 + pow(cbrt(t_0), 3.0)))))))))) * exp((x * -x))) * (-1.0 / t_1));
}
return tmp;
}
function code(x) t_0 = Float64(abs(x) * 0.3275911) t_1 = Float64(1.0 + t_0) t_2 = Float64(1.0 / t_1) tmp = 0.0 if (abs(x) <= 4e-8) tmp = Float64(Float64(1.999999999e-9 + fma(x, 2.256772713883663, Float64(x * Float64(x * -1.2734922589667106)))) / Float64(1.0 + Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / Float64(fma(0.3275911, x, 1.0) * (exp(x) ^ x))))); else tmp = Float64(1.0 + Float64(Float64(Float64(0.254829592 + Float64(t_2 * Float64(-0.284496736 + Float64(t_2 * Float64(1.421413741 + Float64(t_2 * Float64(-1.453152027 + Float64(1.061405429 / Float64(1.0 + (cbrt(t_0) ^ 3.0)))))))))) * exp(Float64(x * Float64(-x)))) * Float64(-1.0 / t_1))); end return tmp end
code[x_] := Block[{t$95$0 = N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / t$95$1), $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 4e-8], N[(N[(1.999999999e-9 + N[(x * 2.256772713883663 + N[(x * N[(x * -1.2734922589667106), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.3275911 * x + 1.0), $MachinePrecision] * N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[(0.254829592 + N[(t$95$2 * N[(-0.284496736 + N[(t$95$2 * N[(1.421413741 + N[(t$95$2 * N[(-1.453152027 + N[(1.061405429 / N[(1.0 + N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|x\right| \cdot 0.3275911\\
t_1 := 1 + t_0\\
t_2 := \frac{1}{t_1}\\
\mathbf{if}\;\left|x\right| \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\frac{1.999999999 \cdot 10^{-9} + \mathsf{fma}\left(x, 2.256772713883663, x \cdot \left(x \cdot -1.2734922589667106\right)\right)}{1 + \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right) \cdot {\left(e^{x}\right)}^{x}}}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(\left(0.254829592 + t_2 \cdot \left(-0.284496736 + t_2 \cdot \left(1.421413741 + t_2 \cdot \left(-1.453152027 + \frac{1.061405429}{1 + {\left(\sqrt[3]{t_0}\right)}^{3}}\right)\right)\right)\right) \cdot e^{x \cdot \left(-x\right)}\right) \cdot \frac{-1}{t_1}\\
\end{array}
\end{array}
if (fabs.f64 x) < 4.0000000000000001e-8Initial program 57.8%
associate-*l*57.8%
Simplified57.8%
Applied egg-rr57.8%
Simplified57.8%
Taylor expanded in x around 0 99.4%
+-commutative99.4%
*-commutative99.4%
fma-def99.4%
unpow299.4%
associate-*r*99.4%
Simplified99.4%
if 4.0000000000000001e-8 < (fabs.f64 x) Initial program 99.5%
associate-*l*99.5%
Simplified99.5%
add-cube-cbrt99.5%
pow399.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* (fabs x) 0.3275911))) (t_1 (/ 1.0 t_0)))
(if (<= (fabs x) 4e-8)
(/
(+
1.999999999e-9
(fma x 2.256772713883663 (* x (* x -1.2734922589667106))))
(+
1.0
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(* (fma 0.3275911 x 1.0) (pow (exp x) x)))))
(+
1.0
(*
(*
(exp (* x (- x)))
(+
0.254829592
(*
t_1
(+
-0.284496736
(*
t_1
(+
1.421413741
(*
t_1
(fma
1.061405429
(/ 1.0 (fma 0.3275911 (fabs x) 1.0))
-1.453152027))))))))
(/ -1.0 t_0))))))
double code(double x) {
double t_0 = 1.0 + (fabs(x) * 0.3275911);
double t_1 = 1.0 / t_0;
double tmp;
if (fabs(x) <= 4e-8) {
tmp = (1.999999999e-9 + fma(x, 2.256772713883663, (x * (x * -1.2734922589667106)))) / (1.0 + ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / (fma(0.3275911, x, 1.0) * pow(exp(x), x))));
} else {
tmp = 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + (t_1 * fma(1.061405429, (1.0 / fma(0.3275911, fabs(x), 1.0)), -1.453152027)))))))) * (-1.0 / t_0));
}
return tmp;
}
function code(x) t_0 = Float64(1.0 + Float64(abs(x) * 0.3275911)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (abs(x) <= 4e-8) tmp = Float64(Float64(1.999999999e-9 + fma(x, 2.256772713883663, Float64(x * Float64(x * -1.2734922589667106)))) / Float64(1.0 + Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / Float64(fma(0.3275911, x, 1.0) * (exp(x) ^ x))))); else tmp = Float64(1.0 + Float64(Float64(exp(Float64(x * Float64(-x))) * Float64(0.254829592 + Float64(t_1 * Float64(-0.284496736 + Float64(t_1 * Float64(1.421413741 + Float64(t_1 * fma(1.061405429, Float64(1.0 / fma(0.3275911, abs(x), 1.0)), -1.453152027)))))))) * Float64(-1.0 / t_0))); end return tmp end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 4e-8], N[(N[(1.999999999e-9 + N[(x * 2.256772713883663 + N[(x * N[(x * -1.2734922589667106), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.3275911 * x + 1.0), $MachinePrecision] * N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(0.254829592 + N[(t$95$1 * N[(-0.284496736 + N[(t$95$1 * N[(1.421413741 + N[(t$95$1 * N[(1.061405429 * N[(1.0 / N[(0.3275911 * N[Abs[x], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + -1.453152027), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left|x\right| \cdot 0.3275911\\
t_1 := \frac{1}{t_0}\\
\mathbf{if}\;\left|x\right| \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\frac{1.999999999 \cdot 10^{-9} + \mathsf{fma}\left(x, 2.256772713883663, x \cdot \left(x \cdot -1.2734922589667106\right)\right)}{1 + \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right) \cdot {\left(e^{x}\right)}^{x}}}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(e^{x \cdot \left(-x\right)} \cdot \left(0.254829592 + t_1 \cdot \left(-0.284496736 + t_1 \cdot \left(1.421413741 + t_1 \cdot \mathsf{fma}\left(1.061405429, \frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}, -1.453152027\right)\right)\right)\right)\right) \cdot \frac{-1}{t_0}\\
\end{array}
\end{array}
if (fabs.f64 x) < 4.0000000000000001e-8Initial program 57.8%
associate-*l*57.8%
Simplified57.8%
Applied egg-rr57.8%
Simplified57.8%
Taylor expanded in x around 0 99.4%
+-commutative99.4%
*-commutative99.4%
fma-def99.4%
unpow299.4%
associate-*r*99.4%
Simplified99.4%
if 4.0000000000000001e-8 < (fabs.f64 x) Initial program 99.5%
associate-*l*99.5%
Simplified99.5%
+-commutative98.6%
div-inv98.6%
fma-def98.6%
+-commutative98.6%
fma-udef98.6%
Applied egg-rr99.5%
Final simplification99.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* (fabs x) 0.3275911))) (t_1 (/ 1.0 t_0)))
(if (<= (fabs x) 4e-8)
(/
(+
1.999999999e-9
(fma x 2.256772713883663 (* x (* x -1.2734922589667106))))
(+
1.0
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(* (fma 0.3275911 x 1.0) (pow (exp x) x)))))
(+
1.0
(*
(*
(exp (* x (- x)))
(+
0.254829592
(*
t_1
(+
-0.284496736
(*
t_1
(+ 1.421413741 (* t_1 (+ -1.453152027 (/ 1.061405429 t_0)))))))))
(/ -1.0 t_0))))))
double code(double x) {
double t_0 = 1.0 + (fabs(x) * 0.3275911);
double t_1 = 1.0 / t_0;
double tmp;
if (fabs(x) <= 4e-8) {
tmp = (1.999999999e-9 + fma(x, 2.256772713883663, (x * (x * -1.2734922589667106)))) / (1.0 + ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / (fma(0.3275911, x, 1.0) * pow(exp(x), x))));
} else {
tmp = 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0))))))))) * (-1.0 / t_0));
}
return tmp;
}
function code(x) t_0 = Float64(1.0 + Float64(abs(x) * 0.3275911)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (abs(x) <= 4e-8) tmp = Float64(Float64(1.999999999e-9 + fma(x, 2.256772713883663, Float64(x * Float64(x * -1.2734922589667106)))) / Float64(1.0 + Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / Float64(fma(0.3275911, x, 1.0) * (exp(x) ^ x))))); else tmp = Float64(1.0 + Float64(Float64(exp(Float64(x * Float64(-x))) * Float64(0.254829592 + Float64(t_1 * Float64(-0.284496736 + Float64(t_1 * Float64(1.421413741 + Float64(t_1 * Float64(-1.453152027 + Float64(1.061405429 / t_0))))))))) * Float64(-1.0 / t_0))); end return tmp end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 4e-8], N[(N[(1.999999999e-9 + N[(x * 2.256772713883663 + N[(x * N[(x * -1.2734922589667106), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.3275911 * x + 1.0), $MachinePrecision] * N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(0.254829592 + N[(t$95$1 * N[(-0.284496736 + N[(t$95$1 * N[(1.421413741 + N[(t$95$1 * N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left|x\right| \cdot 0.3275911\\
t_1 := \frac{1}{t_0}\\
\mathbf{if}\;\left|x\right| \leq 4 \cdot 10^{-8}:\\
\;\;\;\;\frac{1.999999999 \cdot 10^{-9} + \mathsf{fma}\left(x, 2.256772713883663, x \cdot \left(x \cdot -1.2734922589667106\right)\right)}{1 + \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right) \cdot {\left(e^{x}\right)}^{x}}}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(e^{x \cdot \left(-x\right)} \cdot \left(0.254829592 + t_1 \cdot \left(-0.284496736 + t_1 \cdot \left(1.421413741 + t_1 \cdot \left(-1.453152027 + \frac{1.061405429}{t_0}\right)\right)\right)\right)\right) \cdot \frac{-1}{t_0}\\
\end{array}
\end{array}
if (fabs.f64 x) < 4.0000000000000001e-8Initial program 57.8%
associate-*l*57.8%
Simplified57.8%
Applied egg-rr57.8%
Simplified57.8%
Taylor expanded in x around 0 99.4%
+-commutative99.4%
*-commutative99.4%
fma-def99.4%
unpow299.4%
associate-*r*99.4%
Simplified99.4%
if 4.0000000000000001e-8 < (fabs.f64 x) Initial program 99.5%
associate-*l*99.5%
Simplified99.5%
Final simplification99.4%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* (fabs x) 0.3275911))) (t_1 (/ 1.0 t_0)))
(if (<= (fabs x) 1e-12)
(/
(+ 1.999999999e-9 (* x 2.256772713883663))
(+
1.0
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(* (fma 0.3275911 x 1.0) (pow (exp x) x)))))
(+
1.0
(*
(*
(exp (* x (- x)))
(+
0.254829592
(*
t_1
(+
-0.284496736
(*
t_1
(+ 1.421413741 (* t_1 (+ -1.453152027 (/ 1.061405429 t_0)))))))))
(/ -1.0 t_0))))))
double code(double x) {
double t_0 = 1.0 + (fabs(x) * 0.3275911);
double t_1 = 1.0 / t_0;
double tmp;
if (fabs(x) <= 1e-12) {
tmp = (1.999999999e-9 + (x * 2.256772713883663)) / (1.0 + ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / (fma(0.3275911, x, 1.0) * pow(exp(x), x))));
} else {
tmp = 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0))))))))) * (-1.0 / t_0));
}
return tmp;
}
function code(x) t_0 = Float64(1.0 + Float64(abs(x) * 0.3275911)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (abs(x) <= 1e-12) tmp = Float64(Float64(1.999999999e-9 + Float64(x * 2.256772713883663)) / Float64(1.0 + Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / Float64(fma(0.3275911, x, 1.0) * (exp(x) ^ x))))); else tmp = Float64(1.0 + Float64(Float64(exp(Float64(x * Float64(-x))) * Float64(0.254829592 + Float64(t_1 * Float64(-0.284496736 + Float64(t_1 * Float64(1.421413741 + Float64(t_1 * Float64(-1.453152027 + Float64(1.061405429 / t_0))))))))) * Float64(-1.0 / t_0))); end return tmp end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 1e-12], N[(N[(1.999999999e-9 + N[(x * 2.256772713883663), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.3275911 * x + 1.0), $MachinePrecision] * N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(0.254829592 + N[(t$95$1 * N[(-0.284496736 + N[(t$95$1 * N[(1.421413741 + N[(t$95$1 * N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left|x\right| \cdot 0.3275911\\
t_1 := \frac{1}{t_0}\\
\mathbf{if}\;\left|x\right| \leq 10^{-12}:\\
\;\;\;\;\frac{1.999999999 \cdot 10^{-9} + x \cdot 2.256772713883663}{1 + \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right) \cdot {\left(e^{x}\right)}^{x}}}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(e^{x \cdot \left(-x\right)} \cdot \left(0.254829592 + t_1 \cdot \left(-0.284496736 + t_1 \cdot \left(1.421413741 + t_1 \cdot \left(-1.453152027 + \frac{1.061405429}{t_0}\right)\right)\right)\right)\right) \cdot \frac{-1}{t_0}\\
\end{array}
\end{array}
if (fabs.f64 x) < 9.9999999999999998e-13Initial program 57.8%
associate-*l*57.8%
Simplified57.8%
Applied egg-rr57.8%
Simplified57.8%
Taylor expanded in x around 0 99.4%
*-commutative99.4%
Simplified99.4%
if 9.9999999999999998e-13 < (fabs.f64 x) Initial program 99.2%
associate-*l*99.2%
Simplified99.2%
Final simplification99.3%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* (fabs x) 0.3275911))) (t_1 (/ 1.0 t_0)))
(if (<= (fabs x) 2e-17)
(/
1.999999999e-9
(+
1.0
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))
(* (fma 0.3275911 x 1.0) (pow (exp x) x)))))
(+
1.0
(*
(*
(exp (* x (- x)))
(+
0.254829592
(*
t_1
(+
-0.284496736
(*
t_1
(+ 1.421413741 (* t_1 (+ -1.453152027 (/ 1.061405429 t_0)))))))))
(/ -1.0 t_0))))))
double code(double x) {
double t_0 = 1.0 + (fabs(x) * 0.3275911);
double t_1 = 1.0 / t_0;
double tmp;
if (fabs(x) <= 2e-17) {
tmp = 1.999999999e-9 / (1.0 + ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / (fma(0.3275911, x, 1.0) * pow(exp(x), x))));
} else {
tmp = 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0))))))))) * (-1.0 / t_0));
}
return tmp;
}
function code(x) t_0 = Float64(1.0 + Float64(abs(x) * 0.3275911)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (abs(x) <= 2e-17) tmp = Float64(1.999999999e-9 / Float64(1.0 + Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))) / Float64(fma(0.3275911, x, 1.0) * (exp(x) ^ x))))); else tmp = Float64(1.0 + Float64(Float64(exp(Float64(x * Float64(-x))) * Float64(0.254829592 + Float64(t_1 * Float64(-0.284496736 + Float64(t_1 * Float64(1.421413741 + Float64(t_1 * Float64(-1.453152027 + Float64(1.061405429 / t_0))))))))) * Float64(-1.0 / t_0))); end return tmp end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[N[Abs[x], $MachinePrecision], 2e-17], N[(1.999999999e-9 / N[(1.0 + N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.3275911 * x + 1.0), $MachinePrecision] * N[Power[N[Exp[x], $MachinePrecision], x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(0.254829592 + N[(t$95$1 * N[(-0.284496736 + N[(t$95$1 * N[(1.421413741 + N[(t$95$1 * N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left|x\right| \cdot 0.3275911\\
t_1 := \frac{1}{t_0}\\
\mathbf{if}\;\left|x\right| \leq 2 \cdot 10^{-17}:\\
\;\;\;\;\frac{1.999999999 \cdot 10^{-9}}{1 + \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right) \cdot {\left(e^{x}\right)}^{x}}}\\
\mathbf{else}:\\
\;\;\;\;1 + \left(e^{x \cdot \left(-x\right)} \cdot \left(0.254829592 + t_1 \cdot \left(-0.284496736 + t_1 \cdot \left(1.421413741 + t_1 \cdot \left(-1.453152027 + \frac{1.061405429}{t_0}\right)\right)\right)\right)\right) \cdot \frac{-1}{t_0}\\
\end{array}
\end{array}
if (fabs.f64 x) < 2.00000000000000014e-17Initial program 57.8%
associate-*l*57.8%
Simplified57.8%
Applied egg-rr57.8%
Simplified57.8%
Taylor expanded in x around 0 98.8%
if 2.00000000000000014e-17 < (fabs.f64 x) Initial program 98.9%
associate-*l*98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* (fabs x) 0.3275911))) (t_1 (/ 1.0 t_0)))
(+
1.0
(*
(*
(exp (* x (- x)))
(+
0.254829592
(*
t_1
(+
-0.284496736
(*
t_1
(+ 1.421413741 (* t_1 (+ -1.453152027 (/ 1.061405429 t_0)))))))))
(/ -1.0 t_0)))))
double code(double x) {
double t_0 = 1.0 + (fabs(x) * 0.3275911);
double t_1 = 1.0 / t_0;
return 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0))))))))) * (-1.0 / t_0));
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
t_0 = 1.0d0 + (abs(x) * 0.3275911d0)
t_1 = 1.0d0 / t_0
code = 1.0d0 + ((exp((x * -x)) * (0.254829592d0 + (t_1 * ((-0.284496736d0) + (t_1 * (1.421413741d0 + (t_1 * ((-1.453152027d0) + (1.061405429d0 / t_0))))))))) * ((-1.0d0) / t_0))
end function
public static double code(double x) {
double t_0 = 1.0 + (Math.abs(x) * 0.3275911);
double t_1 = 1.0 / t_0;
return 1.0 + ((Math.exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0))))))))) * (-1.0 / t_0));
}
def code(x): t_0 = 1.0 + (math.fabs(x) * 0.3275911) t_1 = 1.0 / t_0 return 1.0 + ((math.exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0))))))))) * (-1.0 / t_0))
function code(x) t_0 = Float64(1.0 + Float64(abs(x) * 0.3275911)) t_1 = Float64(1.0 / t_0) return Float64(1.0 + Float64(Float64(exp(Float64(x * Float64(-x))) * Float64(0.254829592 + Float64(t_1 * Float64(-0.284496736 + Float64(t_1 * Float64(1.421413741 + Float64(t_1 * Float64(-1.453152027 + Float64(1.061405429 / t_0))))))))) * Float64(-1.0 / t_0))) end
function tmp = code(x) t_0 = 1.0 + (abs(x) * 0.3275911); t_1 = 1.0 / t_0; tmp = 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0))))))))) * (-1.0 / t_0)); end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, N[(1.0 + N[(N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(0.254829592 + N[(t$95$1 * N[(-0.284496736 + N[(t$95$1 * N[(1.421413741 + N[(t$95$1 * N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left|x\right| \cdot 0.3275911\\
t_1 := \frac{1}{t_0}\\
1 + \left(e^{x \cdot \left(-x\right)} \cdot \left(0.254829592 + t_1 \cdot \left(-0.284496736 + t_1 \cdot \left(1.421413741 + t_1 \cdot \left(-1.453152027 + \frac{1.061405429}{t_0}\right)\right)\right)\right)\right) \cdot \frac{-1}{t_0}
\end{array}
\end{array}
Initial program 80.1%
associate-*l*80.1%
Simplified80.1%
Final simplification80.1%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* (fabs x) 0.3275911)))
(t_1 (/ 1.0 (+ 1.0 (* x 0.3275911)))))
(+
1.0
(*
(*
(exp (* x (- x)))
(+
0.254829592
(*
t_1
(+
-0.284496736
(*
(/ 1.0 t_0)
(+
1.421413741
(*
(fma 1.061405429 (/ 1.0 (fma 0.3275911 (fabs x) 1.0)) -1.453152027)
t_1)))))))
(/ -1.0 t_0)))))
double code(double x) {
double t_0 = 1.0 + (fabs(x) * 0.3275911);
double t_1 = 1.0 / (1.0 + (x * 0.3275911));
return 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + ((1.0 / t_0) * (1.421413741 + (fma(1.061405429, (1.0 / fma(0.3275911, fabs(x), 1.0)), -1.453152027) * t_1))))))) * (-1.0 / t_0));
}
function code(x) t_0 = Float64(1.0 + Float64(abs(x) * 0.3275911)) t_1 = Float64(1.0 / Float64(1.0 + Float64(x * 0.3275911))) return Float64(1.0 + Float64(Float64(exp(Float64(x * Float64(-x))) * Float64(0.254829592 + Float64(t_1 * Float64(-0.284496736 + Float64(Float64(1.0 / t_0) * Float64(1.421413741 + Float64(fma(1.061405429, Float64(1.0 / fma(0.3275911, abs(x), 1.0)), -1.453152027) * t_1))))))) * Float64(-1.0 / t_0))) end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[(1.0 + N[(x * 0.3275911), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 + N[(N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(0.254829592 + N[(t$95$1 * N[(-0.284496736 + N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(1.421413741 + N[(N[(1.061405429 * N[(1.0 / N[(0.3275911 * N[Abs[x], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + -1.453152027), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left|x\right| \cdot 0.3275911\\
t_1 := \frac{1}{1 + x \cdot 0.3275911}\\
1 + \left(e^{x \cdot \left(-x\right)} \cdot \left(0.254829592 + t_1 \cdot \left(-0.284496736 + \frac{1}{t_0} \cdot \left(1.421413741 + \mathsf{fma}\left(1.061405429, \frac{1}{\mathsf{fma}\left(0.3275911, \left|x\right|, 1\right)}, -1.453152027\right) \cdot t_1\right)\right)\right)\right) \cdot \frac{-1}{t_0}
\end{array}
\end{array}
Initial program 80.1%
associate-*l*80.1%
Simplified80.1%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr80.1%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr79.6%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
+-commutative79.6%
div-inv79.6%
fma-def79.6%
+-commutative79.6%
fma-udef79.6%
Applied egg-rr79.6%
Final simplification79.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* (fabs x) 0.3275911))) (t_1 (/ 1.0 t_0)))
(+
1.0
(*
(*
(exp (* x (- x)))
(+
0.254829592
(*
t_1
(+
-0.284496736
(*
t_1
(+
1.421413741
(*
(+ -1.453152027 (/ 1.061405429 t_0))
(/ 1.0 (+ 1.0 (* x 0.3275911))))))))))
(/ -1.0 t_0)))))
double code(double x) {
double t_0 = 1.0 + (fabs(x) * 0.3275911);
double t_1 = 1.0 / t_0;
return 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * (1.0 / (1.0 + (x * 0.3275911)))))))))) * (-1.0 / t_0));
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
t_0 = 1.0d0 + (abs(x) * 0.3275911d0)
t_1 = 1.0d0 / t_0
code = 1.0d0 + ((exp((x * -x)) * (0.254829592d0 + (t_1 * ((-0.284496736d0) + (t_1 * (1.421413741d0 + (((-1.453152027d0) + (1.061405429d0 / t_0)) * (1.0d0 / (1.0d0 + (x * 0.3275911d0)))))))))) * ((-1.0d0) / t_0))
end function
public static double code(double x) {
double t_0 = 1.0 + (Math.abs(x) * 0.3275911);
double t_1 = 1.0 / t_0;
return 1.0 + ((Math.exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * (1.0 / (1.0 + (x * 0.3275911)))))))))) * (-1.0 / t_0));
}
def code(x): t_0 = 1.0 + (math.fabs(x) * 0.3275911) t_1 = 1.0 / t_0 return 1.0 + ((math.exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * (1.0 / (1.0 + (x * 0.3275911)))))))))) * (-1.0 / t_0))
function code(x) t_0 = Float64(1.0 + Float64(abs(x) * 0.3275911)) t_1 = Float64(1.0 / t_0) return Float64(1.0 + Float64(Float64(exp(Float64(x * Float64(-x))) * Float64(0.254829592 + Float64(t_1 * Float64(-0.284496736 + Float64(t_1 * Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) * Float64(1.0 / Float64(1.0 + Float64(x * 0.3275911)))))))))) * Float64(-1.0 / t_0))) end
function tmp = code(x) t_0 = 1.0 + (abs(x) * 0.3275911); t_1 = 1.0 / t_0; tmp = 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * (1.0 / (1.0 + (x * 0.3275911)))))))))) * (-1.0 / t_0)); end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, N[(1.0 + N[(N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(0.254829592 + N[(t$95$1 * N[(-0.284496736 + N[(t$95$1 * N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 + N[(x * 0.3275911), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left|x\right| \cdot 0.3275911\\
t_1 := \frac{1}{t_0}\\
1 + \left(e^{x \cdot \left(-x\right)} \cdot \left(0.254829592 + t_1 \cdot \left(-0.284496736 + t_1 \cdot \left(1.421413741 + \left(-1.453152027 + \frac{1.061405429}{t_0}\right) \cdot \frac{1}{1 + x \cdot 0.3275911}\right)\right)\right)\right) \cdot \frac{-1}{t_0}
\end{array}
\end{array}
Initial program 80.1%
associate-*l*80.1%
Simplified80.1%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr80.1%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
Final simplification79.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* (fabs x) 0.3275911)))
(t_1 (/ 1.0 (+ 1.0 (* x 0.3275911)))))
(+
1.0
(*
(*
(exp (* x (- x)))
(+
0.254829592
(*
t_1
(+
-0.284496736
(*
(/ 1.0 t_0)
(+ 1.421413741 (* (+ -1.453152027 (/ 1.061405429 t_0)) t_1)))))))
(/ -1.0 t_0)))))
double code(double x) {
double t_0 = 1.0 + (fabs(x) * 0.3275911);
double t_1 = 1.0 / (1.0 + (x * 0.3275911));
return 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + ((1.0 / t_0) * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * t_1))))))) * (-1.0 / t_0));
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
t_0 = 1.0d0 + (abs(x) * 0.3275911d0)
t_1 = 1.0d0 / (1.0d0 + (x * 0.3275911d0))
code = 1.0d0 + ((exp((x * -x)) * (0.254829592d0 + (t_1 * ((-0.284496736d0) + ((1.0d0 / t_0) * (1.421413741d0 + (((-1.453152027d0) + (1.061405429d0 / t_0)) * t_1))))))) * ((-1.0d0) / t_0))
end function
public static double code(double x) {
double t_0 = 1.0 + (Math.abs(x) * 0.3275911);
double t_1 = 1.0 / (1.0 + (x * 0.3275911));
return 1.0 + ((Math.exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + ((1.0 / t_0) * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * t_1))))))) * (-1.0 / t_0));
}
def code(x): t_0 = 1.0 + (math.fabs(x) * 0.3275911) t_1 = 1.0 / (1.0 + (x * 0.3275911)) return 1.0 + ((math.exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + ((1.0 / t_0) * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * t_1))))))) * (-1.0 / t_0))
function code(x) t_0 = Float64(1.0 + Float64(abs(x) * 0.3275911)) t_1 = Float64(1.0 / Float64(1.0 + Float64(x * 0.3275911))) return Float64(1.0 + Float64(Float64(exp(Float64(x * Float64(-x))) * Float64(0.254829592 + Float64(t_1 * Float64(-0.284496736 + Float64(Float64(1.0 / t_0) * Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) * t_1))))))) * Float64(-1.0 / t_0))) end
function tmp = code(x) t_0 = 1.0 + (abs(x) * 0.3275911); t_1 = 1.0 / (1.0 + (x * 0.3275911)); tmp = 1.0 + ((exp((x * -x)) * (0.254829592 + (t_1 * (-0.284496736 + ((1.0 / t_0) * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * t_1))))))) * (-1.0 / t_0)); end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[(1.0 + N[(x * 0.3275911), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 + N[(N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(0.254829592 + N[(t$95$1 * N[(-0.284496736 + N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left|x\right| \cdot 0.3275911\\
t_1 := \frac{1}{1 + x \cdot 0.3275911}\\
1 + \left(e^{x \cdot \left(-x\right)} \cdot \left(0.254829592 + t_1 \cdot \left(-0.284496736 + \frac{1}{t_0} \cdot \left(1.421413741 + \left(-1.453152027 + \frac{1.061405429}{t_0}\right) \cdot t_1\right)\right)\right)\right) \cdot \frac{-1}{t_0}
\end{array}
\end{array}
Initial program 80.1%
associate-*l*80.1%
Simplified80.1%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr80.1%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr79.6%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
Final simplification79.6%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* (fabs x) 0.3275911)))
(t_1 (+ 1.0 (* x 0.3275911)))
(t_2 (/ 1.0 t_1)))
(+
1.0
(*
(*
(exp (* x (- x)))
(+
0.254829592
(*
t_2
(+
-0.284496736
(*
(/ 1.0 t_0)
(+ 1.421413741 (* (+ -1.453152027 (/ 1.061405429 t_0)) t_2)))))))
(/ -1.0 t_1)))))
double code(double x) {
double t_0 = 1.0 + (fabs(x) * 0.3275911);
double t_1 = 1.0 + (x * 0.3275911);
double t_2 = 1.0 / t_1;
return 1.0 + ((exp((x * -x)) * (0.254829592 + (t_2 * (-0.284496736 + ((1.0 / t_0) * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * t_2))))))) * (-1.0 / t_1));
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
t_0 = 1.0d0 + (abs(x) * 0.3275911d0)
t_1 = 1.0d0 + (x * 0.3275911d0)
t_2 = 1.0d0 / t_1
code = 1.0d0 + ((exp((x * -x)) * (0.254829592d0 + (t_2 * ((-0.284496736d0) + ((1.0d0 / t_0) * (1.421413741d0 + (((-1.453152027d0) + (1.061405429d0 / t_0)) * t_2))))))) * ((-1.0d0) / t_1))
end function
public static double code(double x) {
double t_0 = 1.0 + (Math.abs(x) * 0.3275911);
double t_1 = 1.0 + (x * 0.3275911);
double t_2 = 1.0 / t_1;
return 1.0 + ((Math.exp((x * -x)) * (0.254829592 + (t_2 * (-0.284496736 + ((1.0 / t_0) * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * t_2))))))) * (-1.0 / t_1));
}
def code(x): t_0 = 1.0 + (math.fabs(x) * 0.3275911) t_1 = 1.0 + (x * 0.3275911) t_2 = 1.0 / t_1 return 1.0 + ((math.exp((x * -x)) * (0.254829592 + (t_2 * (-0.284496736 + ((1.0 / t_0) * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * t_2))))))) * (-1.0 / t_1))
function code(x) t_0 = Float64(1.0 + Float64(abs(x) * 0.3275911)) t_1 = Float64(1.0 + Float64(x * 0.3275911)) t_2 = Float64(1.0 / t_1) return Float64(1.0 + Float64(Float64(exp(Float64(x * Float64(-x))) * Float64(0.254829592 + Float64(t_2 * Float64(-0.284496736 + Float64(Float64(1.0 / t_0) * Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) * t_2))))))) * Float64(-1.0 / t_1))) end
function tmp = code(x) t_0 = 1.0 + (abs(x) * 0.3275911); t_1 = 1.0 + (x * 0.3275911); t_2 = 1.0 / t_1; tmp = 1.0 + ((exp((x * -x)) * (0.254829592 + (t_2 * (-0.284496736 + ((1.0 / t_0) * (1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) * t_2))))))) * (-1.0 / t_1)); end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(x * 0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / t$95$1), $MachinePrecision]}, N[(1.0 + N[(N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(0.254829592 + N[(t$95$2 * N[(-0.284496736 + N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \left|x\right| \cdot 0.3275911\\
t_1 := 1 + x \cdot 0.3275911\\
t_2 := \frac{1}{t_1}\\
1 + \left(e^{x \cdot \left(-x\right)} \cdot \left(0.254829592 + t_2 \cdot \left(-0.284496736 + \frac{1}{t_0} \cdot \left(1.421413741 + \left(-1.453152027 + \frac{1.061405429}{t_0}\right) \cdot t_2\right)\right)\right)\right) \cdot \frac{-1}{t_1}
\end{array}
\end{array}
Initial program 80.1%
associate-*l*80.1%
Simplified80.1%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr80.1%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr79.6%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr79.6%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
Final simplification79.6%
(FPCore (x) :precision binary64 (+ 1.0 (* -0.254829592 (/ (exp (* x (- x))) (+ 1.0 (* (fabs x) 0.3275911))))))
double code(double x) {
return 1.0 + (-0.254829592 * (exp((x * -x)) / (1.0 + (fabs(x) * 0.3275911))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 + ((-0.254829592d0) * (exp((x * -x)) / (1.0d0 + (abs(x) * 0.3275911d0))))
end function
public static double code(double x) {
return 1.0 + (-0.254829592 * (Math.exp((x * -x)) / (1.0 + (Math.abs(x) * 0.3275911))));
}
def code(x): return 1.0 + (-0.254829592 * (math.exp((x * -x)) / (1.0 + (math.fabs(x) * 0.3275911))))
function code(x) return Float64(1.0 + Float64(-0.254829592 * Float64(exp(Float64(x * Float64(-x))) / Float64(1.0 + Float64(abs(x) * 0.3275911))))) end
function tmp = code(x) tmp = 1.0 + (-0.254829592 * (exp((x * -x)) / (1.0 + (abs(x) * 0.3275911)))); end
code[x_] := N[(1.0 + N[(-0.254829592 * N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] / N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + -0.254829592 \cdot \frac{e^{x \cdot \left(-x\right)}}{1 + \left|x\right| \cdot 0.3275911}
\end{array}
Initial program 80.1%
associate-*l*80.1%
Simplified80.1%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr80.1%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr79.6%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
Taylor expanded in x around inf 57.0%
*-commutative57.0%
+-commutative57.0%
cancel-sign-sub-inv57.0%
distribute-lft-neg-in57.0%
distribute-rgt-neg-in57.0%
+-commutative57.0%
unpow257.0%
distribute-rgt-neg-in57.0%
fma-def57.0%
metadata-eval57.0%
Simplified57.0%
Taylor expanded in x around 0 57.0%
Final simplification57.0%
(FPCore (x) :precision binary64 (+ 1.0 (/ -0.254829592 (+ 1.0 (* (fabs x) 0.3275911)))))
double code(double x) {
return 1.0 + (-0.254829592 / (1.0 + (fabs(x) * 0.3275911)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 + ((-0.254829592d0) / (1.0d0 + (abs(x) * 0.3275911d0)))
end function
public static double code(double x) {
return 1.0 + (-0.254829592 / (1.0 + (Math.abs(x) * 0.3275911)));
}
def code(x): return 1.0 + (-0.254829592 / (1.0 + (math.fabs(x) * 0.3275911)))
function code(x) return Float64(1.0 + Float64(-0.254829592 / Float64(1.0 + Float64(abs(x) * 0.3275911)))) end
function tmp = code(x) tmp = 1.0 + (-0.254829592 / (1.0 + (abs(x) * 0.3275911))); end
code[x_] := N[(1.0 + N[(-0.254829592 / N[(1.0 + N[(N[Abs[x], $MachinePrecision] * 0.3275911), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + \frac{-0.254829592}{1 + \left|x\right| \cdot 0.3275911}
\end{array}
Initial program 80.1%
associate-*l*80.1%
Simplified80.1%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr80.1%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
expm1-log1p-u80.1%
expm1-udef80.1%
log1p-udef80.1%
add-exp-log80.1%
+-commutative80.1%
fma-udef80.1%
Applied egg-rr79.6%
fma-def80.1%
associate--l+80.1%
metadata-eval80.1%
+-rgt-identity80.1%
unpow180.1%
sqr-pow41.0%
fabs-sqr41.0%
sqr-pow79.6%
unpow179.6%
Simplified79.6%
Taylor expanded in x around inf 57.0%
*-commutative57.0%
+-commutative57.0%
cancel-sign-sub-inv57.0%
distribute-lft-neg-in57.0%
distribute-rgt-neg-in57.0%
+-commutative57.0%
unpow257.0%
distribute-rgt-neg-in57.0%
fma-def57.0%
metadata-eval57.0%
Simplified57.0%
Taylor expanded in x around 0 56.2%
Final simplification56.2%
herbie shell --seed 2023192
(FPCore (x)
:name "Jmat.Real.erf"
:precision binary64
(- 1.0 (* (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ 0.254829592 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ -0.284496736 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ 1.421413741 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) (+ -1.453152027 (* (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x)))) 1.061405429))))))))) (exp (- (* (fabs x) (fabs x)))))))