
(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 14 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}
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(* (fma 0.3275911 x_m 1.0) (exp (pow x_m 2.0)))))
(t_1 (+ t_0 (+ 1.0 (pow t_0 2.0))))
(t_2 (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x_m))))))
(if (<=
(*
(*
t_2
(+
0.254829592
(*
t_2
(+
-0.284496736
(*
t_2
(+ 1.421413741 (* t_2 (+ -1.453152027 (* t_2 1.061405429)))))))))
(exp (- (* x_m x_m))))
0.9995)
(/ (- 1.0 (log (+ 1.0 (expm1 (pow t_0 3.0))))) t_1)
(/
(+
2.999999997e-9
(+
(* (pow x_m 2.0) -3.820122044248399)
(+ (* 0.3111712305105463 (pow x_m 3.0)) (* x_m 3.385159067440336))))
t_1))))x_m = fabs(x);
double code(double x_m) {
double t_0 = (0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / (fma(0.3275911, x_m, 1.0) * exp(pow(x_m, 2.0)));
double t_1 = t_0 + (1.0 + pow(t_0, 2.0));
double t_2 = 1.0 / (1.0 + (0.3275911 * fabs(x_m)));
double tmp;
if (((t_2 * (0.254829592 + (t_2 * (-0.284496736 + (t_2 * (1.421413741 + (t_2 * (-1.453152027 + (t_2 * 1.061405429))))))))) * exp(-(x_m * x_m))) <= 0.9995) {
tmp = (1.0 - log((1.0 + expm1(pow(t_0, 3.0))))) / t_1;
} else {
tmp = (2.999999997e-9 + ((pow(x_m, 2.0) * -3.820122044248399) + ((0.3111712305105463 * pow(x_m, 3.0)) + (x_m * 3.385159067440336)))) / t_1;
}
return tmp;
}
x_m = abs(x) function code(x_m) t_0 = Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / Float64(fma(0.3275911, x_m, 1.0) * exp((x_m ^ 2.0)))) t_1 = Float64(t_0 + Float64(1.0 + (t_0 ^ 2.0))) t_2 = Float64(1.0 / Float64(1.0 + Float64(0.3275911 * abs(x_m)))) tmp = 0.0 if (Float64(Float64(t_2 * Float64(0.254829592 + Float64(t_2 * Float64(-0.284496736 + Float64(t_2 * Float64(1.421413741 + Float64(t_2 * Float64(-1.453152027 + Float64(t_2 * 1.061405429))))))))) * exp(Float64(-Float64(x_m * x_m)))) <= 0.9995) tmp = Float64(Float64(1.0 - log(Float64(1.0 + expm1((t_0 ^ 3.0))))) / t_1); else tmp = Float64(Float64(2.999999997e-9 + Float64(Float64((x_m ^ 2.0) * -3.820122044248399) + Float64(Float64(0.3111712305105463 * (x_m ^ 3.0)) + Float64(x_m * 3.385159067440336)))) / t_1); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.3275911 * x$95$m + 1.0), $MachinePrecision] * N[Exp[N[Power[x$95$m, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(1.0 + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(1.0 + N[(0.3275911 * N[Abs[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$2 * 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[(t$95$2 * 1.061405429), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(x$95$m * x$95$m), $MachinePrecision])], $MachinePrecision]), $MachinePrecision], 0.9995], N[(N[(1.0 - N[Log[N[(1.0 + N[(Exp[N[Power[t$95$0, 3.0], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(2.999999997e-9 + N[(N[(N[Power[x$95$m, 2.0], $MachinePrecision] * -3.820122044248399), $MachinePrecision] + N[(N[(0.3111712305105463 * N[Power[x$95$m, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x$95$m * 3.385159067440336), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right) \cdot e^{{x\_m}^{2}}}\\
t_1 := t\_0 + \left(1 + {t\_0}^{2}\right)\\
t_2 := \frac{1}{1 + 0.3275911 \cdot \left|x\_m\right|}\\
\mathbf{if}\;\left(t\_2 \cdot \left(0.254829592 + t\_2 \cdot \left(-0.284496736 + t\_2 \cdot \left(1.421413741 + t\_2 \cdot \left(-1.453152027 + t\_2 \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-x\_m \cdot x\_m} \leq 0.9995:\\
\;\;\;\;\frac{1 - \log \left(1 + \mathsf{expm1}\left({t\_0}^{3}\right)\right)}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{2.999999997 \cdot 10^{-9} + \left({x\_m}^{2} \cdot -3.820122044248399 + \left(0.3111712305105463 \cdot {x\_m}^{3} + x\_m \cdot 3.385159067440336\right)\right)}{t\_1}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 31853699/125000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -8890523/31250000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 1421413741/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -1453152027/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) 1061405429/1000000000))))))))) (exp.f64 (neg.f64 (*.f64 (fabs.f64 x) (fabs.f64 x))))) < 0.99950000000000006Initial program 99.7%
Simplified99.7%
associate-/l/99.7%
flip3--99.7%
Applied egg-rr99.7%
Simplified98.3%
log1p-expm1-u98.3%
log1p-udef98.3%
Applied egg-rr98.3%
if 0.99950000000000006 < (*.f64 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 31853699/125000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -8890523/31250000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 1421413741/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -1453152027/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) 1061405429/1000000000))))))))) (exp.f64 (neg.f64 (*.f64 (fabs.f64 x) (fabs.f64 x))))) Initial program 58.0%
Simplified58.0%
associate-/l/58.0%
flip3--58.1%
Applied egg-rr58.1%
Simplified56.5%
Taylor expanded in x around 0 95.0%
Final simplification96.6%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0 (pow (fma 0.3275911 x_m 1.0) 3.0))
(t_1 (+ 1.0 (* 0.3275911 (fabs x_m))))
(t_2 (/ 1.0 t_1))
(t_3
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(* (fma 0.3275911 x_m 1.0) (exp (pow x_m 2.0))))))
(if (<=
(*
(*
t_2
(+
0.254829592
(*
t_2
(+
-0.284496736
(*
t_2
(+ 1.421413741 (* t_2 (+ -1.453152027 (* t_2 1.061405429)))))))))
(exp (- (* x_m x_m))))
0.9995)
(fma
(+
-0.254829592
(-
(/ 1.453152027 t_0)
(/
(+
(/ 1.061405429 t_0)
(+ -0.284496736 (/ 1.421413741 (fma 0.3275911 x_m 1.0))))
(fma 0.3275911 x_m 1.0))))
(/ (pow (exp x_m) (- x_m)) t_1)
1.0)
(/
(+
2.999999997e-9
(+
(* (pow x_m 2.0) -3.820122044248399)
(+ (* 0.3111712305105463 (pow x_m 3.0)) (* x_m 3.385159067440336))))
(+ t_3 (+ 1.0 (pow t_3 2.0)))))))x_m = fabs(x);
double code(double x_m) {
double t_0 = pow(fma(0.3275911, x_m, 1.0), 3.0);
double t_1 = 1.0 + (0.3275911 * fabs(x_m));
double t_2 = 1.0 / t_1;
double t_3 = (0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / (fma(0.3275911, x_m, 1.0) * exp(pow(x_m, 2.0)));
double tmp;
if (((t_2 * (0.254829592 + (t_2 * (-0.284496736 + (t_2 * (1.421413741 + (t_2 * (-1.453152027 + (t_2 * 1.061405429))))))))) * exp(-(x_m * x_m))) <= 0.9995) {
tmp = fma((-0.254829592 + ((1.453152027 / t_0) - (((1.061405429 / t_0) + (-0.284496736 + (1.421413741 / fma(0.3275911, x_m, 1.0)))) / fma(0.3275911, x_m, 1.0)))), (pow(exp(x_m), -x_m) / t_1), 1.0);
} else {
tmp = (2.999999997e-9 + ((pow(x_m, 2.0) * -3.820122044248399) + ((0.3111712305105463 * pow(x_m, 3.0)) + (x_m * 3.385159067440336)))) / (t_3 + (1.0 + pow(t_3, 2.0)));
}
return tmp;
}
x_m = abs(x) function code(x_m) t_0 = fma(0.3275911, x_m, 1.0) ^ 3.0 t_1 = Float64(1.0 + Float64(0.3275911 * abs(x_m))) t_2 = Float64(1.0 / t_1) t_3 = Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / Float64(fma(0.3275911, x_m, 1.0) * exp((x_m ^ 2.0)))) tmp = 0.0 if (Float64(Float64(t_2 * Float64(0.254829592 + Float64(t_2 * Float64(-0.284496736 + Float64(t_2 * Float64(1.421413741 + Float64(t_2 * Float64(-1.453152027 + Float64(t_2 * 1.061405429))))))))) * exp(Float64(-Float64(x_m * x_m)))) <= 0.9995) tmp = fma(Float64(-0.254829592 + Float64(Float64(1.453152027 / t_0) - Float64(Float64(Float64(1.061405429 / t_0) + Float64(-0.284496736 + Float64(1.421413741 / fma(0.3275911, x_m, 1.0)))) / fma(0.3275911, x_m, 1.0)))), Float64((exp(x_m) ^ Float64(-x_m)) / t_1), 1.0); else tmp = Float64(Float64(2.999999997e-9 + Float64(Float64((x_m ^ 2.0) * -3.820122044248399) + Float64(Float64(0.3111712305105463 * (x_m ^ 3.0)) + Float64(x_m * 3.385159067440336)))) / Float64(t_3 + Float64(1.0 + (t_3 ^ 2.0)))); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[Power[N[(0.3275911 * x$95$m + 1.0), $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(0.3275911 * N[Abs[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.3275911 * x$95$m + 1.0), $MachinePrecision] * N[Exp[N[Power[x$95$m, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$2 * 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[(t$95$2 * 1.061405429), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(x$95$m * x$95$m), $MachinePrecision])], $MachinePrecision]), $MachinePrecision], 0.9995], N[(N[(-0.254829592 + N[(N[(1.453152027 / t$95$0), $MachinePrecision] - N[(N[(N[(1.061405429 / t$95$0), $MachinePrecision] + N[(-0.284496736 + N[(1.421413741 / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Exp[x$95$m], $MachinePrecision], (-x$95$m)], $MachinePrecision] / t$95$1), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(2.999999997e-9 + N[(N[(N[Power[x$95$m, 2.0], $MachinePrecision] * -3.820122044248399), $MachinePrecision] + N[(N[(0.3111712305105463 * N[Power[x$95$m, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x$95$m * 3.385159067440336), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 + N[(1.0 + N[Power[t$95$3, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(0.3275911, x\_m, 1\right)\right)}^{3}\\
t_1 := 1 + 0.3275911 \cdot \left|x\_m\right|\\
t_2 := \frac{1}{t\_1}\\
t_3 := \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right) \cdot e^{{x\_m}^{2}}}\\
\mathbf{if}\;\left(t\_2 \cdot \left(0.254829592 + t\_2 \cdot \left(-0.284496736 + t\_2 \cdot \left(1.421413741 + t\_2 \cdot \left(-1.453152027 + t\_2 \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-x\_m \cdot x\_m} \leq 0.9995:\\
\;\;\;\;\mathsf{fma}\left(-0.254829592 + \left(\frac{1.453152027}{t\_0} - \frac{\frac{1.061405429}{t\_0} + \left(-0.284496736 + \frac{1.421413741}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}\right)}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}\right), \frac{{\left(e^{x\_m}\right)}^{\left(-x\_m\right)}}{t\_1}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2.999999997 \cdot 10^{-9} + \left({x\_m}^{2} \cdot -3.820122044248399 + \left(0.3111712305105463 \cdot {x\_m}^{3} + x\_m \cdot 3.385159067440336\right)\right)}{t\_3 + \left(1 + {t\_3}^{2}\right)}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 31853699/125000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -8890523/31250000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 1421413741/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -1453152027/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) 1061405429/1000000000))))))))) (exp.f64 (neg.f64 (*.f64 (fabs.f64 x) (fabs.f64 x))))) < 0.99950000000000006Initial program 99.7%
Simplified99.7%
Taylor expanded in x around 0 99.7%
associate--r+99.7%
div-sub99.7%
Simplified98.3%
fma-udef98.3%
Applied egg-rr98.3%
if 0.99950000000000006 < (*.f64 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 31853699/125000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -8890523/31250000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 1421413741/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -1453152027/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) 1061405429/1000000000))))))))) (exp.f64 (neg.f64 (*.f64 (fabs.f64 x) (fabs.f64 x))))) Initial program 58.0%
Simplified58.0%
associate-/l/58.0%
flip3--58.1%
Applied egg-rr58.1%
Simplified56.5%
Taylor expanded in x around 0 95.0%
Final simplification96.6%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0 (pow (fma 0.3275911 x_m 1.0) 3.0))
(t_1 (+ 1.0 (* 0.3275911 (fabs x_m))))
(t_2 (/ 1.0 t_1))
(t_3
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(* (fma 0.3275911 x_m 1.0) (exp (pow x_m 2.0))))))
(if (<=
(*
(*
t_2
(+
0.254829592
(*
t_2
(+
-0.284496736
(*
t_2
(+ 1.421413741 (* t_2 (+ -1.453152027 (* t_2 1.061405429)))))))))
(exp (- (* x_m x_m))))
0.99998)
(fma
(+
-0.254829592
(-
(/ 1.453152027 t_0)
(/
(+
(/ 1.061405429 t_0)
(+ -0.284496736 (/ 1.421413741 (fma 0.3275911 x_m 1.0))))
(fma 0.3275911 x_m 1.0))))
(/ (pow (exp x_m) (- x_m)) t_1)
1.0)
(/
(+
2.999999997e-9
(+ (* (pow x_m 2.0) -3.820122044248399) (* x_m 3.385159067440336)))
(+ t_3 (+ 1.0 (pow t_3 2.0)))))))x_m = fabs(x);
double code(double x_m) {
double t_0 = pow(fma(0.3275911, x_m, 1.0), 3.0);
double t_1 = 1.0 + (0.3275911 * fabs(x_m));
double t_2 = 1.0 / t_1;
double t_3 = (0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / (fma(0.3275911, x_m, 1.0) * exp(pow(x_m, 2.0)));
double tmp;
if (((t_2 * (0.254829592 + (t_2 * (-0.284496736 + (t_2 * (1.421413741 + (t_2 * (-1.453152027 + (t_2 * 1.061405429))))))))) * exp(-(x_m * x_m))) <= 0.99998) {
tmp = fma((-0.254829592 + ((1.453152027 / t_0) - (((1.061405429 / t_0) + (-0.284496736 + (1.421413741 / fma(0.3275911, x_m, 1.0)))) / fma(0.3275911, x_m, 1.0)))), (pow(exp(x_m), -x_m) / t_1), 1.0);
} else {
tmp = (2.999999997e-9 + ((pow(x_m, 2.0) * -3.820122044248399) + (x_m * 3.385159067440336))) / (t_3 + (1.0 + pow(t_3, 2.0)));
}
return tmp;
}
x_m = abs(x) function code(x_m) t_0 = fma(0.3275911, x_m, 1.0) ^ 3.0 t_1 = Float64(1.0 + Float64(0.3275911 * abs(x_m))) t_2 = Float64(1.0 / t_1) t_3 = Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / Float64(fma(0.3275911, x_m, 1.0) * exp((x_m ^ 2.0)))) tmp = 0.0 if (Float64(Float64(t_2 * Float64(0.254829592 + Float64(t_2 * Float64(-0.284496736 + Float64(t_2 * Float64(1.421413741 + Float64(t_2 * Float64(-1.453152027 + Float64(t_2 * 1.061405429))))))))) * exp(Float64(-Float64(x_m * x_m)))) <= 0.99998) tmp = fma(Float64(-0.254829592 + Float64(Float64(1.453152027 / t_0) - Float64(Float64(Float64(1.061405429 / t_0) + Float64(-0.284496736 + Float64(1.421413741 / fma(0.3275911, x_m, 1.0)))) / fma(0.3275911, x_m, 1.0)))), Float64((exp(x_m) ^ Float64(-x_m)) / t_1), 1.0); else tmp = Float64(Float64(2.999999997e-9 + Float64(Float64((x_m ^ 2.0) * -3.820122044248399) + Float64(x_m * 3.385159067440336))) / Float64(t_3 + Float64(1.0 + (t_3 ^ 2.0)))); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[Power[N[(0.3275911 * x$95$m + 1.0), $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(0.3275911 * N[Abs[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.3275911 * x$95$m + 1.0), $MachinePrecision] * N[Exp[N[Power[x$95$m, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$2 * 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[(t$95$2 * 1.061405429), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(x$95$m * x$95$m), $MachinePrecision])], $MachinePrecision]), $MachinePrecision], 0.99998], N[(N[(-0.254829592 + N[(N[(1.453152027 / t$95$0), $MachinePrecision] - N[(N[(N[(1.061405429 / t$95$0), $MachinePrecision] + N[(-0.284496736 + N[(1.421413741 / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Exp[x$95$m], $MachinePrecision], (-x$95$m)], $MachinePrecision] / t$95$1), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(2.999999997e-9 + N[(N[(N[Power[x$95$m, 2.0], $MachinePrecision] * -3.820122044248399), $MachinePrecision] + N[(x$95$m * 3.385159067440336), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$3 + N[(1.0 + N[Power[t$95$3, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(0.3275911, x\_m, 1\right)\right)}^{3}\\
t_1 := 1 + 0.3275911 \cdot \left|x\_m\right|\\
t_2 := \frac{1}{t\_1}\\
t_3 := \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right) \cdot e^{{x\_m}^{2}}}\\
\mathbf{if}\;\left(t\_2 \cdot \left(0.254829592 + t\_2 \cdot \left(-0.284496736 + t\_2 \cdot \left(1.421413741 + t\_2 \cdot \left(-1.453152027 + t\_2 \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-x\_m \cdot x\_m} \leq 0.99998:\\
\;\;\;\;\mathsf{fma}\left(-0.254829592 + \left(\frac{1.453152027}{t\_0} - \frac{\frac{1.061405429}{t\_0} + \left(-0.284496736 + \frac{1.421413741}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}\right)}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}\right), \frac{{\left(e^{x\_m}\right)}^{\left(-x\_m\right)}}{t\_1}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2.999999997 \cdot 10^{-9} + \left({x\_m}^{2} \cdot -3.820122044248399 + x\_m \cdot 3.385159067440336\right)}{t\_3 + \left(1 + {t\_3}^{2}\right)}\\
\end{array}
\end{array}
if (*.f64 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 31853699/125000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -8890523/31250000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 1421413741/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -1453152027/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) 1061405429/1000000000))))))))) (exp.f64 (neg.f64 (*.f64 (fabs.f64 x) (fabs.f64 x))))) < 0.99997999999999998Initial program 99.5%
Simplified99.5%
Taylor expanded in x around 0 99.5%
associate--r+99.5%
div-sub99.5%
Simplified97.5%
fma-udef97.5%
Applied egg-rr97.5%
if 0.99997999999999998 < (*.f64 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 31853699/125000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -8890523/31250000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 1421413741/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) (+.f64 -1453152027/1000000000 (*.f64 (/.f64 1 (+.f64 1 (*.f64 3275911/10000000 (fabs.f64 x)))) 1061405429/1000000000))))))))) (exp.f64 (neg.f64 (*.f64 (fabs.f64 x) (fabs.f64 x))))) Initial program 57.9%
Simplified57.9%
associate-/l/57.9%
flip3--57.9%
Applied egg-rr57.9%
Simplified57.0%
Taylor expanded in x around 0 95.5%
Final simplification96.5%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0 (pow (fma 0.3275911 x_m 1.0) -3.0)))
(if (<= (fabs x_m) 1e-17)
(+ 1e-9 (* x_m 0.3275910996724089))
(log
(exp
(fma
(+
(-
-0.254829592
(/
(fma
1.061405429
t_0
(+ -0.284496736 (/ 1.421413741 (fma 0.3275911 x_m 1.0))))
(fma 0.3275911 x_m 1.0)))
(* 1.453152027 t_0))
(/ (exp (- (pow x_m 2.0))) (fma 0.3275911 (fabs x_m) 1.0))
1.0))))))x_m = fabs(x);
double code(double x_m) {
double t_0 = pow(fma(0.3275911, x_m, 1.0), -3.0);
double tmp;
if (fabs(x_m) <= 1e-17) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else {
tmp = log(exp(fma(((-0.254829592 - (fma(1.061405429, t_0, (-0.284496736 + (1.421413741 / fma(0.3275911, x_m, 1.0)))) / fma(0.3275911, x_m, 1.0))) + (1.453152027 * t_0)), (exp(-pow(x_m, 2.0)) / fma(0.3275911, fabs(x_m), 1.0)), 1.0)));
}
return tmp;
}
x_m = abs(x) function code(x_m) t_0 = fma(0.3275911, x_m, 1.0) ^ -3.0 tmp = 0.0 if (abs(x_m) <= 1e-17) tmp = Float64(1e-9 + Float64(x_m * 0.3275910996724089)); else tmp = log(exp(fma(Float64(Float64(-0.254829592 - Float64(fma(1.061405429, t_0, Float64(-0.284496736 + Float64(1.421413741 / fma(0.3275911, x_m, 1.0)))) / fma(0.3275911, x_m, 1.0))) + Float64(1.453152027 * t_0)), Float64(exp(Float64(-(x_m ^ 2.0))) / fma(0.3275911, abs(x_m), 1.0)), 1.0))); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[Power[N[(0.3275911 * x$95$m + 1.0), $MachinePrecision], -3.0], $MachinePrecision]}, If[LessEqual[N[Abs[x$95$m], $MachinePrecision], 1e-17], N[(1e-9 + N[(x$95$m * 0.3275910996724089), $MachinePrecision]), $MachinePrecision], N[Log[N[Exp[N[(N[(N[(-0.254829592 - N[(N[(1.061405429 * t$95$0 + N[(-0.284496736 + N[(1.421413741 / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.453152027 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-N[Power[x$95$m, 2.0], $MachinePrecision])], $MachinePrecision] / N[(0.3275911 * N[Abs[x$95$m], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(0.3275911, x\_m, 1\right)\right)}^{-3}\\
\mathbf{if}\;\left|x\_m\right| \leq 10^{-17}:\\
\;\;\;\;10^{-9} + x\_m \cdot 0.3275910996724089\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\mathsf{fma}\left(\left(-0.254829592 - \frac{\mathsf{fma}\left(1.061405429, t\_0, -0.284496736 + \frac{1.421413741}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}\right)}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}\right) + 1.453152027 \cdot t\_0, \frac{e^{-{x\_m}^{2}}}{\mathsf{fma}\left(0.3275911, \left|x\_m\right|, 1\right)}, 1\right)}\right)\\
\end{array}
\end{array}
if (fabs.f64 x) < 1.00000000000000007e-17Initial program 57.8%
Simplified57.8%
Applied egg-rr57.8%
distribute-lft-in57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in x around 0 57.8%
pow157.8%
Applied egg-rr57.8%
unpow157.8%
unpow157.8%
sqr-pow26.8%
fabs-sqr26.8%
sqr-pow57.8%
unpow157.8%
Simplified57.8%
Taylor expanded in x around 0 99.5%
*-commutative99.5%
Simplified99.5%
if 1.00000000000000007e-17 < (fabs.f64 x) Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 97.1%
associate--r+97.1%
div-sub97.2%
Simplified94.2%
add-log-exp94.2%
Applied egg-rr94.3%
Final simplification96.8%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0 (pow (fma 0.3275911 x_m 1.0) -3.0)))
(if (<= (fabs x_m) 1e-17)
(+ 1e-9 (* x_m 0.3275910996724089))
(fma
(+
(-
-0.254829592
(/
(fma
1.061405429
t_0
(+ -0.284496736 (/ 1.421413741 (fma 0.3275911 x_m 1.0))))
(fma 0.3275911 x_m 1.0)))
(* 1.453152027 t_0))
(/ (exp (- (pow x_m 2.0))) (fma 0.3275911 (fabs x_m) 1.0))
1.0))))x_m = fabs(x);
double code(double x_m) {
double t_0 = pow(fma(0.3275911, x_m, 1.0), -3.0);
double tmp;
if (fabs(x_m) <= 1e-17) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else {
tmp = fma(((-0.254829592 - (fma(1.061405429, t_0, (-0.284496736 + (1.421413741 / fma(0.3275911, x_m, 1.0)))) / fma(0.3275911, x_m, 1.0))) + (1.453152027 * t_0)), (exp(-pow(x_m, 2.0)) / fma(0.3275911, fabs(x_m), 1.0)), 1.0);
}
return tmp;
}
x_m = abs(x) function code(x_m) t_0 = fma(0.3275911, x_m, 1.0) ^ -3.0 tmp = 0.0 if (abs(x_m) <= 1e-17) tmp = Float64(1e-9 + Float64(x_m * 0.3275910996724089)); else tmp = fma(Float64(Float64(-0.254829592 - Float64(fma(1.061405429, t_0, Float64(-0.284496736 + Float64(1.421413741 / fma(0.3275911, x_m, 1.0)))) / fma(0.3275911, x_m, 1.0))) + Float64(1.453152027 * t_0)), Float64(exp(Float64(-(x_m ^ 2.0))) / fma(0.3275911, abs(x_m), 1.0)), 1.0); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[Power[N[(0.3275911 * x$95$m + 1.0), $MachinePrecision], -3.0], $MachinePrecision]}, If[LessEqual[N[Abs[x$95$m], $MachinePrecision], 1e-17], N[(1e-9 + N[(x$95$m * 0.3275910996724089), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-0.254829592 - N[(N[(1.061405429 * t$95$0 + N[(-0.284496736 + N[(1.421413741 / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.453152027 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-N[Power[x$95$m, 2.0], $MachinePrecision])], $MachinePrecision] / N[(0.3275911 * N[Abs[x$95$m], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(0.3275911, x\_m, 1\right)\right)}^{-3}\\
\mathbf{if}\;\left|x\_m\right| \leq 10^{-17}:\\
\;\;\;\;10^{-9} + x\_m \cdot 0.3275910996724089\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-0.254829592 - \frac{\mathsf{fma}\left(1.061405429, t\_0, -0.284496736 + \frac{1.421413741}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}\right)}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}\right) + 1.453152027 \cdot t\_0, \frac{e^{-{x\_m}^{2}}}{\mathsf{fma}\left(0.3275911, \left|x\_m\right|, 1\right)}, 1\right)\\
\end{array}
\end{array}
if (fabs.f64 x) < 1.00000000000000007e-17Initial program 57.8%
Simplified57.8%
Applied egg-rr57.8%
distribute-lft-in57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in x around 0 57.8%
pow157.8%
Applied egg-rr57.8%
unpow157.8%
unpow157.8%
sqr-pow26.8%
fabs-sqr26.8%
sqr-pow57.8%
unpow157.8%
Simplified57.8%
Taylor expanded in x around 0 99.5%
*-commutative99.5%
Simplified99.5%
if 1.00000000000000007e-17 < (fabs.f64 x) Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 97.1%
associate--r+97.1%
div-sub97.2%
Simplified94.2%
fma-udef94.2%
Applied egg-rr94.3%
fma-def94.3%
+-commutative94.3%
*-commutative94.3%
Simplified94.3%
Final simplification96.8%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(if (<= (fabs x_m) 1e-17)
(+ 1e-9 (* x_m 0.3275910996724089))
(+
1.0
(*
(/ (exp (- (pow x_m 2.0))) (fma 0.3275911 x_m 1.0))
(+
(/ 0.284496736 (fma 0.3275911 x_m 1.0))
(+
-0.254829592
(-
(/ 1.453152027 (pow (fma 0.3275911 x_m 1.0) 3.0))
(+
(/ 1.061405429 (pow (fma 0.3275911 x_m 1.0) 4.0))
(/ 1.421413741 (pow (fma 0.3275911 x_m 1.0) 2.0))))))))))x_m = fabs(x);
double code(double x_m) {
double tmp;
if (fabs(x_m) <= 1e-17) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else {
tmp = 1.0 + ((exp(-pow(x_m, 2.0)) / fma(0.3275911, x_m, 1.0)) * ((0.284496736 / fma(0.3275911, x_m, 1.0)) + (-0.254829592 + ((1.453152027 / pow(fma(0.3275911, x_m, 1.0), 3.0)) - ((1.061405429 / pow(fma(0.3275911, x_m, 1.0), 4.0)) + (1.421413741 / pow(fma(0.3275911, x_m, 1.0), 2.0)))))));
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (abs(x_m) <= 1e-17) tmp = Float64(1e-9 + Float64(x_m * 0.3275910996724089)); else tmp = Float64(1.0 + Float64(Float64(exp(Float64(-(x_m ^ 2.0))) / fma(0.3275911, x_m, 1.0)) * Float64(Float64(0.284496736 / fma(0.3275911, x_m, 1.0)) + Float64(-0.254829592 + Float64(Float64(1.453152027 / (fma(0.3275911, x_m, 1.0) ^ 3.0)) - Float64(Float64(1.061405429 / (fma(0.3275911, x_m, 1.0) ^ 4.0)) + Float64(1.421413741 / (fma(0.3275911, x_m, 1.0) ^ 2.0)))))))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[Abs[x$95$m], $MachinePrecision], 1e-17], N[(1e-9 + N[(x$95$m * 0.3275910996724089), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(N[Exp[(-N[Power[x$95$m, 2.0], $MachinePrecision])], $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision] * N[(N[(0.284496736 / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision] + N[(-0.254829592 + N[(N[(1.453152027 / N[Power[N[(0.3275911 * x$95$m + 1.0), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] - N[(N[(1.061405429 / N[Power[N[(0.3275911 * x$95$m + 1.0), $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] + N[(1.421413741 / N[Power[N[(0.3275911 * x$95$m + 1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;\left|x\_m\right| \leq 10^{-17}:\\
\;\;\;\;10^{-9} + x\_m \cdot 0.3275910996724089\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{e^{-{x\_m}^{2}}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)} \cdot \left(\frac{0.284496736}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)} + \left(-0.254829592 + \left(\frac{1.453152027}{{\left(\mathsf{fma}\left(0.3275911, x\_m, 1\right)\right)}^{3}} - \left(\frac{1.061405429}{{\left(\mathsf{fma}\left(0.3275911, x\_m, 1\right)\right)}^{4}} + \frac{1.421413741}{{\left(\mathsf{fma}\left(0.3275911, x\_m, 1\right)\right)}^{2}}\right)\right)\right)\right)\\
\end{array}
\end{array}
if (fabs.f64 x) < 1.00000000000000007e-17Initial program 57.8%
Simplified57.8%
Applied egg-rr57.8%
distribute-lft-in57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in x around 0 57.8%
pow157.8%
Applied egg-rr57.8%
unpow157.8%
unpow157.8%
sqr-pow26.8%
fabs-sqr26.8%
sqr-pow57.8%
unpow157.8%
Simplified57.8%
Taylor expanded in x around 0 99.5%
*-commutative99.5%
Simplified99.5%
if 1.00000000000000007e-17 < (fabs.f64 x) Initial program 97.1%
Simplified97.1%
Taylor expanded in x around inf 97.1%
Simplified94.3%
Final simplification96.8%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0 (pow (fma 0.3275911 x_m 1.0) 3.0)))
(if (<= (fabs x_m) 1e-17)
(+ 1e-9 (* x_m 0.3275910996724089))
(fma
(+
-0.254829592
(-
(/ 1.453152027 t_0)
(/
(+
(/ 1.061405429 t_0)
(+ -0.284496736 (/ 1.421413741 (fma 0.3275911 x_m 1.0))))
(fma 0.3275911 x_m 1.0))))
(/ (pow (exp x_m) (- x_m)) (+ 1.0 (* 0.3275911 (fabs x_m))))
1.0))))x_m = fabs(x);
double code(double x_m) {
double t_0 = pow(fma(0.3275911, x_m, 1.0), 3.0);
double tmp;
if (fabs(x_m) <= 1e-17) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else {
tmp = fma((-0.254829592 + ((1.453152027 / t_0) - (((1.061405429 / t_0) + (-0.284496736 + (1.421413741 / fma(0.3275911, x_m, 1.0)))) / fma(0.3275911, x_m, 1.0)))), (pow(exp(x_m), -x_m) / (1.0 + (0.3275911 * fabs(x_m)))), 1.0);
}
return tmp;
}
x_m = abs(x) function code(x_m) t_0 = fma(0.3275911, x_m, 1.0) ^ 3.0 tmp = 0.0 if (abs(x_m) <= 1e-17) tmp = Float64(1e-9 + Float64(x_m * 0.3275910996724089)); else tmp = fma(Float64(-0.254829592 + Float64(Float64(1.453152027 / t_0) - Float64(Float64(Float64(1.061405429 / t_0) + Float64(-0.284496736 + Float64(1.421413741 / fma(0.3275911, x_m, 1.0)))) / fma(0.3275911, x_m, 1.0)))), Float64((exp(x_m) ^ Float64(-x_m)) / Float64(1.0 + Float64(0.3275911 * abs(x_m)))), 1.0); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[Power[N[(0.3275911 * x$95$m + 1.0), $MachinePrecision], 3.0], $MachinePrecision]}, If[LessEqual[N[Abs[x$95$m], $MachinePrecision], 1e-17], N[(1e-9 + N[(x$95$m * 0.3275910996724089), $MachinePrecision]), $MachinePrecision], N[(N[(-0.254829592 + N[(N[(1.453152027 / t$95$0), $MachinePrecision] - N[(N[(N[(1.061405429 / t$95$0), $MachinePrecision] + N[(-0.284496736 + N[(1.421413741 / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Power[N[Exp[x$95$m], $MachinePrecision], (-x$95$m)], $MachinePrecision] / N[(1.0 + N[(0.3275911 * N[Abs[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := {\left(\mathsf{fma}\left(0.3275911, x\_m, 1\right)\right)}^{3}\\
\mathbf{if}\;\left|x\_m\right| \leq 10^{-17}:\\
\;\;\;\;10^{-9} + x\_m \cdot 0.3275910996724089\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.254829592 + \left(\frac{1.453152027}{t\_0} - \frac{\frac{1.061405429}{t\_0} + \left(-0.284496736 + \frac{1.421413741}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}\right)}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}\right), \frac{{\left(e^{x\_m}\right)}^{\left(-x\_m\right)}}{1 + 0.3275911 \cdot \left|x\_m\right|}, 1\right)\\
\end{array}
\end{array}
if (fabs.f64 x) < 1.00000000000000007e-17Initial program 57.8%
Simplified57.8%
Applied egg-rr57.8%
distribute-lft-in57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in x around 0 57.8%
pow157.8%
Applied egg-rr57.8%
unpow157.8%
unpow157.8%
sqr-pow26.8%
fabs-sqr26.8%
sqr-pow57.8%
unpow157.8%
Simplified57.8%
Taylor expanded in x around 0 99.5%
*-commutative99.5%
Simplified99.5%
if 1.00000000000000007e-17 < (fabs.f64 x) Initial program 97.1%
Simplified97.1%
Taylor expanded in x around 0 97.1%
associate--r+97.1%
div-sub97.2%
Simplified94.2%
fma-udef94.2%
Applied egg-rr94.2%
Final simplification96.8%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(if (<= (fabs x_m) 1e-17)
(+ 1e-9 (* x_m 0.3275910996724089))
(exp
(log1p
(/
(/
(-
-0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0))
(exp (pow x_m 2.0)))))))x_m = fabs(x);
double code(double x_m) {
double tmp;
if (fabs(x_m) <= 1e-17) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else {
tmp = exp(log1p((((-0.254829592 - ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0)) / exp(pow(x_m, 2.0)))));
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (abs(x_m) <= 1e-17) tmp = Float64(1e-9 + Float64(x_m * 0.3275910996724089)); else tmp = exp(log1p(Float64(Float64(Float64(-0.254829592 - Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0)) / exp((x_m ^ 2.0))))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[Abs[x$95$m], $MachinePrecision], 1e-17], N[(1e-9 + N[(x$95$m * 0.3275910996724089), $MachinePrecision]), $MachinePrecision], N[Exp[N[Log[1 + N[(N[(N[(-0.254829592 - N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision] / N[Exp[N[Power[x$95$m, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;\left|x\_m\right| \leq 10^{-17}:\\
\;\;\;\;10^{-9} + x\_m \cdot 0.3275910996724089\\
\mathbf{else}:\\
\;\;\;\;e^{\mathsf{log1p}\left(\frac{\frac{-0.254829592 - \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{e^{{x\_m}^{2}}}\right)}\\
\end{array}
\end{array}
if (fabs.f64 x) < 1.00000000000000007e-17Initial program 57.8%
Simplified57.8%
Applied egg-rr57.8%
distribute-lft-in57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in x around 0 57.8%
pow157.8%
Applied egg-rr57.8%
unpow157.8%
unpow157.8%
sqr-pow26.8%
fabs-sqr26.8%
sqr-pow57.8%
unpow157.8%
Simplified57.8%
Taylor expanded in x around 0 99.5%
*-commutative99.5%
Simplified99.5%
if 1.00000000000000007e-17 < (fabs.f64 x) Initial program 97.1%
Simplified97.1%
associate-/l/97.2%
add-exp-log97.2%
sub-neg97.2%
log1p-def97.2%
Applied egg-rr97.2%
Simplified94.2%
Final simplification96.8%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(if (<= (fabs x_m) 1e-17)
(+ 1e-9 (* x_m 0.3275910996724089))
(-
1.0
(/
(+
0.254829592
(/
(+
-0.284496736
(/
(+
1.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(fma 0.3275911 x_m 1.0)))
(* (fma 0.3275911 x_m 1.0) (exp (pow x_m 2.0)))))))x_m = fabs(x);
double code(double x_m) {
double tmp;
if (fabs(x_m) <= 1e-17) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else {
tmp = 1.0 - ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / (fma(0.3275911, x_m, 1.0) * exp(pow(x_m, 2.0))));
}
return tmp;
}
x_m = abs(x) function code(x_m) tmp = 0.0 if (abs(x_m) <= 1e-17) tmp = Float64(1e-9 + Float64(x_m * 0.3275910996724089)); else tmp = 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_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / fma(0.3275911, x_m, 1.0))) / Float64(fma(0.3275911, x_m, 1.0) * exp((x_m ^ 2.0))))); end return tmp end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[Abs[x$95$m], $MachinePrecision], 1e-17], N[(1e-9 + N[(x$95$m * 0.3275910996724089), $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$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.3275911 * x$95$m + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.3275911 * x$95$m + 1.0), $MachinePrecision] * N[Exp[N[Power[x$95$m, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;\left|x\_m\right| \leq 10^{-17}:\\
\;\;\;\;10^{-9} + x\_m \cdot 0.3275910996724089\\
\mathbf{else}:\\
\;\;\;\;1 - \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right)}}{\mathsf{fma}\left(0.3275911, x\_m, 1\right) \cdot e^{{x\_m}^{2}}}\\
\end{array}
\end{array}
if (fabs.f64 x) < 1.00000000000000007e-17Initial program 57.8%
Simplified57.8%
Applied egg-rr57.8%
distribute-lft-in57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in x around 0 57.8%
pow157.8%
Applied egg-rr57.8%
unpow157.8%
unpow157.8%
sqr-pow26.8%
fabs-sqr26.8%
sqr-pow57.8%
unpow157.8%
Simplified57.8%
Taylor expanded in x around 0 99.5%
*-commutative99.5%
Simplified99.5%
if 1.00000000000000007e-17 < (fabs.f64 x) Initial program 97.1%
Simplified97.1%
Applied egg-rr97.1%
Simplified94.3%
Final simplification96.8%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x_m)))))
(if (<= (fabs x_m) 1e-17)
(+ 1e-9 (* x_m 0.3275910996724089))
(if (<= (fabs x_m) 0.2)
(+
(+
1.0
(+
(* 0.36953108532122814 (/ (pow x_m 2.0) t_0))
(* 0.8007952583978091 (/ x_m t_0))))
(* 0.999999999 (/ -1.0 t_0)))
1.0))))x_m = fabs(x);
double code(double x_m) {
double t_0 = 1.0 + (0.3275911 * fabs(x_m));
double tmp;
if (fabs(x_m) <= 1e-17) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else if (fabs(x_m) <= 0.2) {
tmp = (1.0 + ((0.36953108532122814 * (pow(x_m, 2.0) / t_0)) + (0.8007952583978091 * (x_m / t_0)))) + (0.999999999 * (-1.0 / t_0));
} else {
tmp = 1.0;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (0.3275911d0 * abs(x_m))
if (abs(x_m) <= 1d-17) then
tmp = 1d-9 + (x_m * 0.3275910996724089d0)
else if (abs(x_m) <= 0.2d0) then
tmp = (1.0d0 + ((0.36953108532122814d0 * ((x_m ** 2.0d0) / t_0)) + (0.8007952583978091d0 * (x_m / t_0)))) + (0.999999999d0 * ((-1.0d0) / t_0))
else
tmp = 1.0d0
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m) {
double t_0 = 1.0 + (0.3275911 * Math.abs(x_m));
double tmp;
if (Math.abs(x_m) <= 1e-17) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else if (Math.abs(x_m) <= 0.2) {
tmp = (1.0 + ((0.36953108532122814 * (Math.pow(x_m, 2.0) / t_0)) + (0.8007952583978091 * (x_m / t_0)))) + (0.999999999 * (-1.0 / t_0));
} else {
tmp = 1.0;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m): t_0 = 1.0 + (0.3275911 * math.fabs(x_m)) tmp = 0 if math.fabs(x_m) <= 1e-17: tmp = 1e-9 + (x_m * 0.3275910996724089) elif math.fabs(x_m) <= 0.2: tmp = (1.0 + ((0.36953108532122814 * (math.pow(x_m, 2.0) / t_0)) + (0.8007952583978091 * (x_m / t_0)))) + (0.999999999 * (-1.0 / t_0)) else: tmp = 1.0 return tmp
x_m = abs(x) function code(x_m) t_0 = Float64(1.0 + Float64(0.3275911 * abs(x_m))) tmp = 0.0 if (abs(x_m) <= 1e-17) tmp = Float64(1e-9 + Float64(x_m * 0.3275910996724089)); elseif (abs(x_m) <= 0.2) tmp = Float64(Float64(1.0 + Float64(Float64(0.36953108532122814 * Float64((x_m ^ 2.0) / t_0)) + Float64(0.8007952583978091 * Float64(x_m / t_0)))) + Float64(0.999999999 * Float64(-1.0 / t_0))); else tmp = 1.0; end return tmp end
x_m = abs(x); function tmp_2 = code(x_m) t_0 = 1.0 + (0.3275911 * abs(x_m)); tmp = 0.0; if (abs(x_m) <= 1e-17) tmp = 1e-9 + (x_m * 0.3275910996724089); elseif (abs(x_m) <= 0.2) tmp = (1.0 + ((0.36953108532122814 * ((x_m ^ 2.0) / t_0)) + (0.8007952583978091 * (x_m / t_0)))) + (0.999999999 * (-1.0 / t_0)); else tmp = 1.0; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[x$95$m], $MachinePrecision], 1e-17], N[(1e-9 + N[(x$95$m * 0.3275910996724089), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[x$95$m], $MachinePrecision], 0.2], N[(N[(1.0 + N[(N[(0.36953108532122814 * N[(N[Power[x$95$m, 2.0], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] + N[(0.8007952583978091 * N[(x$95$m / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.999999999 * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\_m\right|\\
\mathbf{if}\;\left|x\_m\right| \leq 10^{-17}:\\
\;\;\;\;10^{-9} + x\_m \cdot 0.3275910996724089\\
\mathbf{elif}\;\left|x\_m\right| \leq 0.2:\\
\;\;\;\;\left(1 + \left(0.36953108532122814 \cdot \frac{{x\_m}^{2}}{t\_0} + 0.8007952583978091 \cdot \frac{x\_m}{t\_0}\right)\right) + 0.999999999 \cdot \frac{-1}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (fabs.f64 x) < 1.00000000000000007e-17Initial program 57.8%
Simplified57.8%
Applied egg-rr57.8%
distribute-lft-in57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in x around 0 57.8%
pow157.8%
Applied egg-rr57.8%
unpow157.8%
unpow157.8%
sqr-pow26.8%
fabs-sqr26.8%
sqr-pow57.8%
unpow157.8%
Simplified57.8%
Taylor expanded in x around 0 99.5%
*-commutative99.5%
Simplified99.5%
if 1.00000000000000007e-17 < (fabs.f64 x) < 0.20000000000000001Initial program 67.6%
Simplified68.0%
Applied egg-rr68.3%
distribute-lft-in67.8%
associate-*l/68.0%
*-lft-identity68.0%
Simplified36.3%
Taylor expanded in x around 0 35.5%
if 0.20000000000000001 < (fabs.f64 x) Initial program 100.0%
Simplified100.0%
Applied egg-rr100.0%
distribute-lft-in100.0%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 99.1%
pow199.1%
Applied egg-rr99.1%
unpow199.1%
unpow199.1%
sqr-pow52.8%
fabs-sqr52.8%
sqr-pow99.2%
unpow199.2%
Simplified99.2%
Taylor expanded in x around inf 100.0%
Final simplification96.7%
x_m = (fabs.f64 x)
(FPCore (x_m)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.3275911 x_m)))
(t_1 (/ 1.0 (+ 1.0 (* 0.3275911 (fabs x_m))))))
(if (<= (fabs x_m) 1e-17)
(+ 1e-9 (* x_m 0.3275910996724089))
(-
1.0
(*
(*
t_1
(+
0.254829592
(*
t_1
(+
-0.284496736
(*
t_1
(+
1.421413741
(* (/ 1.0 t_0) (+ -1.453152027 (/ 1.061405429 t_0)))))))))
(exp (- (* x_m x_m))))))))x_m = fabs(x);
double code(double x_m) {
double t_0 = 1.0 + (0.3275911 * x_m);
double t_1 = 1.0 / (1.0 + (0.3275911 * fabs(x_m)));
double tmp;
if (fabs(x_m) <= 1e-17) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else {
tmp = 1.0 - ((t_1 * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + ((1.0 / t_0) * (-1.453152027 + (1.061405429 / t_0))))))))) * exp(-(x_m * x_m)));
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (0.3275911d0 * x_m)
t_1 = 1.0d0 / (1.0d0 + (0.3275911d0 * abs(x_m)))
if (abs(x_m) <= 1d-17) then
tmp = 1d-9 + (x_m * 0.3275910996724089d0)
else
tmp = 1.0d0 - ((t_1 * (0.254829592d0 + (t_1 * ((-0.284496736d0) + (t_1 * (1.421413741d0 + ((1.0d0 / t_0) * ((-1.453152027d0) + (1.061405429d0 / t_0))))))))) * exp(-(x_m * x_m)))
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m) {
double t_0 = 1.0 + (0.3275911 * x_m);
double t_1 = 1.0 / (1.0 + (0.3275911 * Math.abs(x_m)));
double tmp;
if (Math.abs(x_m) <= 1e-17) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else {
tmp = 1.0 - ((t_1 * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + ((1.0 / t_0) * (-1.453152027 + (1.061405429 / t_0))))))))) * Math.exp(-(x_m * x_m)));
}
return tmp;
}
x_m = math.fabs(x) def code(x_m): t_0 = 1.0 + (0.3275911 * x_m) t_1 = 1.0 / (1.0 + (0.3275911 * math.fabs(x_m))) tmp = 0 if math.fabs(x_m) <= 1e-17: tmp = 1e-9 + (x_m * 0.3275910996724089) else: tmp = 1.0 - ((t_1 * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + ((1.0 / t_0) * (-1.453152027 + (1.061405429 / t_0))))))))) * math.exp(-(x_m * x_m))) return tmp
x_m = abs(x) function code(x_m) t_0 = Float64(1.0 + Float64(0.3275911 * x_m)) t_1 = Float64(1.0 / Float64(1.0 + Float64(0.3275911 * abs(x_m)))) tmp = 0.0 if (abs(x_m) <= 1e-17) tmp = Float64(1e-9 + Float64(x_m * 0.3275910996724089)); else tmp = Float64(1.0 - Float64(Float64(t_1 * Float64(0.254829592 + Float64(t_1 * Float64(-0.284496736 + Float64(t_1 * Float64(1.421413741 + Float64(Float64(1.0 / t_0) * Float64(-1.453152027 + Float64(1.061405429 / t_0))))))))) * exp(Float64(-Float64(x_m * x_m))))); end return tmp end
x_m = abs(x); function tmp_2 = code(x_m) t_0 = 1.0 + (0.3275911 * x_m); t_1 = 1.0 / (1.0 + (0.3275911 * abs(x_m))); tmp = 0.0; if (abs(x_m) <= 1e-17) tmp = 1e-9 + (x_m * 0.3275910996724089); else tmp = 1.0 - ((t_1 * (0.254829592 + (t_1 * (-0.284496736 + (t_1 * (1.421413741 + ((1.0 / t_0) * (-1.453152027 + (1.061405429 / t_0))))))))) * exp(-(x_m * x_m))); end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * x$95$m), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / N[(1.0 + N[(0.3275911 * N[Abs[x$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[x$95$m], $MachinePrecision], 1e-17], N[(1e-9 + N[(x$95$m * 0.3275910996724089), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(t$95$1 * N[(0.254829592 + N[(t$95$1 * N[(-0.284496736 + N[(t$95$1 * N[(1.421413741 + N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[(-N[(x$95$m * x$95$m), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot x\_m\\
t_1 := \frac{1}{1 + 0.3275911 \cdot \left|x\_m\right|}\\
\mathbf{if}\;\left|x\_m\right| \leq 10^{-17}:\\
\;\;\;\;10^{-9} + x\_m \cdot 0.3275910996724089\\
\mathbf{else}:\\
\;\;\;\;1 - \left(t\_1 \cdot \left(0.254829592 + t\_1 \cdot \left(-0.284496736 + t\_1 \cdot \left(1.421413741 + \frac{1}{t\_0} \cdot \left(-1.453152027 + \frac{1.061405429}{t\_0}\right)\right)\right)\right)\right) \cdot e^{-x\_m \cdot x\_m}\\
\end{array}
\end{array}
if (fabs.f64 x) < 1.00000000000000007e-17Initial program 57.8%
Simplified57.8%
Applied egg-rr57.8%
distribute-lft-in57.8%
associate-*l/57.8%
*-lft-identity57.8%
Simplified57.8%
Taylor expanded in x around 0 57.8%
pow157.8%
Applied egg-rr57.8%
unpow157.8%
unpow157.8%
sqr-pow26.8%
fabs-sqr26.8%
sqr-pow57.8%
unpow157.8%
Simplified57.8%
Taylor expanded in x around 0 99.5%
*-commutative99.5%
Simplified99.5%
if 1.00000000000000007e-17 < (fabs.f64 x) Initial program 97.1%
Simplified97.1%
pow192.2%
Applied egg-rr97.1%
unpow192.2%
unpow192.2%
sqr-pow48.7%
fabs-sqr48.7%
sqr-pow91.7%
unpow191.7%
Simplified94.8%
pow192.2%
Applied egg-rr94.8%
unpow192.2%
unpow192.2%
sqr-pow48.7%
fabs-sqr48.7%
sqr-pow91.7%
unpow191.7%
Simplified94.8%
Final simplification97.1%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= (fabs x_m) 0.2) (+ 1e-9 (* x_m 0.3275910996724089)) 1.0))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if (fabs(x_m) <= 0.2) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else {
tmp = 1.0;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
real(8) :: tmp
if (abs(x_m) <= 0.2d0) then
tmp = 1d-9 + (x_m * 0.3275910996724089d0)
else
tmp = 1.0d0
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m) {
double tmp;
if (Math.abs(x_m) <= 0.2) {
tmp = 1e-9 + (x_m * 0.3275910996724089);
} else {
tmp = 1.0;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m): tmp = 0 if math.fabs(x_m) <= 0.2: tmp = 1e-9 + (x_m * 0.3275910996724089) else: tmp = 1.0 return tmp
x_m = abs(x) function code(x_m) tmp = 0.0 if (abs(x_m) <= 0.2) tmp = Float64(1e-9 + Float64(x_m * 0.3275910996724089)); else tmp = 1.0; end return tmp end
x_m = abs(x); function tmp_2 = code(x_m) tmp = 0.0; if (abs(x_m) <= 0.2) tmp = 1e-9 + (x_m * 0.3275910996724089); else tmp = 1.0; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[N[Abs[x$95$m], $MachinePrecision], 0.2], N[(1e-9 + N[(x$95$m * 0.3275910996724089), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;\left|x\_m\right| \leq 0.2:\\
\;\;\;\;10^{-9} + x\_m \cdot 0.3275910996724089\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (fabs.f64 x) < 0.20000000000000001Initial program 58.6%
Simplified58.7%
Applied egg-rr58.7%
distribute-lft-in58.7%
associate-*l/58.7%
*-lft-identity58.7%
Simplified55.9%
Taylor expanded in x around 0 54.6%
pow154.6%
Applied egg-rr54.6%
unpow154.6%
unpow154.6%
sqr-pow25.1%
fabs-sqr25.1%
sqr-pow54.1%
unpow154.1%
Simplified54.1%
Taylor expanded in x around 0 92.1%
*-commutative92.1%
Simplified92.1%
if 0.20000000000000001 < (fabs.f64 x) Initial program 100.0%
Simplified100.0%
Applied egg-rr100.0%
distribute-lft-in100.0%
associate-*l/100.0%
*-lft-identity100.0%
Simplified100.0%
Taylor expanded in x around 0 99.1%
pow199.1%
Applied egg-rr99.1%
unpow199.1%
unpow199.1%
sqr-pow52.8%
fabs-sqr52.8%
sqr-pow99.2%
unpow199.2%
Simplified99.2%
Taylor expanded in x around inf 100.0%
Final simplification95.8%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 (if (<= x_m 2.8e-5) 1e-9 1.0))
x_m = fabs(x);
double code(double x_m) {
double tmp;
if (x_m <= 2.8e-5) {
tmp = 1e-9;
} else {
tmp = 1.0;
}
return tmp;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
real(8) :: tmp
if (x_m <= 2.8d-5) then
tmp = 1d-9
else
tmp = 1.0d0
end if
code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m) {
double tmp;
if (x_m <= 2.8e-5) {
tmp = 1e-9;
} else {
tmp = 1.0;
}
return tmp;
}
x_m = math.fabs(x) def code(x_m): tmp = 0 if x_m <= 2.8e-5: tmp = 1e-9 else: tmp = 1.0 return tmp
x_m = abs(x) function code(x_m) tmp = 0.0 if (x_m <= 2.8e-5) tmp = 1e-9; else tmp = 1.0; end return tmp end
x_m = abs(x); function tmp_2 = code(x_m) tmp = 0.0; if (x_m <= 2.8e-5) tmp = 1e-9; else tmp = 1.0; end tmp_2 = tmp; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := If[LessEqual[x$95$m, 2.8e-5], 1e-9, 1.0]
\begin{array}{l}
x_m = \left|x\right|
\\
\begin{array}{l}
\mathbf{if}\;x\_m \leq 2.8 \cdot 10^{-5}:\\
\;\;\;\;10^{-9}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 2.79999999999999996e-5Initial program 70.9%
Simplified70.9%
Applied egg-rr70.9%
distribute-lft-in70.9%
associate-*l/70.9%
*-lft-identity70.9%
Simplified68.9%
Taylor expanded in x around 0 67.8%
pow167.8%
Applied egg-rr67.8%
unpow167.8%
unpow167.8%
sqr-pow17.6%
fabs-sqr17.6%
sqr-pow67.5%
unpow167.5%
Simplified67.5%
Taylor expanded in x around 0 68.5%
if 2.79999999999999996e-5 < x Initial program 99.7%
Simplified99.7%
Applied egg-rr99.7%
distribute-lft-in99.7%
associate-*l/99.7%
*-lft-identity99.7%
Simplified99.7%
Taylor expanded in x around 0 98.6%
pow198.6%
Applied egg-rr98.6%
unpow198.6%
unpow198.6%
sqr-pow98.6%
fabs-sqr98.6%
sqr-pow98.6%
unpow198.6%
Simplified98.6%
Taylor expanded in x around inf 98.7%
Final simplification76.2%
x_m = (fabs.f64 x) (FPCore (x_m) :precision binary64 1e-9)
x_m = fabs(x);
double code(double x_m) {
return 1e-9;
}
x_m = abs(x)
real(8) function code(x_m)
real(8), intent (in) :: x_m
code = 1d-9
end function
x_m = Math.abs(x);
public static double code(double x_m) {
return 1e-9;
}
x_m = math.fabs(x) def code(x_m): return 1e-9
x_m = abs(x) function code(x_m) return 1e-9 end
x_m = abs(x); function tmp = code(x_m) tmp = 1e-9; end
x_m = N[Abs[x], $MachinePrecision] code[x$95$m_] := 1e-9
\begin{array}{l}
x_m = \left|x\right|
\\
10^{-9}
\end{array}
Initial program 78.2%
Simplified78.2%
Applied egg-rr78.2%
distribute-lft-in78.2%
associate-*l/78.2%
*-lft-identity78.2%
Simplified76.7%
Taylor expanded in x around 0 75.6%
pow175.6%
Applied egg-rr75.6%
unpow175.6%
unpow175.6%
sqr-pow38.2%
fabs-sqr38.2%
sqr-pow75.4%
unpow175.4%
Simplified75.4%
Taylor expanded in x around 0 53.9%
Final simplification53.9%
herbie shell --seed 2024029
(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)))))))