
(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 10 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 (* 0.3275911 (fabs x)))
(t_1 (+ 1.0 t_0))
(t_2 (/ 1.0 t_1))
(t_3 (- -1.0 t_0)))
(if (<=
(+
1.0
(*
(exp (* x (- x)))
(*
(+
0.254829592
(*
t_2
(+
-0.284496736
(*
t_2
(+ 1.421413741 (* t_2 (+ -1.453152027 (* t_2 1.061405429))))))))
(/ 1.0 t_3))))
1e-9)
(+ 1e-9 (* x 1.128386358070218))
(+
1.0
(*
(exp (- (pow x 2.0)))
(/
(+
0.254829592
(-
(+ (/ 1.061405429 (pow t_1 4.0)) (/ 1.421413741 (pow t_1 2.0)))
(+ (/ 0.284496736 t_1) (/ 1.453152027 (pow t_1 3.0)))))
t_3))))))
double code(double x) {
double t_0 = 0.3275911 * fabs(x);
double t_1 = 1.0 + t_0;
double t_2 = 1.0 / t_1;
double t_3 = -1.0 - t_0;
double tmp;
if ((1.0 + (exp((x * -x)) * ((0.254829592 + (t_2 * (-0.284496736 + (t_2 * (1.421413741 + (t_2 * (-1.453152027 + (t_2 * 1.061405429)))))))) * (1.0 / t_3)))) <= 1e-9) {
tmp = 1e-9 + (x * 1.128386358070218);
} else {
tmp = 1.0 + (exp(-pow(x, 2.0)) * ((0.254829592 + (((1.061405429 / pow(t_1, 4.0)) + (1.421413741 / pow(t_1, 2.0))) - ((0.284496736 / t_1) + (1.453152027 / pow(t_1, 3.0))))) / t_3));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = 0.3275911d0 * abs(x)
t_1 = 1.0d0 + t_0
t_2 = 1.0d0 / t_1
t_3 = (-1.0d0) - t_0
if ((1.0d0 + (exp((x * -x)) * ((0.254829592d0 + (t_2 * ((-0.284496736d0) + (t_2 * (1.421413741d0 + (t_2 * ((-1.453152027d0) + (t_2 * 1.061405429d0)))))))) * (1.0d0 / t_3)))) <= 1d-9) then
tmp = 1d-9 + (x * 1.128386358070218d0)
else
tmp = 1.0d0 + (exp(-(x ** 2.0d0)) * ((0.254829592d0 + (((1.061405429d0 / (t_1 ** 4.0d0)) + (1.421413741d0 / (t_1 ** 2.0d0))) - ((0.284496736d0 / t_1) + (1.453152027d0 / (t_1 ** 3.0d0))))) / t_3))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = 0.3275911 * Math.abs(x);
double t_1 = 1.0 + t_0;
double t_2 = 1.0 / t_1;
double t_3 = -1.0 - t_0;
double tmp;
if ((1.0 + (Math.exp((x * -x)) * ((0.254829592 + (t_2 * (-0.284496736 + (t_2 * (1.421413741 + (t_2 * (-1.453152027 + (t_2 * 1.061405429)))))))) * (1.0 / t_3)))) <= 1e-9) {
tmp = 1e-9 + (x * 1.128386358070218);
} else {
tmp = 1.0 + (Math.exp(-Math.pow(x, 2.0)) * ((0.254829592 + (((1.061405429 / Math.pow(t_1, 4.0)) + (1.421413741 / Math.pow(t_1, 2.0))) - ((0.284496736 / t_1) + (1.453152027 / Math.pow(t_1, 3.0))))) / t_3));
}
return tmp;
}
def code(x): t_0 = 0.3275911 * math.fabs(x) t_1 = 1.0 + t_0 t_2 = 1.0 / t_1 t_3 = -1.0 - t_0 tmp = 0 if (1.0 + (math.exp((x * -x)) * ((0.254829592 + (t_2 * (-0.284496736 + (t_2 * (1.421413741 + (t_2 * (-1.453152027 + (t_2 * 1.061405429)))))))) * (1.0 / t_3)))) <= 1e-9: tmp = 1e-9 + (x * 1.128386358070218) else: tmp = 1.0 + (math.exp(-math.pow(x, 2.0)) * ((0.254829592 + (((1.061405429 / math.pow(t_1, 4.0)) + (1.421413741 / math.pow(t_1, 2.0))) - ((0.284496736 / t_1) + (1.453152027 / math.pow(t_1, 3.0))))) / t_3)) return tmp
function code(x) t_0 = Float64(0.3275911 * abs(x)) t_1 = Float64(1.0 + t_0) t_2 = Float64(1.0 / t_1) t_3 = Float64(-1.0 - t_0) tmp = 0.0 if (Float64(1.0 + Float64(exp(Float64(x * Float64(-x))) * Float64(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)))))))) * Float64(1.0 / t_3)))) <= 1e-9) tmp = Float64(1e-9 + Float64(x * 1.128386358070218)); else tmp = Float64(1.0 + Float64(exp(Float64(-(x ^ 2.0))) * Float64(Float64(0.254829592 + Float64(Float64(Float64(1.061405429 / (t_1 ^ 4.0)) + Float64(1.421413741 / (t_1 ^ 2.0))) - Float64(Float64(0.284496736 / t_1) + Float64(1.453152027 / (t_1 ^ 3.0))))) / t_3))); end return tmp end
function tmp_2 = code(x) t_0 = 0.3275911 * abs(x); t_1 = 1.0 + t_0; t_2 = 1.0 / t_1; t_3 = -1.0 - t_0; tmp = 0.0; if ((1.0 + (exp((x * -x)) * ((0.254829592 + (t_2 * (-0.284496736 + (t_2 * (1.421413741 + (t_2 * (-1.453152027 + (t_2 * 1.061405429)))))))) * (1.0 / t_3)))) <= 1e-9) tmp = 1e-9 + (x * 1.128386358070218); else tmp = 1.0 + (exp(-(x ^ 2.0)) * ((0.254829592 + (((1.061405429 / (t_1 ^ 4.0)) + (1.421413741 / (t_1 ^ 2.0))) - ((0.284496736 / t_1) + (1.453152027 / (t_1 ^ 3.0))))) / t_3)); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(-1.0 - t$95$0), $MachinePrecision]}, If[LessEqual[N[(1.0 + N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * 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[(t$95$2 * 1.061405429), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-9], N[(1e-9 + N[(x * 1.128386358070218), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[Exp[(-N[Power[x, 2.0], $MachinePrecision])], $MachinePrecision] * N[(N[(0.254829592 + N[(N[(N[(1.061405429 / N[Power[t$95$1, 4.0], $MachinePrecision]), $MachinePrecision] + N[(1.421413741 / N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.284496736 / t$95$1), $MachinePrecision] + N[(1.453152027 / N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.3275911 \cdot \left|x\right|\\
t_1 := 1 + t\_0\\
t_2 := \frac{1}{t\_1}\\
t_3 := -1 - t\_0\\
\mathbf{if}\;1 + e^{x \cdot \left(-x\right)} \cdot \left(\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) \cdot \frac{1}{t\_3}\right) \leq 10^{-9}:\\
\;\;\;\;10^{-9} + x \cdot 1.128386358070218\\
\mathbf{else}:\\
\;\;\;\;1 + e^{-{x}^{2}} \cdot \frac{0.254829592 + \left(\left(\frac{1.061405429}{{t\_1}^{4}} + \frac{1.421413741}{{t\_1}^{2}}\right) - \left(\frac{0.284496736}{t\_1} + \frac{1.453152027}{{t\_1}^{3}}\right)\right)}{t\_3}\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal 31853699/125000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal -8890523/31250000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal 1421413741/1000000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal -1453152027/1000000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) #s(literal 1061405429/1000000000 binary64)))))))))) (exp.f64 (neg.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)))))) < 1.00000000000000006e-9Initial program 57.8%
Simplified57.8%
Applied egg-rr57.8%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 1.00000000000000006e-9 < (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal 31853699/125000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal -8890523/31250000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal 1421413741/1000000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal -1453152027/1000000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) #s(literal 1061405429/1000000000 binary64)))))))))) (exp.f64 (neg.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)))))) Initial program 99.6%
Simplified99.6%
Taylor expanded in x around inf 99.7%
associate-/l*99.7%
Simplified99.7%
Final simplification99.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (* 0.3275911 (fabs x)))
(t_1 (exp (* x (- x))))
(t_2 (/ 1.0 (+ 1.0 t_0))))
(if (<=
(+
1.0
(*
t_1
(*
(+
0.254829592
(*
t_2
(+
-0.284496736
(*
t_2
(+ 1.421413741 (* t_2 (+ -1.453152027 (* t_2 1.061405429))))))))
(/ 1.0 (- -1.0 t_0)))))
1e-9)
(+ 1e-9 (* x 1.128386358070218))
(-
1.0
(*
(*
t_2
(+
0.254829592
(*
t_2
(+
-0.284496736
(*
t_2
(+
-1.0
(+
2.421413741
(/
(+ -1.453152027 (/ 1.061405429 (fma 0.3275911 x 1.0)))
(fma 0.3275911 x 1.0)))))))))
t_1)))))
double code(double x) {
double t_0 = 0.3275911 * fabs(x);
double t_1 = exp((x * -x));
double t_2 = 1.0 / (1.0 + t_0);
double tmp;
if ((1.0 + (t_1 * ((0.254829592 + (t_2 * (-0.284496736 + (t_2 * (1.421413741 + (t_2 * (-1.453152027 + (t_2 * 1.061405429)))))))) * (1.0 / (-1.0 - t_0))))) <= 1e-9) {
tmp = 1e-9 + (x * 1.128386358070218);
} else {
tmp = 1.0 - ((t_2 * (0.254829592 + (t_2 * (-0.284496736 + (t_2 * (-1.0 + (2.421413741 + ((-1.453152027 + (1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))))))))) * t_1);
}
return tmp;
}
function code(x) t_0 = Float64(0.3275911 * abs(x)) t_1 = exp(Float64(x * Float64(-x))) t_2 = Float64(1.0 / Float64(1.0 + t_0)) tmp = 0.0 if (Float64(1.0 + Float64(t_1 * Float64(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)))))))) * Float64(1.0 / Float64(-1.0 - t_0))))) <= 1e-9) tmp = Float64(1e-9 + Float64(x * 1.128386358070218)); else tmp = Float64(1.0 - Float64(Float64(t_2 * Float64(0.254829592 + Float64(t_2 * Float64(-0.284496736 + Float64(t_2 * Float64(-1.0 + Float64(2.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / fma(0.3275911, x, 1.0))) / fma(0.3275911, x, 1.0))))))))) * t_1)); end return tmp end
code[x_] := Block[{t$95$0 = N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(1.0 / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(1.0 + N[(t$95$1 * 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[(t$95$2 * 1.061405429), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1e-9], N[(1e-9 + N[(x * 1.128386358070218), $MachinePrecision]), $MachinePrecision], N[(1.0 - N[(N[(t$95$2 * N[(0.254829592 + N[(t$95$2 * N[(-0.284496736 + N[(t$95$2 * N[(-1.0 + N[(2.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]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.3275911 \cdot \left|x\right|\\
t_1 := e^{x \cdot \left(-x\right)}\\
t_2 := \frac{1}{1 + t\_0}\\
\mathbf{if}\;1 + t\_1 \cdot \left(\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) \cdot \frac{1}{-1 - t\_0}\right) \leq 10^{-9}:\\
\;\;\;\;10^{-9} + x \cdot 1.128386358070218\\
\mathbf{else}:\\
\;\;\;\;1 - \left(t\_2 \cdot \left(0.254829592 + t\_2 \cdot \left(-0.284496736 + t\_2 \cdot \left(-1 + \left(2.421413741 + \frac{-1.453152027 + \frac{1.061405429}{\mathsf{fma}\left(0.3275911, x, 1\right)}}{\mathsf{fma}\left(0.3275911, x, 1\right)}\right)\right)\right)\right)\right) \cdot t\_1\\
\end{array}
\end{array}
if (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal 31853699/125000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal -8890523/31250000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal 1421413741/1000000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal -1453152027/1000000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) #s(literal 1061405429/1000000000 binary64)))))))))) (exp.f64 (neg.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)))))) < 1.00000000000000006e-9Initial program 57.8%
Simplified57.8%
Applied egg-rr57.8%
Taylor expanded in x around 0 100.0%
*-commutative100.0%
Simplified100.0%
if 1.00000000000000006e-9 < (-.f64 #s(literal 1 binary64) (*.f64 (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal 31853699/125000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal -8890523/31250000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal 1421413741/1000000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) (+.f64 #s(literal -1453152027/1000000000 binary64) (*.f64 (/.f64 #s(literal 1 binary64) (+.f64 #s(literal 1 binary64) (*.f64 #s(literal 3275911/10000000 binary64) (fabs.f64 x)))) #s(literal 1061405429/1000000000 binary64)))))))))) (exp.f64 (neg.f64 (*.f64 (fabs.f64 x) (fabs.f64 x)))))) Initial program 99.6%
Simplified99.6%
expm1-log1p-u99.6%
expm1-undefine99.6%
Applied egg-rr99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
log1p-undefine99.6%
rem-exp-log99.6%
associate-+r+99.6%
metadata-eval99.7%
Simplified99.7%
Final simplification99.8%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.3275911 x))) (t_1 (/ 1.0 t_0)))
(if (<= x 6e-26)
1e-9
(+
1.0
(*
(exp (* x (- x)))
(*
t_1
(-
(*
(+
-0.284496736
(*
t_1
(+ 1.421413741 (* t_1 (+ -1.453152027 (/ 1.061405429 t_0))))))
(/ -1.0 t_0))
0.254829592)))))))
double code(double x) {
double t_0 = 1.0 + (0.3275911 * x);
double t_1 = 1.0 / t_0;
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0 + (exp((x * -x)) * (t_1 * (((-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0)))))) * (-1.0 / t_0)) - 0.254829592)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (0.3275911d0 * x)
t_1 = 1.0d0 / t_0
if (x <= 6d-26) then
tmp = 1d-9
else
tmp = 1.0d0 + (exp((x * -x)) * (t_1 * ((((-0.284496736d0) + (t_1 * (1.421413741d0 + (t_1 * ((-1.453152027d0) + (1.061405429d0 / t_0)))))) * ((-1.0d0) / t_0)) - 0.254829592d0)))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = 1.0 + (0.3275911 * x);
double t_1 = 1.0 / t_0;
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0 + (Math.exp((x * -x)) * (t_1 * (((-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0)))))) * (-1.0 / t_0)) - 0.254829592)));
}
return tmp;
}
def code(x): t_0 = 1.0 + (0.3275911 * x) t_1 = 1.0 / t_0 tmp = 0 if x <= 6e-26: tmp = 1e-9 else: tmp = 1.0 + (math.exp((x * -x)) * (t_1 * (((-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0)))))) * (-1.0 / t_0)) - 0.254829592))) return tmp
function code(x) t_0 = Float64(1.0 + Float64(0.3275911 * x)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (x <= 6e-26) tmp = 1e-9; else tmp = Float64(1.0 + Float64(exp(Float64(x * Float64(-x))) * Float64(t_1 * Float64(Float64(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)) - 0.254829592)))); end return tmp end
function tmp_2 = code(x) t_0 = 1.0 + (0.3275911 * x); t_1 = 1.0 / t_0; tmp = 0.0; if (x <= 6e-26) tmp = 1e-9; else tmp = 1.0 + (exp((x * -x)) * (t_1 * (((-0.284496736 + (t_1 * (1.421413741 + (t_1 * (-1.453152027 + (1.061405429 / t_0)))))) * (-1.0 / t_0)) - 0.254829592))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[x, 6e-26], 1e-9, N[(1.0 + N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[(N[(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] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision] - 0.254829592), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot x\\
t_1 := \frac{1}{t\_0}\\
\mathbf{if}\;x \leq 6 \cdot 10^{-26}:\\
\;\;\;\;10^{-9}\\
\mathbf{else}:\\
\;\;\;\;1 + e^{x \cdot \left(-x\right)} \cdot \left(t\_1 \cdot \left(\left(-0.284496736 + t\_1 \cdot \left(1.421413741 + t\_1 \cdot \left(-1.453152027 + \frac{1.061405429}{t\_0}\right)\right)\right) \cdot \frac{-1}{t\_0} - 0.254829592\right)\right)\\
\end{array}
\end{array}
if x < 6.00000000000000023e-26Initial program 71.8%
Simplified71.8%
Applied egg-rr39.6%
Taylor expanded in x around 0 70.4%
if 6.00000000000000023e-26 < x Initial program 97.1%
Simplified97.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified97.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified97.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified97.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified97.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified97.1%
Final simplification78.3%
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.3275911 x))) (t_1 (/ 1.0 t_0)))
(if (<= x 6e-26)
1e-9
(+
1.0
(*
(exp (* x (- x)))
(*
(+ 0.254829592 (* t_1 (+ -0.284496736 (* t_1 1.029667143))))
(/ -1.0 t_0)))))))
double code(double x) {
double t_0 = 1.0 + (0.3275911 * x);
double t_1 = 1.0 / t_0;
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0 + (exp((x * -x)) * ((0.254829592 + (t_1 * (-0.284496736 + (t_1 * 1.029667143)))) * (-1.0 / t_0)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + (0.3275911d0 * x)
t_1 = 1.0d0 / t_0
if (x <= 6d-26) then
tmp = 1d-9
else
tmp = 1.0d0 + (exp((x * -x)) * ((0.254829592d0 + (t_1 * ((-0.284496736d0) + (t_1 * 1.029667143d0)))) * ((-1.0d0) / t_0)))
end if
code = tmp
end function
public static double code(double x) {
double t_0 = 1.0 + (0.3275911 * x);
double t_1 = 1.0 / t_0;
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0 + (Math.exp((x * -x)) * ((0.254829592 + (t_1 * (-0.284496736 + (t_1 * 1.029667143)))) * (-1.0 / t_0)));
}
return tmp;
}
def code(x): t_0 = 1.0 + (0.3275911 * x) t_1 = 1.0 / t_0 tmp = 0 if x <= 6e-26: tmp = 1e-9 else: tmp = 1.0 + (math.exp((x * -x)) * ((0.254829592 + (t_1 * (-0.284496736 + (t_1 * 1.029667143)))) * (-1.0 / t_0))) return tmp
function code(x) t_0 = Float64(1.0 + Float64(0.3275911 * x)) t_1 = Float64(1.0 / t_0) tmp = 0.0 if (x <= 6e-26) tmp = 1e-9; else tmp = Float64(1.0 + Float64(exp(Float64(x * Float64(-x))) * Float64(Float64(0.254829592 + Float64(t_1 * Float64(-0.284496736 + Float64(t_1 * 1.029667143)))) * Float64(-1.0 / t_0)))); end return tmp end
function tmp_2 = code(x) t_0 = 1.0 + (0.3275911 * x); t_1 = 1.0 / t_0; tmp = 0.0; if (x <= 6e-26) tmp = 1e-9; else tmp = 1.0 + (exp((x * -x)) * ((0.254829592 + (t_1 * (-0.284496736 + (t_1 * 1.029667143)))) * (-1.0 / t_0))); end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 / t$95$0), $MachinePrecision]}, If[LessEqual[x, 6e-26], 1e-9, N[(1.0 + N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(N[(0.254829592 + N[(t$95$1 * N[(-0.284496736 + N[(t$95$1 * 1.029667143), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot x\\
t_1 := \frac{1}{t\_0}\\
\mathbf{if}\;x \leq 6 \cdot 10^{-26}:\\
\;\;\;\;10^{-9}\\
\mathbf{else}:\\
\;\;\;\;1 + e^{x \cdot \left(-x\right)} \cdot \left(\left(0.254829592 + t\_1 \cdot \left(-0.284496736 + t\_1 \cdot 1.029667143\right)\right) \cdot \frac{-1}{t\_0}\right)\\
\end{array}
\end{array}
if x < 6.00000000000000023e-26Initial program 71.8%
Simplified71.8%
Applied egg-rr39.6%
Taylor expanded in x around 0 70.4%
if 6.00000000000000023e-26 < x Initial program 97.1%
Simplified97.1%
expm1-log1p-u97.1%
expm1-undefine96.9%
Applied egg-rr96.9%
sub-neg96.9%
metadata-eval96.9%
+-commutative96.9%
log1p-undefine96.9%
rem-exp-log96.9%
associate-+r+96.9%
metadata-eval97.0%
Simplified97.0%
Taylor expanded in x around 0 96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
Final simplification78.0%
(FPCore (x)
:precision binary64
(if (<= x 6e-26)
1e-9
(+
1.0
(*
(exp (* x (- x)))
(*
(+ 1.0 (* x -0.3275911))
(- (* 0.745170407 (/ -1.0 (+ 1.0 (* 0.3275911 x)))) 0.254829592))))))
double code(double x) {
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0 + (exp((x * -x)) * ((1.0 + (x * -0.3275911)) * ((0.745170407 * (-1.0 / (1.0 + (0.3275911 * x)))) - 0.254829592)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 6d-26) then
tmp = 1d-9
else
tmp = 1.0d0 + (exp((x * -x)) * ((1.0d0 + (x * (-0.3275911d0))) * ((0.745170407d0 * ((-1.0d0) / (1.0d0 + (0.3275911d0 * x)))) - 0.254829592d0)))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0 + (Math.exp((x * -x)) * ((1.0 + (x * -0.3275911)) * ((0.745170407 * (-1.0 / (1.0 + (0.3275911 * x)))) - 0.254829592)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 6e-26: tmp = 1e-9 else: tmp = 1.0 + (math.exp((x * -x)) * ((1.0 + (x * -0.3275911)) * ((0.745170407 * (-1.0 / (1.0 + (0.3275911 * x)))) - 0.254829592))) return tmp
function code(x) tmp = 0.0 if (x <= 6e-26) tmp = 1e-9; else tmp = Float64(1.0 + Float64(exp(Float64(x * Float64(-x))) * Float64(Float64(1.0 + Float64(x * -0.3275911)) * Float64(Float64(0.745170407 * Float64(-1.0 / Float64(1.0 + Float64(0.3275911 * x)))) - 0.254829592)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 6e-26) tmp = 1e-9; else tmp = 1.0 + (exp((x * -x)) * ((1.0 + (x * -0.3275911)) * ((0.745170407 * (-1.0 / (1.0 + (0.3275911 * x)))) - 0.254829592))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 6e-26], 1e-9, N[(1.0 + N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(N[(1.0 + N[(x * -0.3275911), $MachinePrecision]), $MachinePrecision] * N[(N[(0.745170407 * N[(-1.0 / N[(1.0 + N[(0.3275911 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.254829592), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{-26}:\\
\;\;\;\;10^{-9}\\
\mathbf{else}:\\
\;\;\;\;1 + e^{x \cdot \left(-x\right)} \cdot \left(\left(1 + x \cdot -0.3275911\right) \cdot \left(0.745170407 \cdot \frac{-1}{1 + 0.3275911 \cdot x} - 0.254829592\right)\right)\\
\end{array}
\end{array}
if x < 6.00000000000000023e-26Initial program 71.8%
Simplified71.8%
Applied egg-rr39.6%
Taylor expanded in x around 0 70.4%
if 6.00000000000000023e-26 < x Initial program 97.1%
Simplified97.1%
expm1-log1p-u97.1%
expm1-undefine96.9%
Applied egg-rr96.9%
sub-neg96.9%
metadata-eval96.9%
+-commutative96.9%
log1p-undefine96.9%
rem-exp-log96.9%
associate-+r+96.9%
metadata-eval97.0%
Simplified97.0%
Taylor expanded in x around 0 96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
Taylor expanded in x around 0 96.0%
Taylor expanded in x around 0 96.0%
*-commutative96.0%
Simplified96.0%
Final simplification78.0%
(FPCore (x)
:precision binary64
(if (<= x 6e-26)
1e-9
(+
1.0
(*
(exp (* x (- x)))
(*
(+ 0.254829592 (+ 0.745170407 (* x -0.2441111933165777)))
(/ -1.0 (+ 1.0 (* 0.3275911 x))))))))
double code(double x) {
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0 + (exp((x * -x)) * ((0.254829592 + (0.745170407 + (x * -0.2441111933165777))) * (-1.0 / (1.0 + (0.3275911 * x)))));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 6d-26) then
tmp = 1d-9
else
tmp = 1.0d0 + (exp((x * -x)) * ((0.254829592d0 + (0.745170407d0 + (x * (-0.2441111933165777d0)))) * ((-1.0d0) / (1.0d0 + (0.3275911d0 * x)))))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0 + (Math.exp((x * -x)) * ((0.254829592 + (0.745170407 + (x * -0.2441111933165777))) * (-1.0 / (1.0 + (0.3275911 * x)))));
}
return tmp;
}
def code(x): tmp = 0 if x <= 6e-26: tmp = 1e-9 else: tmp = 1.0 + (math.exp((x * -x)) * ((0.254829592 + (0.745170407 + (x * -0.2441111933165777))) * (-1.0 / (1.0 + (0.3275911 * x))))) return tmp
function code(x) tmp = 0.0 if (x <= 6e-26) tmp = 1e-9; else tmp = Float64(1.0 + Float64(exp(Float64(x * Float64(-x))) * Float64(Float64(0.254829592 + Float64(0.745170407 + Float64(x * -0.2441111933165777))) * Float64(-1.0 / Float64(1.0 + Float64(0.3275911 * x)))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 6e-26) tmp = 1e-9; else tmp = 1.0 + (exp((x * -x)) * ((0.254829592 + (0.745170407 + (x * -0.2441111933165777))) * (-1.0 / (1.0 + (0.3275911 * x))))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 6e-26], 1e-9, N[(1.0 + N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(N[(0.254829592 + N[(0.745170407 + N[(x * -0.2441111933165777), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(1.0 + N[(0.3275911 * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{-26}:\\
\;\;\;\;10^{-9}\\
\mathbf{else}:\\
\;\;\;\;1 + e^{x \cdot \left(-x\right)} \cdot \left(\left(0.254829592 + \left(0.745170407 + x \cdot -0.2441111933165777\right)\right) \cdot \frac{-1}{1 + 0.3275911 \cdot x}\right)\\
\end{array}
\end{array}
if x < 6.00000000000000023e-26Initial program 71.8%
Simplified71.8%
Applied egg-rr39.6%
Taylor expanded in x around 0 70.4%
if 6.00000000000000023e-26 < x Initial program 97.1%
Simplified97.1%
expm1-log1p-u97.1%
expm1-undefine96.9%
Applied egg-rr96.9%
sub-neg96.9%
metadata-eval96.9%
+-commutative96.9%
log1p-undefine96.9%
rem-exp-log96.9%
associate-+r+96.9%
metadata-eval97.0%
Simplified97.0%
Taylor expanded in x around 0 96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
Taylor expanded in x around 0 96.0%
Taylor expanded in x around 0 96.0%
*-commutative96.0%
Simplified96.0%
Final simplification78.0%
(FPCore (x) :precision binary64 (if (<= x 6e-26) 1e-9 (+ 1.0 (* (exp (* x (- x))) (* 0.999999999 (- -1.0 (* x -0.3275911)))))))
double code(double x) {
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0 + (exp((x * -x)) * (0.999999999 * (-1.0 - (x * -0.3275911))));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 6d-26) then
tmp = 1d-9
else
tmp = 1.0d0 + (exp((x * -x)) * (0.999999999d0 * ((-1.0d0) - (x * (-0.3275911d0)))))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0 + (Math.exp((x * -x)) * (0.999999999 * (-1.0 - (x * -0.3275911))));
}
return tmp;
}
def code(x): tmp = 0 if x <= 6e-26: tmp = 1e-9 else: tmp = 1.0 + (math.exp((x * -x)) * (0.999999999 * (-1.0 - (x * -0.3275911)))) return tmp
function code(x) tmp = 0.0 if (x <= 6e-26) tmp = 1e-9; else tmp = Float64(1.0 + Float64(exp(Float64(x * Float64(-x))) * Float64(0.999999999 * Float64(-1.0 - Float64(x * -0.3275911))))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 6e-26) tmp = 1e-9; else tmp = 1.0 + (exp((x * -x)) * (0.999999999 * (-1.0 - (x * -0.3275911)))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 6e-26], 1e-9, N[(1.0 + N[(N[Exp[N[(x * (-x)), $MachinePrecision]], $MachinePrecision] * N[(0.999999999 * N[(-1.0 - N[(x * -0.3275911), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{-26}:\\
\;\;\;\;10^{-9}\\
\mathbf{else}:\\
\;\;\;\;1 + e^{x \cdot \left(-x\right)} \cdot \left(0.999999999 \cdot \left(-1 - x \cdot -0.3275911\right)\right)\\
\end{array}
\end{array}
if x < 6.00000000000000023e-26Initial program 71.8%
Simplified71.8%
Applied egg-rr39.6%
Taylor expanded in x around 0 70.4%
if 6.00000000000000023e-26 < x Initial program 97.1%
Simplified97.1%
expm1-log1p-u97.1%
expm1-undefine96.9%
Applied egg-rr96.9%
sub-neg96.9%
metadata-eval96.9%
+-commutative96.9%
log1p-undefine96.9%
rem-exp-log96.9%
associate-+r+96.9%
metadata-eval97.0%
Simplified97.0%
Taylor expanded in x around 0 96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
expm1-log1p-u97.1%
log1p-define97.1%
expm1-undefine97.1%
add-exp-log97.1%
+-commutative97.1%
fma-define97.1%
add-sqr-sqrt97.1%
fabs-sqr97.1%
add-sqr-sqrt97.1%
Applied egg-rr96.1%
fma-undefine97.1%
associate--l+97.1%
metadata-eval97.1%
+-rgt-identity97.1%
Simplified96.1%
Taylor expanded in x around 0 96.0%
Taylor expanded in x around 0 96.0%
*-commutative96.0%
Simplified96.0%
Taylor expanded in x around 0 96.0%
Final simplification78.0%
(FPCore (x) :precision binary64 (if (<= x 0.88) (+ 1e-9 (* x 1.128386358070218)) 1.0))
double code(double x) {
double tmp;
if (x <= 0.88) {
tmp = 1e-9 + (x * 1.128386358070218);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.88d0) then
tmp = 1d-9 + (x * 1.128386358070218d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.88) {
tmp = 1e-9 + (x * 1.128386358070218);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.88: tmp = 1e-9 + (x * 1.128386358070218) else: tmp = 1.0 return tmp
function code(x) tmp = 0.0 if (x <= 0.88) tmp = Float64(1e-9 + Float64(x * 1.128386358070218)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.88) tmp = 1e-9 + (x * 1.128386358070218); else tmp = 1.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.88], N[(1e-9 + N[(x * 1.128386358070218), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.88:\\
\;\;\;\;10^{-9} + x \cdot 1.128386358070218\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 0.880000000000000004Initial program 71.4%
Simplified71.4%
Applied egg-rr40.0%
Taylor expanded in x around 0 67.9%
*-commutative67.9%
Simplified67.9%
if 0.880000000000000004 < x Initial program 100.0%
Simplified100.0%
Applied egg-rr0.0%
Taylor expanded in x around inf 99.0%
(FPCore (x) :precision binary64 (if (<= x 6e-26) 1e-9 1.0))
double code(double x) {
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 6d-26) then
tmp = 1d-9
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 6e-26) {
tmp = 1e-9;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x): tmp = 0 if x <= 6e-26: tmp = 1e-9 else: tmp = 1.0 return tmp
function code(x) tmp = 0.0 if (x <= 6e-26) tmp = 1e-9; else tmp = 1.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 6e-26) tmp = 1e-9; else tmp = 1.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 6e-26], 1e-9, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{-26}:\\
\;\;\;\;10^{-9}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 6.00000000000000023e-26Initial program 71.8%
Simplified71.8%
Applied egg-rr39.6%
Taylor expanded in x around 0 70.4%
if 6.00000000000000023e-26 < x Initial program 97.1%
Simplified97.1%
Applied egg-rr3.7%
Taylor expanded in x around inf 93.2%
(FPCore (x) :precision binary64 1e-9)
double code(double x) {
return 1e-9;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1d-9
end function
public static double code(double x) {
return 1e-9;
}
def code(x): return 1e-9
function code(x) return 1e-9 end
function tmp = code(x) tmp = 1e-9; end
code[x_] := 1e-9
\begin{array}{l}
\\
10^{-9}
\end{array}
Initial program 79.4%
Simplified79.4%
Applied egg-rr28.9%
Taylor expanded in x around 0 54.0%
herbie shell --seed 2024107
(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)))))))