Jmat.Real.erf

Percentage Accurate: 79.4% → 82.9%
Time: 36.1s
Alternatives: 13
Speedup: 1.3×

Specification

?
\[\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 (/ 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:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 13 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 79.4% accurate, 1.0× speedup?

\[\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 (/ 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}

Alternative 1: 82.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.3275911 \cdot \left|x\right|\\ t_1 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0} + 0.254829592\\ t_2 := e^{x \cdot x}\\ t_3 := t\_0 \cdot t\_2\\ t_4 := \frac{t\_1}{t\_3}\\ t_5 := 1 + t\_4\\ t_6 := 1 + \frac{t\_5}{\frac{t\_0}{\frac{t\_1}{t\_2}}}\\ \frac{{t\_6}^{3} - {t\_6}^{2} \cdot \left(t\_6 \cdot {t\_4}^{3}\right)}{e^{\mathsf{log1p}\left(\frac{t\_5}{\frac{t\_3}{t\_1}}\right) \cdot 4}} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x))))
        (t_1
         (+
          (/
           (+
            -0.284496736
            (/
             (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0))
             t_0))
           t_0)
          0.254829592))
        (t_2 (exp (* x x)))
        (t_3 (* t_0 t_2))
        (t_4 (/ t_1 t_3))
        (t_5 (+ 1.0 t_4))
        (t_6 (+ 1.0 (/ t_5 (/ t_0 (/ t_1 t_2))))))
   (/
    (- (pow t_6 3.0) (* (pow t_6 2.0) (* t_6 (pow t_4 3.0))))
    (exp (* (log1p (/ t_5 (/ t_3 t_1))) 4.0)))))
double code(double x) {
	double t_0 = 1.0 + (0.3275911 * fabs(x));
	double t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592;
	double t_2 = exp((x * x));
	double t_3 = t_0 * t_2;
	double t_4 = t_1 / t_3;
	double t_5 = 1.0 + t_4;
	double t_6 = 1.0 + (t_5 / (t_0 / (t_1 / t_2)));
	return (pow(t_6, 3.0) - (pow(t_6, 2.0) * (t_6 * pow(t_4, 3.0)))) / exp((log1p((t_5 / (t_3 / t_1))) * 4.0));
}
public static double code(double x) {
	double t_0 = 1.0 + (0.3275911 * Math.abs(x));
	double t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592;
	double t_2 = Math.exp((x * x));
	double t_3 = t_0 * t_2;
	double t_4 = t_1 / t_3;
	double t_5 = 1.0 + t_4;
	double t_6 = 1.0 + (t_5 / (t_0 / (t_1 / t_2)));
	return (Math.pow(t_6, 3.0) - (Math.pow(t_6, 2.0) * (t_6 * Math.pow(t_4, 3.0)))) / Math.exp((Math.log1p((t_5 / (t_3 / t_1))) * 4.0));
}
def code(x):
	t_0 = 1.0 + (0.3275911 * math.fabs(x))
	t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592
	t_2 = math.exp((x * x))
	t_3 = t_0 * t_2
	t_4 = t_1 / t_3
	t_5 = 1.0 + t_4
	t_6 = 1.0 + (t_5 / (t_0 / (t_1 / t_2)))
	return (math.pow(t_6, 3.0) - (math.pow(t_6, 2.0) * (t_6 * math.pow(t_4, 3.0)))) / math.exp((math.log1p((t_5 / (t_3 / t_1))) * 4.0))
function code(x)
	t_0 = Float64(1.0 + Float64(0.3275911 * abs(x)))
	t_1 = Float64(Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592)
	t_2 = exp(Float64(x * x))
	t_3 = Float64(t_0 * t_2)
	t_4 = Float64(t_1 / t_3)
	t_5 = Float64(1.0 + t_4)
	t_6 = Float64(1.0 + Float64(t_5 / Float64(t_0 / Float64(t_1 / t_2))))
	return Float64(Float64((t_6 ^ 3.0) - Float64((t_6 ^ 2.0) * Float64(t_6 * (t_4 ^ 3.0)))) / exp(Float64(log1p(Float64(t_5 / Float64(t_3 / t_1))) * 4.0)))
end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + 0.254829592), $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 * t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 / t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(1.0 + t$95$4), $MachinePrecision]}, Block[{t$95$6 = N[(1.0 + N[(t$95$5 / N[(t$95$0 / N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[t$95$6, 3.0], $MachinePrecision] - N[(N[Power[t$95$6, 2.0], $MachinePrecision] * N[(t$95$6 * N[Power[t$95$4, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Exp[N[(N[Log[1 + N[(t$95$5 / N[(t$95$3 / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 4.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\right|\\
t_1 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0} + 0.254829592\\
t_2 := e^{x \cdot x}\\
t_3 := t\_0 \cdot t\_2\\
t_4 := \frac{t\_1}{t\_3}\\
t_5 := 1 + t\_4\\
t_6 := 1 + \frac{t\_5}{\frac{t\_0}{\frac{t\_1}{t\_2}}}\\
\frac{{t\_6}^{3} - {t\_6}^{2} \cdot \left(t\_6 \cdot {t\_4}^{3}\right)}{e^{\mathsf{log1p}\left(\frac{t\_5}{\frac{t\_3}{t\_1}}\right) \cdot 4}}
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Applied egg-rr0

    \[\leadsto expr\]
  6. Add Preprocessing

Alternative 2: 82.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.3275911 \cdot \left|x\right|\\ t_1 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0} + 0.254829592\\ t_2 := e^{x \cdot x}\\ t_3 := t\_0 \cdot t\_2\\ t_4 := \frac{t\_1}{t\_3}\\ t_5 := 1 + t\_4\\ t_6 := 1 + \frac{t\_5}{\frac{t\_0}{\frac{t\_1}{t\_2}}}\\ \frac{{t\_6}^{3} - {t\_6}^{2} \cdot \left(t\_6 \cdot {t\_4}^{3}\right)}{{\left(1 + \frac{t\_5}{\frac{t\_3}{t\_1}}\right)}^{4}} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x))))
        (t_1
         (+
          (/
           (+
            -0.284496736
            (/
             (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0))
             t_0))
           t_0)
          0.254829592))
        (t_2 (exp (* x x)))
        (t_3 (* t_0 t_2))
        (t_4 (/ t_1 t_3))
        (t_5 (+ 1.0 t_4))
        (t_6 (+ 1.0 (/ t_5 (/ t_0 (/ t_1 t_2))))))
   (/
    (- (pow t_6 3.0) (* (pow t_6 2.0) (* t_6 (pow t_4 3.0))))
    (pow (+ 1.0 (/ t_5 (/ t_3 t_1))) 4.0))))
double code(double x) {
	double t_0 = 1.0 + (0.3275911 * fabs(x));
	double t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592;
	double t_2 = exp((x * x));
	double t_3 = t_0 * t_2;
	double t_4 = t_1 / t_3;
	double t_5 = 1.0 + t_4;
	double t_6 = 1.0 + (t_5 / (t_0 / (t_1 / t_2)));
	return (pow(t_6, 3.0) - (pow(t_6, 2.0) * (t_6 * pow(t_4, 3.0)))) / pow((1.0 + (t_5 / (t_3 / t_1))), 4.0);
}
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) :: t_4
    real(8) :: t_5
    real(8) :: t_6
    t_0 = 1.0d0 + (0.3275911d0 * abs(x))
    t_1 = (((-0.284496736d0) + ((1.421413741d0 + (((-1.453152027d0) + (1.061405429d0 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592d0
    t_2 = exp((x * x))
    t_3 = t_0 * t_2
    t_4 = t_1 / t_3
    t_5 = 1.0d0 + t_4
    t_6 = 1.0d0 + (t_5 / (t_0 / (t_1 / t_2)))
    code = ((t_6 ** 3.0d0) - ((t_6 ** 2.0d0) * (t_6 * (t_4 ** 3.0d0)))) / ((1.0d0 + (t_5 / (t_3 / t_1))) ** 4.0d0)
end function
public static double code(double x) {
	double t_0 = 1.0 + (0.3275911 * Math.abs(x));
	double t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592;
	double t_2 = Math.exp((x * x));
	double t_3 = t_0 * t_2;
	double t_4 = t_1 / t_3;
	double t_5 = 1.0 + t_4;
	double t_6 = 1.0 + (t_5 / (t_0 / (t_1 / t_2)));
	return (Math.pow(t_6, 3.0) - (Math.pow(t_6, 2.0) * (t_6 * Math.pow(t_4, 3.0)))) / Math.pow((1.0 + (t_5 / (t_3 / t_1))), 4.0);
}
def code(x):
	t_0 = 1.0 + (0.3275911 * math.fabs(x))
	t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592
	t_2 = math.exp((x * x))
	t_3 = t_0 * t_2
	t_4 = t_1 / t_3
	t_5 = 1.0 + t_4
	t_6 = 1.0 + (t_5 / (t_0 / (t_1 / t_2)))
	return (math.pow(t_6, 3.0) - (math.pow(t_6, 2.0) * (t_6 * math.pow(t_4, 3.0)))) / math.pow((1.0 + (t_5 / (t_3 / t_1))), 4.0)
function code(x)
	t_0 = Float64(1.0 + Float64(0.3275911 * abs(x)))
	t_1 = Float64(Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592)
	t_2 = exp(Float64(x * x))
	t_3 = Float64(t_0 * t_2)
	t_4 = Float64(t_1 / t_3)
	t_5 = Float64(1.0 + t_4)
	t_6 = Float64(1.0 + Float64(t_5 / Float64(t_0 / Float64(t_1 / t_2))))
	return Float64(Float64((t_6 ^ 3.0) - Float64((t_6 ^ 2.0) * Float64(t_6 * (t_4 ^ 3.0)))) / (Float64(1.0 + Float64(t_5 / Float64(t_3 / t_1))) ^ 4.0))
end
function tmp = code(x)
	t_0 = 1.0 + (0.3275911 * abs(x));
	t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592;
	t_2 = exp((x * x));
	t_3 = t_0 * t_2;
	t_4 = t_1 / t_3;
	t_5 = 1.0 + t_4;
	t_6 = 1.0 + (t_5 / (t_0 / (t_1 / t_2)));
	tmp = ((t_6 ^ 3.0) - ((t_6 ^ 2.0) * (t_6 * (t_4 ^ 3.0)))) / ((1.0 + (t_5 / (t_3 / t_1))) ^ 4.0);
end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + 0.254829592), $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 * t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 / t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(1.0 + t$95$4), $MachinePrecision]}, Block[{t$95$6 = N[(1.0 + N[(t$95$5 / N[(t$95$0 / N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Power[t$95$6, 3.0], $MachinePrecision] - N[(N[Power[t$95$6, 2.0], $MachinePrecision] * N[(t$95$6 * N[Power[t$95$4, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(1.0 + N[(t$95$5 / N[(t$95$3 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\right|\\
t_1 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0} + 0.254829592\\
t_2 := e^{x \cdot x}\\
t_3 := t\_0 \cdot t\_2\\
t_4 := \frac{t\_1}{t\_3}\\
t_5 := 1 + t\_4\\
t_6 := 1 + \frac{t\_5}{\frac{t\_0}{\frac{t\_1}{t\_2}}}\\
\frac{{t\_6}^{3} - {t\_6}^{2} \cdot \left(t\_6 \cdot {t\_4}^{3}\right)}{{\left(1 + \frac{t\_5}{\frac{t\_3}{t\_1}}\right)}^{4}}
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Applied egg-rr0

    \[\leadsto expr\]
  6. Add Preprocessing

Alternative 3: 80.4% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.3275911 \cdot \left|x\right|\\ t_1 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0}\\ t_2 := t\_1 + 0.254829592\\ t_3 := e^{x \cdot x}\\ t_4 := t\_0 \cdot t\_3\\ t_5 := \frac{t\_2}{t\_4}\\ t_6 := 1 + t\_5\\ t_7 := \frac{0.254829592 + t\_1}{t\_4}\\ t_8 := 1 + t\_7 \cdot \left(1 + t\_7\right)\\ \frac{\mathsf{fma}\left(t\_2 \cdot t\_6, \frac{1}{t\_4}, 1 - \left(1 + \frac{t\_6}{\frac{t\_0}{\frac{t\_2}{t\_3}}}\right) \cdot {t\_5}^{3}\right)}{t\_8 \cdot t\_8} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x))))
        (t_1
         (/
          (+
           -0.284496736
           (/
            (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0))
            t_0))
          t_0))
        (t_2 (+ t_1 0.254829592))
        (t_3 (exp (* x x)))
        (t_4 (* t_0 t_3))
        (t_5 (/ t_2 t_4))
        (t_6 (+ 1.0 t_5))
        (t_7 (/ (+ 0.254829592 t_1) t_4))
        (t_8 (+ 1.0 (* t_7 (+ 1.0 t_7)))))
   (/
    (fma
     (* t_2 t_6)
     (/ 1.0 t_4)
     (- 1.0 (* (+ 1.0 (/ t_6 (/ t_0 (/ t_2 t_3)))) (pow t_5 3.0))))
    (* t_8 t_8))))
double code(double x) {
	double t_0 = 1.0 + (0.3275911 * fabs(x));
	double t_1 = (-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0;
	double t_2 = t_1 + 0.254829592;
	double t_3 = exp((x * x));
	double t_4 = t_0 * t_3;
	double t_5 = t_2 / t_4;
	double t_6 = 1.0 + t_5;
	double t_7 = (0.254829592 + t_1) / t_4;
	double t_8 = 1.0 + (t_7 * (1.0 + t_7));
	return fma((t_2 * t_6), (1.0 / t_4), (1.0 - ((1.0 + (t_6 / (t_0 / (t_2 / t_3)))) * pow(t_5, 3.0)))) / (t_8 * t_8);
}
function code(x)
	t_0 = Float64(1.0 + Float64(0.3275911 * abs(x)))
	t_1 = Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / t_0)) / t_0)
	t_2 = Float64(t_1 + 0.254829592)
	t_3 = exp(Float64(x * x))
	t_4 = Float64(t_0 * t_3)
	t_5 = Float64(t_2 / t_4)
	t_6 = Float64(1.0 + t_5)
	t_7 = Float64(Float64(0.254829592 + t_1) / t_4)
	t_8 = Float64(1.0 + Float64(t_7 * Float64(1.0 + t_7)))
	return Float64(fma(Float64(t_2 * t_6), Float64(1.0 / t_4), Float64(1.0 - Float64(Float64(1.0 + Float64(t_6 / Float64(t_0 / Float64(t_2 / t_3)))) * (t_5 ^ 3.0)))) / Float64(t_8 * t_8))
end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + 0.254829592), $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$0 * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$2 / t$95$4), $MachinePrecision]}, Block[{t$95$6 = N[(1.0 + t$95$5), $MachinePrecision]}, Block[{t$95$7 = N[(N[(0.254829592 + t$95$1), $MachinePrecision] / t$95$4), $MachinePrecision]}, Block[{t$95$8 = N[(1.0 + N[(t$95$7 * N[(1.0 + t$95$7), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(t$95$2 * t$95$6), $MachinePrecision] * N[(1.0 / t$95$4), $MachinePrecision] + N[(1.0 - N[(N[(1.0 + N[(t$95$6 / N[(t$95$0 / N[(t$95$2 / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[t$95$5, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$8 * t$95$8), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\right|\\
t_1 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0}\\
t_2 := t\_1 + 0.254829592\\
t_3 := e^{x \cdot x}\\
t_4 := t\_0 \cdot t\_3\\
t_5 := \frac{t\_2}{t\_4}\\
t_6 := 1 + t\_5\\
t_7 := \frac{0.254829592 + t\_1}{t\_4}\\
t_8 := 1 + t\_7 \cdot \left(1 + t\_7\right)\\
\frac{\mathsf{fma}\left(t\_2 \cdot t\_6, \frac{1}{t\_4}, 1 - \left(1 + \frac{t\_6}{\frac{t\_0}{\frac{t\_2}{t\_3}}}\right) \cdot {t\_5}^{3}\right)}{t\_8 \cdot t\_8}
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Add Preprocessing

Alternative 4: 80.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.3275911 \cdot \left|x\right|\\ t_1 := 1 - \left|x\right| \cdot -0.3275911\\ t_2 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0} + 0.254829592\\ t_3 := e^{x \cdot x}\\ t_4 := t\_1 \cdot t\_3\\ t_5 := t\_0 \cdot t\_3\\ t_6 := \frac{t\_2}{t\_5}\\ t_7 := 1 + t\_6\\ t_8 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_1}}{t\_1}}{t\_1}}{t\_1} + 0.254829592\\ \frac{\mathsf{fma}\left(t\_2 \cdot t\_7, \frac{1}{t\_5}, 1 - \left(1 + \frac{t\_7}{\frac{t\_0}{\frac{t\_2}{t\_3}}}\right) \cdot {t\_6}^{3}\right)}{{\left(1 + \frac{1 + \frac{t\_8}{t\_4}}{\frac{t\_4}{t\_8}}\right)}^{2}} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x))))
        (t_1 (- 1.0 (* (fabs x) -0.3275911)))
        (t_2
         (+
          (/
           (+
            -0.284496736
            (/
             (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0))
             t_0))
           t_0)
          0.254829592))
        (t_3 (exp (* x x)))
        (t_4 (* t_1 t_3))
        (t_5 (* t_0 t_3))
        (t_6 (/ t_2 t_5))
        (t_7 (+ 1.0 t_6))
        (t_8
         (+
          (/
           (+
            -0.284496736
            (/
             (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_1)) t_1))
             t_1))
           t_1)
          0.254829592)))
   (/
    (fma
     (* t_2 t_7)
     (/ 1.0 t_5)
     (- 1.0 (* (+ 1.0 (/ t_7 (/ t_0 (/ t_2 t_3)))) (pow t_6 3.0))))
    (pow (+ 1.0 (/ (+ 1.0 (/ t_8 t_4)) (/ t_4 t_8))) 2.0))))
double code(double x) {
	double t_0 = 1.0 + (0.3275911 * fabs(x));
	double t_1 = 1.0 - (fabs(x) * -0.3275911);
	double t_2 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592;
	double t_3 = exp((x * x));
	double t_4 = t_1 * t_3;
	double t_5 = t_0 * t_3;
	double t_6 = t_2 / t_5;
	double t_7 = 1.0 + t_6;
	double t_8 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_1)) / t_1)) / t_1)) / t_1) + 0.254829592;
	return fma((t_2 * t_7), (1.0 / t_5), (1.0 - ((1.0 + (t_7 / (t_0 / (t_2 / t_3)))) * pow(t_6, 3.0)))) / pow((1.0 + ((1.0 + (t_8 / t_4)) / (t_4 / t_8))), 2.0);
}
function code(x)
	t_0 = Float64(1.0 + Float64(0.3275911 * abs(x)))
	t_1 = Float64(1.0 - Float64(abs(x) * -0.3275911))
	t_2 = Float64(Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592)
	t_3 = exp(Float64(x * x))
	t_4 = Float64(t_1 * t_3)
	t_5 = Float64(t_0 * t_3)
	t_6 = Float64(t_2 / t_5)
	t_7 = Float64(1.0 + t_6)
	t_8 = Float64(Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_1)) / t_1)) / t_1)) / t_1) + 0.254829592)
	return Float64(fma(Float64(t_2 * t_7), Float64(1.0 / t_5), Float64(1.0 - Float64(Float64(1.0 + Float64(t_7 / Float64(t_0 / Float64(t_2 / t_3)))) * (t_6 ^ 3.0)))) / (Float64(1.0 + Float64(Float64(1.0 + Float64(t_8 / t_4)) / Float64(t_4 / t_8))) ^ 2.0))
end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + 0.254829592), $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$0 * t$95$3), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$2 / t$95$5), $MachinePrecision]}, Block[{t$95$7 = N[(1.0 + t$95$6), $MachinePrecision]}, Block[{t$95$8 = N[(N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$1), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] + 0.254829592), $MachinePrecision]}, N[(N[(N[(t$95$2 * t$95$7), $MachinePrecision] * N[(1.0 / t$95$5), $MachinePrecision] + N[(1.0 - N[(N[(1.0 + N[(t$95$7 / N[(t$95$0 / N[(t$95$2 / t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[t$95$6, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(1.0 + N[(N[(1.0 + N[(t$95$8 / t$95$4), $MachinePrecision]), $MachinePrecision] / N[(t$95$4 / t$95$8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\right|\\
t_1 := 1 - \left|x\right| \cdot -0.3275911\\
t_2 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0} + 0.254829592\\
t_3 := e^{x \cdot x}\\
t_4 := t\_1 \cdot t\_3\\
t_5 := t\_0 \cdot t\_3\\
t_6 := \frac{t\_2}{t\_5}\\
t_7 := 1 + t\_6\\
t_8 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_1}}{t\_1}}{t\_1}}{t\_1} + 0.254829592\\
\frac{\mathsf{fma}\left(t\_2 \cdot t\_7, \frac{1}{t\_5}, 1 - \left(1 + \frac{t\_7}{\frac{t\_0}{\frac{t\_2}{t\_3}}}\right) \cdot {t\_6}^{3}\right)}{{\left(1 + \frac{1 + \frac{t\_8}{t\_4}}{\frac{t\_4}{t\_8}}\right)}^{2}}
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Applied egg-rr0

    \[\leadsto expr\]
  6. Add Preprocessing

Alternative 5: 80.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \left|x\right| \cdot -0.3275911\\ t_1 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0} + 0.254829592\\ t_2 := t\_0 \cdot e^{x \cdot x}\\ t_3 := \frac{t\_1}{t\_2}\\ t_4 := 1 + \frac{1 + t\_3}{\frac{t\_2}{t\_1}}\\ \frac{t\_4 - {t\_3}^{3} \cdot t\_4}{{t\_4}^{2}} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (- 1.0 (* (fabs x) -0.3275911)))
        (t_1
         (+
          (/
           (+
            -0.284496736
            (/
             (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0))
             t_0))
           t_0)
          0.254829592))
        (t_2 (* t_0 (exp (* x x))))
        (t_3 (/ t_1 t_2))
        (t_4 (+ 1.0 (/ (+ 1.0 t_3) (/ t_2 t_1)))))
   (/ (- t_4 (* (pow t_3 3.0) t_4)) (pow t_4 2.0))))
double code(double x) {
	double t_0 = 1.0 - (fabs(x) * -0.3275911);
	double t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592;
	double t_2 = t_0 * exp((x * x));
	double t_3 = t_1 / t_2;
	double t_4 = 1.0 + ((1.0 + t_3) / (t_2 / t_1));
	return (t_4 - (pow(t_3, 3.0) * t_4)) / pow(t_4, 2.0);
}
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) :: t_4
    t_0 = 1.0d0 - (abs(x) * (-0.3275911d0))
    t_1 = (((-0.284496736d0) + ((1.421413741d0 + (((-1.453152027d0) + (1.061405429d0 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592d0
    t_2 = t_0 * exp((x * x))
    t_3 = t_1 / t_2
    t_4 = 1.0d0 + ((1.0d0 + t_3) / (t_2 / t_1))
    code = (t_4 - ((t_3 ** 3.0d0) * t_4)) / (t_4 ** 2.0d0)
end function
public static double code(double x) {
	double t_0 = 1.0 - (Math.abs(x) * -0.3275911);
	double t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592;
	double t_2 = t_0 * Math.exp((x * x));
	double t_3 = t_1 / t_2;
	double t_4 = 1.0 + ((1.0 + t_3) / (t_2 / t_1));
	return (t_4 - (Math.pow(t_3, 3.0) * t_4)) / Math.pow(t_4, 2.0);
}
def code(x):
	t_0 = 1.0 - (math.fabs(x) * -0.3275911)
	t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592
	t_2 = t_0 * math.exp((x * x))
	t_3 = t_1 / t_2
	t_4 = 1.0 + ((1.0 + t_3) / (t_2 / t_1))
	return (t_4 - (math.pow(t_3, 3.0) * t_4)) / math.pow(t_4, 2.0)
function code(x)
	t_0 = Float64(1.0 - Float64(abs(x) * -0.3275911))
	t_1 = Float64(Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592)
	t_2 = Float64(t_0 * exp(Float64(x * x)))
	t_3 = Float64(t_1 / t_2)
	t_4 = Float64(1.0 + Float64(Float64(1.0 + t_3) / Float64(t_2 / t_1)))
	return Float64(Float64(t_4 - Float64((t_3 ^ 3.0) * t_4)) / (t_4 ^ 2.0))
end
function tmp = code(x)
	t_0 = 1.0 - (abs(x) * -0.3275911);
	t_1 = ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0) + 0.254829592;
	t_2 = t_0 * exp((x * x));
	t_3 = t_1 / t_2;
	t_4 = 1.0 + ((1.0 + t_3) / (t_2 / t_1));
	tmp = (t_4 - ((t_3 ^ 3.0) * t_4)) / (t_4 ^ 2.0);
end
code[x_] := Block[{t$95$0 = N[(1.0 - N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] + 0.254829592), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(1.0 + N[(N[(1.0 + t$95$3), $MachinePrecision] / N[(t$95$2 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(t$95$4 - N[(N[Power[t$95$3, 3.0], $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision] / N[Power[t$95$4, 2.0], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 - \left|x\right| \cdot -0.3275911\\
t_1 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0} + 0.254829592\\
t_2 := t\_0 \cdot e^{x \cdot x}\\
t_3 := \frac{t\_1}{t\_2}\\
t_4 := 1 + \frac{1 + t\_3}{\frac{t\_2}{t\_1}}\\
\frac{t\_4 - {t\_3}^{3} \cdot t\_4}{{t\_4}^{2}}
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Applied egg-rr0

    \[\leadsto expr\]
  6. Add Preprocessing

Alternative 6: 79.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.3275911 \cdot \left|x\right|\\ t_1 := 1 + t\_0\\ t_2 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_1}}{t\_1}}{t\_1}}{t\_1}\\ \mathsf{fma}\left({\left(\frac{\frac{\left(1 - 0.10731592879921 \cdot {\left(\left|x\right|\right)}^{2}\right) \cdot e^{x \cdot x}}{t\_0 + -1}}{0.06493812095888646 - {t\_2}^{2}}\right)}^{-1}, \frac{1}{0.254829592 - t\_2}, 1\right) \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (* 0.3275911 (fabs x)))
        (t_1 (+ 1.0 t_0))
        (t_2
         (/
          (+
           -0.284496736
           (/
            (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_1)) t_1))
            t_1))
          t_1)))
   (fma
    (pow
     (/
      (/
       (* (- 1.0 (* 0.10731592879921 (pow (fabs x) 2.0))) (exp (* x x)))
       (+ t_0 -1.0))
      (- 0.06493812095888646 (pow t_2 2.0)))
     -1.0)
    (/ 1.0 (- 0.254829592 t_2))
    1.0)))
double code(double x) {
	double t_0 = 0.3275911 * fabs(x);
	double t_1 = 1.0 + t_0;
	double t_2 = (-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_1)) / t_1)) / t_1)) / t_1;
	return fma(pow(((((1.0 - (0.10731592879921 * pow(fabs(x), 2.0))) * exp((x * x))) / (t_0 + -1.0)) / (0.06493812095888646 - pow(t_2, 2.0))), -1.0), (1.0 / (0.254829592 - t_2)), 1.0);
}
function code(x)
	t_0 = Float64(0.3275911 * abs(x))
	t_1 = Float64(1.0 + t_0)
	t_2 = Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_1)) / t_1)) / t_1)) / t_1)
	return fma((Float64(Float64(Float64(Float64(1.0 - Float64(0.10731592879921 * (abs(x) ^ 2.0))) * exp(Float64(x * x))) / Float64(t_0 + -1.0)) / Float64(0.06493812095888646 - (t_2 ^ 2.0))) ^ -1.0), Float64(1.0 / Float64(0.254829592 - t_2)), 1.0)
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[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$1), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, N[(N[Power[N[(N[(N[(N[(1.0 - N[(0.10731592879921 * N[Power[N[Abs[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision] / N[(0.06493812095888646 - N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * N[(1.0 / N[(0.254829592 - t$95$2), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.3275911 \cdot \left|x\right|\\
t_1 := 1 + t\_0\\
t_2 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_1}}{t\_1}}{t\_1}}{t\_1}\\
\mathsf{fma}\left({\left(\frac{\frac{\left(1 - 0.10731592879921 \cdot {\left(\left|x\right|\right)}^{2}\right) \cdot e^{x \cdot x}}{t\_0 + -1}}{0.06493812095888646 - {t\_2}^{2}}\right)}^{-1}, \frac{1}{0.254829592 - t\_2}, 1\right)
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Simplified0

    \[\leadsto expr\]
  3. Add Preprocessing
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Applied egg-rr0

    \[\leadsto expr\]
  6. Add Preprocessing

Alternative 7: 79.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.3275911 \cdot \left|x\right|\\ t_1 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0}\\ \mathsf{fma}\left({\left(\frac{e^{x \cdot x} \cdot \left(-1 + \left|x\right| \cdot -0.3275911\right)}{0.06493812095888646 - {t\_1}^{2}}\right)}^{-1}, \frac{1}{0.254829592 - t\_1}, 1\right) \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x))))
        (t_1
         (/
          (+
           -0.284496736
           (/
            (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0))
            t_0))
          t_0)))
   (fma
    (pow
     (/
      (* (exp (* x x)) (+ -1.0 (* (fabs x) -0.3275911)))
      (- 0.06493812095888646 (pow t_1 2.0)))
     -1.0)
    (/ 1.0 (- 0.254829592 t_1))
    1.0)))
double code(double x) {
	double t_0 = 1.0 + (0.3275911 * fabs(x));
	double t_1 = (-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0;
	return fma(pow(((exp((x * x)) * (-1.0 + (fabs(x) * -0.3275911))) / (0.06493812095888646 - pow(t_1, 2.0))), -1.0), (1.0 / (0.254829592 - t_1)), 1.0);
}
function code(x)
	t_0 = Float64(1.0 + Float64(0.3275911 * abs(x)))
	t_1 = Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / t_0)) / t_0)
	return fma((Float64(Float64(exp(Float64(x * x)) * Float64(-1.0 + Float64(abs(x) * -0.3275911))) / Float64(0.06493812095888646 - (t_1 ^ 2.0))) ^ -1.0), Float64(1.0 / Float64(0.254829592 - t_1)), 1.0)
end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]}, N[(N[Power[N[(N[(N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision] * N[(-1.0 + N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(0.06493812095888646 - N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision] * N[(1.0 / N[(0.254829592 - t$95$1), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\right|\\
t_1 := \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0}\\
\mathsf{fma}\left({\left(\frac{e^{x \cdot x} \cdot \left(-1 + \left|x\right| \cdot -0.3275911\right)}{0.06493812095888646 - {t\_1}^{2}}\right)}^{-1}, \frac{1}{0.254829592 - t\_1}, 1\right)
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Simplified0

    \[\leadsto expr\]
  3. Add Preprocessing
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Add Preprocessing

Alternative 8: 79.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.3275911 \cdot \left|x\right|\\ 1 - \frac{\frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{1 + \left(x \cdot x\right) \cdot -0.10731592879921} \cdot \left(1 + \left|x\right| \cdot -0.3275911\right)}{t\_0}}{e^{x \cdot x}}}{t\_0} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x)))))
   (-
    1.0
    (/
     (/
      (+
       0.254829592
       (/
        (+
         -0.284496736
         (*
          (/
           (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0))
           (+ 1.0 (* (* x x) -0.10731592879921)))
          (+ 1.0 (* (fabs x) -0.3275911))))
        t_0))
      (exp (* x x)))
     t_0))))
double code(double x) {
	double t_0 = 1.0 + (0.3275911 * fabs(x));
	return 1.0 - (((0.254829592 + ((-0.284496736 + (((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / (1.0 + ((x * x) * -0.10731592879921))) * (1.0 + (fabs(x) * -0.3275911)))) / t_0)) / exp((x * x))) / t_0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = 1.0d0 + (0.3275911d0 * abs(x))
    code = 1.0d0 - (((0.254829592d0 + (((-0.284496736d0) + (((1.421413741d0 + (((-1.453152027d0) + (1.061405429d0 / t_0)) / t_0)) / (1.0d0 + ((x * x) * (-0.10731592879921d0)))) * (1.0d0 + (abs(x) * (-0.3275911d0))))) / t_0)) / exp((x * x))) / t_0)
end function
public static double code(double x) {
	double t_0 = 1.0 + (0.3275911 * Math.abs(x));
	return 1.0 - (((0.254829592 + ((-0.284496736 + (((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / (1.0 + ((x * x) * -0.10731592879921))) * (1.0 + (Math.abs(x) * -0.3275911)))) / t_0)) / Math.exp((x * x))) / t_0);
}
def code(x):
	t_0 = 1.0 + (0.3275911 * math.fabs(x))
	return 1.0 - (((0.254829592 + ((-0.284496736 + (((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / (1.0 + ((x * x) * -0.10731592879921))) * (1.0 + (math.fabs(x) * -0.3275911)))) / t_0)) / math.exp((x * x))) / t_0)
function code(x)
	t_0 = Float64(1.0 + Float64(0.3275911 * abs(x)))
	return Float64(1.0 - Float64(Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / Float64(1.0 + Float64(Float64(x * x) * -0.10731592879921))) * Float64(1.0 + Float64(abs(x) * -0.3275911)))) / t_0)) / exp(Float64(x * x))) / t_0))
end
function tmp = code(x)
	t_0 = 1.0 + (0.3275911 * abs(x));
	tmp = 1.0 - (((0.254829592 + ((-0.284496736 + (((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / (1.0 + ((x * x) * -0.10731592879921))) * (1.0 + (abs(x) * -0.3275911)))) / t_0)) / exp((x * x))) / t_0);
end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.10731592879921), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\right|\\
1 - \frac{\frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{1 + \left(x \cdot x\right) \cdot -0.10731592879921} \cdot \left(1 + \left|x\right| \cdot -0.3275911\right)}{t\_0}}{e^{x \cdot x}}}{t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Add Preprocessing

Alternative 9: 79.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.3275911 \cdot \left|x\right|\\ 1 - \frac{\frac{0.254829592 + \frac{1}{t\_0} \cdot \left(-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}\right)}{e^{x \cdot x}}}{t\_0} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x)))))
   (-
    1.0
    (/
     (/
      (+
       0.254829592
       (*
        (/ 1.0 t_0)
        (+
         -0.284496736
         (/
          (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0))
          t_0))))
      (exp (* x x)))
     t_0))))
double code(double x) {
	double t_0 = 1.0 + (0.3275911 * fabs(x));
	return 1.0 - (((0.254829592 + ((1.0 / t_0) * (-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)))) / exp((x * x))) / t_0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = 1.0d0 + (0.3275911d0 * abs(x))
    code = 1.0d0 - (((0.254829592d0 + ((1.0d0 / t_0) * ((-0.284496736d0) + ((1.421413741d0 + (((-1.453152027d0) + (1.061405429d0 / t_0)) / t_0)) / t_0)))) / exp((x * x))) / t_0)
end function
public static double code(double x) {
	double t_0 = 1.0 + (0.3275911 * Math.abs(x));
	return 1.0 - (((0.254829592 + ((1.0 / t_0) * (-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)))) / Math.exp((x * x))) / t_0);
}
def code(x):
	t_0 = 1.0 + (0.3275911 * math.fabs(x))
	return 1.0 - (((0.254829592 + ((1.0 / t_0) * (-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)))) / math.exp((x * x))) / t_0)
function code(x)
	t_0 = Float64(1.0 + Float64(0.3275911 * abs(x)))
	return Float64(1.0 - Float64(Float64(Float64(0.254829592 + Float64(Float64(1.0 / t_0) * Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / t_0)))) / exp(Float64(x * x))) / t_0))
end
function tmp = code(x)
	t_0 = 1.0 + (0.3275911 * abs(x));
	tmp = 1.0 - (((0.254829592 + ((1.0 / t_0) * (-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)))) / exp((x * x))) / t_0);
end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(N[(N[(0.254829592 + N[(N[(1.0 / t$95$0), $MachinePrecision] * N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\right|\\
1 - \frac{\frac{0.254829592 + \frac{1}{t\_0} \cdot \left(-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}\right)}{e^{x \cdot x}}}{t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Add Preprocessing

Alternative 10: 79.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.3275911 \cdot \left|x\right|\\ 1 - \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0}}{t\_0} \cdot e^{0 - x \cdot x} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x)))))
   (-
    1.0
    (*
     (/
      (+
       0.254829592
       (/
        (+
         -0.284496736
         (/ (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0)) t_0))
        t_0))
      t_0)
     (exp (- 0.0 (* x x)))))))
double code(double x) {
	double t_0 = 1.0 + (0.3275911 * fabs(x));
	return 1.0 - (((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / t_0) * exp((0.0 - (x * x))));
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = 1.0d0 + (0.3275911d0 * abs(x))
    code = 1.0d0 - (((0.254829592d0 + (((-0.284496736d0) + ((1.421413741d0 + (((-1.453152027d0) + (1.061405429d0 / t_0)) / t_0)) / t_0)) / t_0)) / t_0) * exp((0.0d0 - (x * x))))
end function
public static double code(double x) {
	double t_0 = 1.0 + (0.3275911 * Math.abs(x));
	return 1.0 - (((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / t_0) * Math.exp((0.0 - (x * x))));
}
def code(x):
	t_0 = 1.0 + (0.3275911 * math.fabs(x))
	return 1.0 - (((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / t_0) * math.exp((0.0 - (x * x))))
function code(x)
	t_0 = Float64(1.0 + Float64(0.3275911 * abs(x)))
	return Float64(1.0 - Float64(Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / t_0) * exp(Float64(0.0 - Float64(x * x)))))
end
function tmp = code(x)
	t_0 = 1.0 + (0.3275911 * abs(x));
	tmp = 1.0 - (((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / t_0) * exp((0.0 - (x * x))));
end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * N[Exp[N[(0.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\right|\\
1 - \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0}}{t\_0} \cdot e^{0 - x \cdot x}
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Add Preprocessing

Alternative 11: 79.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.3275911 \cdot \left|x\right|\\ 1 - \frac{\frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0}}{e^{x \cdot x}}}{t\_0} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x)))))
   (-
    1.0
    (/
     (/
      (+
       0.254829592
       (/
        (+
         -0.284496736
         (/ (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0)) t_0))
        t_0))
      (exp (* x x)))
     t_0))))
double code(double x) {
	double t_0 = 1.0 + (0.3275911 * fabs(x));
	return 1.0 - (((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / exp((x * x))) / t_0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = 1.0d0 + (0.3275911d0 * abs(x))
    code = 1.0d0 - (((0.254829592d0 + (((-0.284496736d0) + ((1.421413741d0 + (((-1.453152027d0) + (1.061405429d0 / t_0)) / t_0)) / t_0)) / t_0)) / exp((x * x))) / t_0)
end function
public static double code(double x) {
	double t_0 = 1.0 + (0.3275911 * Math.abs(x));
	return 1.0 - (((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / Math.exp((x * x))) / t_0);
}
def code(x):
	t_0 = 1.0 + (0.3275911 * math.fabs(x))
	return 1.0 - (((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / math.exp((x * x))) / t_0)
function code(x)
	t_0 = Float64(1.0 + Float64(0.3275911 * abs(x)))
	return Float64(1.0 - Float64(Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / exp(Float64(x * x))) / t_0))
end
function tmp = code(x)
	t_0 = 1.0 + (0.3275911 * abs(x));
	tmp = 1.0 - (((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / exp((x * x))) / t_0);
end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 - N[(N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\right|\\
1 - \frac{\frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0}}{e^{x \cdot x}}}{t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Add Preprocessing
  3. Applied egg-rr0

    \[\leadsto expr\]
  4. Add Preprocessing

Alternative 12: 79.4% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + 0.3275911 \cdot \left|x\right|\\ 1 + \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0}}{e^{x \cdot x} \cdot \left(-1 + \left|x\right| \cdot -0.3275911\right)} \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (let* ((t_0 (+ 1.0 (* 0.3275911 (fabs x)))))
   (+
    1.0
    (/
     (+
      0.254829592
      (/
       (+
        -0.284496736
        (/ (+ 1.421413741 (/ (+ -1.453152027 (/ 1.061405429 t_0)) t_0)) t_0))
       t_0))
     (* (exp (* x x)) (+ -1.0 (* (fabs x) -0.3275911)))))))
double code(double x) {
	double t_0 = 1.0 + (0.3275911 * fabs(x));
	return 1.0 + ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / (exp((x * x)) * (-1.0 + (fabs(x) * -0.3275911))));
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: t_0
    t_0 = 1.0d0 + (0.3275911d0 * abs(x))
    code = 1.0d0 + ((0.254829592d0 + (((-0.284496736d0) + ((1.421413741d0 + (((-1.453152027d0) + (1.061405429d0 / t_0)) / t_0)) / t_0)) / t_0)) / (exp((x * x)) * ((-1.0d0) + (abs(x) * (-0.3275911d0)))))
end function
public static double code(double x) {
	double t_0 = 1.0 + (0.3275911 * Math.abs(x));
	return 1.0 + ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / (Math.exp((x * x)) * (-1.0 + (Math.abs(x) * -0.3275911))));
}
def code(x):
	t_0 = 1.0 + (0.3275911 * math.fabs(x))
	return 1.0 + ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / (math.exp((x * x)) * (-1.0 + (math.fabs(x) * -0.3275911))))
function code(x)
	t_0 = Float64(1.0 + Float64(0.3275911 * abs(x)))
	return Float64(1.0 + Float64(Float64(0.254829592 + Float64(Float64(-0.284496736 + Float64(Float64(1.421413741 + Float64(Float64(-1.453152027 + Float64(1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / Float64(exp(Float64(x * x)) * Float64(-1.0 + Float64(abs(x) * -0.3275911)))))
end
function tmp = code(x)
	t_0 = 1.0 + (0.3275911 * abs(x));
	tmp = 1.0 + ((0.254829592 + ((-0.284496736 + ((1.421413741 + ((-1.453152027 + (1.061405429 / t_0)) / t_0)) / t_0)) / t_0)) / (exp((x * x)) * (-1.0 + (abs(x) * -0.3275911))));
end
code[x_] := Block[{t$95$0 = N[(1.0 + N[(0.3275911 * N[Abs[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(1.0 + N[(N[(0.254829592 + N[(N[(-0.284496736 + N[(N[(1.421413741 + N[(N[(-1.453152027 + N[(1.061405429 / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(N[Exp[N[(x * x), $MachinePrecision]], $MachinePrecision] * N[(-1.0 + N[(N[Abs[x], $MachinePrecision] * -0.3275911), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + 0.3275911 \cdot \left|x\right|\\
1 + \frac{0.254829592 + \frac{-0.284496736 + \frac{1.421413741 + \frac{-1.453152027 + \frac{1.061405429}{t\_0}}{t\_0}}{t\_0}}{t\_0}}{e^{x \cdot x} \cdot \left(-1 + \left|x\right| \cdot -0.3275911\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Simplified0

    \[\leadsto expr\]
  3. Add Preprocessing
  4. Add Preprocessing

Alternative 13: 56.1% accurate, 856.0× speedup?

\[\begin{array}{l} \\ 1 \end{array} \]
(FPCore (x) :precision binary64 1.0)
double code(double x) {
	return 1.0;
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = 1.0d0
end function
public static double code(double x) {
	return 1.0;
}
def code(x):
	return 1.0
function code(x)
	return 1.0
end
function tmp = code(x)
	tmp = 1.0;
end
code[x_] := 1.0
\begin{array}{l}

\\
1
\end{array}
Derivation
  1. Initial program 77.0%

    \[1 - \left(\frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(0.254829592 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-0.284496736 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(1.421413741 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot \left(-1.453152027 + \frac{1}{1 + 0.3275911 \cdot \left|x\right|} \cdot 1.061405429\right)\right)\right)\right)\right) \cdot e^{-\left|x\right| \cdot \left|x\right|} \]
  2. Simplified0

    \[\leadsto expr\]
  3. Add Preprocessing
  4. Applied egg-rr0

    \[\leadsto expr\]
  5. Taylor expanded in x around inf 0

    \[\leadsto expr\]
  6. Simplified0

    \[\leadsto expr\]
  7. Add Preprocessing

Reproduce

?
herbie shell --seed 2024111 
(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)))))))