Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A

Percentage Accurate: 99.4% → 98.8%
Time: 14.7s
Alternatives: 11
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t):
	return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0)))
end
function tmp = code(x, y, z, t)
	tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\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 11 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: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t):
	return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0)))
end
function tmp = code(x, y, z, t)
	tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}

Alternative 1: 98.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z \cdot 2}\\ \left(\left(x \cdot 0.5\right) \cdot t\_1 - t\_1 \cdot y\right) \cdot e^{\frac{t \cdot t}{2}} \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (* z 2.0))))
   (* (- (* (* x 0.5) t_1) (* t_1 y)) (exp (/ (* t t) 2.0)))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z * 2.0));
	return (((x * 0.5) * t_1) - (t_1 * y)) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    t_1 = sqrt((z * 2.0d0))
    code = (((x * 0.5d0) * t_1) - (t_1 * y)) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z * 2.0));
	return (((x * 0.5) * t_1) - (t_1 * y)) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t):
	t_1 = math.sqrt((z * 2.0))
	return (((x * 0.5) * t_1) - (t_1 * y)) * math.exp(((t * t) / 2.0))
function code(x, y, z, t)
	t_1 = sqrt(Float64(z * 2.0))
	return Float64(Float64(Float64(Float64(x * 0.5) * t_1) - Float64(t_1 * y)) * exp(Float64(Float64(t * t) / 2.0)))
end
function tmp = code(x, y, z, t)
	t_1 = sqrt((z * 2.0));
	tmp = (((x * 0.5) * t_1) - (t_1 * y)) * exp(((t * t) / 2.0));
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(x * 0.5), $MachinePrecision] * t$95$1), $MachinePrecision] - N[(t$95$1 * y), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\left(\left(x \cdot 0.5\right) \cdot t\_1 - t\_1 \cdot y\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative99.8%

      \[\leadsto \color{blue}{\left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    2. sub-neg99.8%

      \[\leadsto \left(\sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 + \left(-y\right)\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    3. distribute-rgt-in99.8%

      \[\leadsto \color{blue}{\left(\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-y\right) \cdot \sqrt{z \cdot 2}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
  4. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\left(\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-y\right) \cdot \sqrt{z \cdot 2}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
  5. Final simplification99.8%

    \[\leadsto \left(\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \sqrt{z \cdot 2} \cdot y\right) \cdot e^{\frac{t \cdot t}{2}} \]
  6. Add Preprocessing

Alternative 2: 59.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z \cdot 2}\\ t_2 := x \cdot 0.5 - y\\ \mathbf{if}\;t \leq 4.2 \cdot 10^{+19}:\\ \;\;\;\;t\_1 \cdot t\_2\\ \mathbf{elif}\;t \leq 8 \cdot 10^{+210}:\\ \;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot {t\_2}^{2}}\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (* z 2.0))) (t_2 (- (* x 0.5) y)))
   (if (<= t 4.2e+19)
     (* t_1 t_2)
     (if (<= t 8e+210)
       (sqrt (* (* z 2.0) (pow t_2 2.0)))
       (* t_1 (* x (- 0.5 (/ y x))))))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z * 2.0));
	double t_2 = (x * 0.5) - y;
	double tmp;
	if (t <= 4.2e+19) {
		tmp = t_1 * t_2;
	} else if (t <= 8e+210) {
		tmp = sqrt(((z * 2.0) * pow(t_2, 2.0)));
	} else {
		tmp = t_1 * (x * (0.5 - (y / x)));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_1 = sqrt((z * 2.0d0))
    t_2 = (x * 0.5d0) - y
    if (t <= 4.2d+19) then
        tmp = t_1 * t_2
    else if (t <= 8d+210) then
        tmp = sqrt(((z * 2.0d0) * (t_2 ** 2.0d0)))
    else
        tmp = t_1 * (x * (0.5d0 - (y / x)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z * 2.0));
	double t_2 = (x * 0.5) - y;
	double tmp;
	if (t <= 4.2e+19) {
		tmp = t_1 * t_2;
	} else if (t <= 8e+210) {
		tmp = Math.sqrt(((z * 2.0) * Math.pow(t_2, 2.0)));
	} else {
		tmp = t_1 * (x * (0.5 - (y / x)));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.sqrt((z * 2.0))
	t_2 = (x * 0.5) - y
	tmp = 0
	if t <= 4.2e+19:
		tmp = t_1 * t_2
	elif t <= 8e+210:
		tmp = math.sqrt(((z * 2.0) * math.pow(t_2, 2.0)))
	else:
		tmp = t_1 * (x * (0.5 - (y / x)))
	return tmp
function code(x, y, z, t)
	t_1 = sqrt(Float64(z * 2.0))
	t_2 = Float64(Float64(x * 0.5) - y)
	tmp = 0.0
	if (t <= 4.2e+19)
		tmp = Float64(t_1 * t_2);
	elseif (t <= 8e+210)
		tmp = sqrt(Float64(Float64(z * 2.0) * (t_2 ^ 2.0)));
	else
		tmp = Float64(t_1 * Float64(x * Float64(0.5 - Float64(y / x))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z * 2.0));
	t_2 = (x * 0.5) - y;
	tmp = 0.0;
	if (t <= 4.2e+19)
		tmp = t_1 * t_2;
	elseif (t <= 8e+210)
		tmp = sqrt(((z * 2.0) * (t_2 ^ 2.0)));
	else
		tmp = t_1 * (x * (0.5 - (y / x)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 4.2e+19], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t, 8e+210], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$1 * N[(x * N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
t_2 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 4.2 \cdot 10^{+19}:\\
\;\;\;\;t\_1 \cdot t\_2\\

\mathbf{elif}\;t \leq 8 \cdot 10^{+210}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot {t\_2}^{2}}\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t < 4.2e19

    1. Initial program 99.7%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 69.9%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. *-rgt-identity69.9%

        \[\leadsto \color{blue}{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}} \]
      2. *-commutative69.9%

        \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)} \]
      3. sub-neg69.9%

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 + \left(-y\right)\right)} \]
      4. sub-neg69.9%

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 - y\right)} \]
      5. add-sqr-sqrt38.8%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y} \cdot \sqrt{y}}\right) \]
      6. sqrt-unprod55.0%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y \cdot y}}\right) \]
      7. sqr-neg55.0%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \sqrt{\color{blue}{\left(-y\right) \cdot \left(-y\right)}}\right) \]
      8. sqrt-unprod19.4%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}\right) \]
      9. add-sqr-sqrt42.0%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\left(-y\right)}\right) \]
      10. distribute-rgt-out--42.0%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \left(-y\right) \cdot \sqrt{z \cdot 2}} \]
      11. *-commutative42.0%

        \[\leadsto \left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \color{blue}{\sqrt{z \cdot 2} \cdot \left(-y\right)} \]
      12. cancel-sign-sub-inv42.0%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right)} \]
      13. associate-*l*42.0%

        \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right)} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right) \]
      14. add-sqr-sqrt19.4%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \]
      15. sqrt-unprod55.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} \]
      16. sqr-neg55.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \sqrt{\color{blue}{y \cdot y}} \]
      17. sqrt-unprod38.8%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      18. add-sqr-sqrt70.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{y} \]
    5. Applied egg-rr70.0%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot y} \]
    6. Step-by-step derivation
      1. fma-define70.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, \left(-\sqrt{z \cdot 2}\right) \cdot y\right)} \]
      2. distribute-lft-neg-out70.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, \color{blue}{-\sqrt{z \cdot 2} \cdot y}\right) \]
      3. add-sqr-sqrt70.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\sqrt{\color{blue}{\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}}} \cdot y\right) \]
      4. sqr-neg70.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\sqrt{\color{blue}{\left(-\sqrt{z \cdot 2}\right) \cdot \left(-\sqrt{z \cdot 2}\right)}} \cdot y\right) \]
      5. sqrt-unprod0.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\color{blue}{\left(\sqrt{-\sqrt{z \cdot 2}} \cdot \sqrt{-\sqrt{z \cdot 2}}\right)} \cdot y\right) \]
      6. add-sqr-sqrt42.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\color{blue}{\left(-\sqrt{z \cdot 2}\right)} \cdot y\right) \]
      7. fma-neg42.0%

        \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \left(-\sqrt{z \cdot 2}\right) \cdot y} \]
      8. *-commutative42.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \color{blue}{y \cdot \left(-\sqrt{z \cdot 2}\right)} \]
      9. add-sqr-sqrt0.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \color{blue}{\left(\sqrt{-\sqrt{z \cdot 2}} \cdot \sqrt{-\sqrt{z \cdot 2}}\right)} \]
      10. sqrt-unprod70.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \color{blue}{\sqrt{\left(-\sqrt{z \cdot 2}\right) \cdot \left(-\sqrt{z \cdot 2}\right)}} \]
      11. sqr-neg70.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{\color{blue}{\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}}} \]
      12. add-sqr-sqrt70.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{\color{blue}{z \cdot 2}} \]
    7. Applied egg-rr70.0%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{z \cdot 2}} \]
    8. Step-by-step derivation
      1. associate-*r*70.0%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2}} - y \cdot \sqrt{z \cdot 2} \]
      2. *-commutative70.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot x\right)} \cdot \sqrt{z \cdot 2} - y \cdot \sqrt{z \cdot 2} \]
      3. distribute-rgt-out--69.9%

        \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(0.5 \cdot x - y\right)} \]
    9. Simplified69.9%

      \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(0.5 \cdot x - y\right)} \]

    if 4.2e19 < t < 7.99999999999999942e210

    1. Initial program 100.0%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 15.1%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. add-sqr-sqrt5.5%

        \[\leadsto \color{blue}{\left(\sqrt{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}} \cdot \sqrt{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}}\right)} \cdot 1 \]
      2. sqrt-unprod34.4%

        \[\leadsto \color{blue}{\sqrt{\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right)}} \cdot 1 \]
      3. *-commutative34.4%

        \[\leadsto \sqrt{\color{blue}{\left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right)} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right)} \cdot 1 \]
      4. *-commutative34.4%

        \[\leadsto \sqrt{\left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right) \cdot \color{blue}{\left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right)}} \cdot 1 \]
      5. swap-sqr42.4%

        \[\leadsto \sqrt{\color{blue}{\left(\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}\right) \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \left(x \cdot 0.5 - y\right)\right)}} \cdot 1 \]
      6. add-sqr-sqrt42.4%

        \[\leadsto \sqrt{\color{blue}{\left(z \cdot 2\right)} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \left(x \cdot 0.5 - y\right)\right)} \cdot 1 \]
      7. pow242.4%

        \[\leadsto \sqrt{\left(z \cdot 2\right) \cdot \color{blue}{{\left(x \cdot 0.5 - y\right)}^{2}}} \cdot 1 \]
    5. Applied egg-rr42.4%

      \[\leadsto \color{blue}{\sqrt{\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}}} \cdot 1 \]

    if 7.99999999999999942e210 < t

    1. Initial program 100.0%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 16.3%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Taylor expanded in x around inf 28.1%

      \[\leadsto \left(\color{blue}{\left(x \cdot \left(0.5 + -1 \cdot \frac{y}{x}\right)\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    5. Step-by-step derivation
      1. mul-1-neg28.1%

        \[\leadsto \left(\left(x \cdot \left(0.5 + \color{blue}{\left(-\frac{y}{x}\right)}\right)\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
      2. unsub-neg28.1%

        \[\leadsto \left(\left(x \cdot \color{blue}{\left(0.5 - \frac{y}{x}\right)}\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    6. Simplified28.1%

      \[\leadsto \left(\color{blue}{\left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification60.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 4.2 \cdot 10^{+19}:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\\ \mathbf{elif}\;t \leq 8 \cdot 10^{+210}:\\ \;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 69.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z \cdot 2}\\ \mathbf{if}\;t \leq 3 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \left(0.5 \cdot t\_1\right) - t\_1 \cdot y\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(t\_1 \cdot \left(-y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (* z 2.0))))
   (if (<= t 3e-13)
     (- (* x (* 0.5 t_1)) (* t_1 y))
     (* (exp (/ (* t t) 2.0)) (* t_1 (- y))))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z * 2.0));
	double tmp;
	if (t <= 3e-13) {
		tmp = (x * (0.5 * t_1)) - (t_1 * y);
	} else {
		tmp = exp(((t * t) / 2.0)) * (t_1 * -y);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((z * 2.0d0))
    if (t <= 3d-13) then
        tmp = (x * (0.5d0 * t_1)) - (t_1 * y)
    else
        tmp = exp(((t * t) / 2.0d0)) * (t_1 * -y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z * 2.0));
	double tmp;
	if (t <= 3e-13) {
		tmp = (x * (0.5 * t_1)) - (t_1 * y);
	} else {
		tmp = Math.exp(((t * t) / 2.0)) * (t_1 * -y);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.sqrt((z * 2.0))
	tmp = 0
	if t <= 3e-13:
		tmp = (x * (0.5 * t_1)) - (t_1 * y)
	else:
		tmp = math.exp(((t * t) / 2.0)) * (t_1 * -y)
	return tmp
function code(x, y, z, t)
	t_1 = sqrt(Float64(z * 2.0))
	tmp = 0.0
	if (t <= 3e-13)
		tmp = Float64(Float64(x * Float64(0.5 * t_1)) - Float64(t_1 * y));
	else
		tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(t_1 * Float64(-y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z * 2.0));
	tmp = 0.0;
	if (t <= 3e-13)
		tmp = (x * (0.5 * t_1)) - (t_1 * y);
	else
		tmp = exp(((t * t) / 2.0)) * (t_1 * -y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 3e-13], N[(N[(x * N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * y), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 3 \cdot 10^{-13}:\\
\;\;\;\;x \cdot \left(0.5 \cdot t\_1\right) - t\_1 \cdot y\\

\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(t\_1 \cdot \left(-y\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 2.99999999999999984e-13

    1. Initial program 99.7%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 70.9%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. *-rgt-identity70.9%

        \[\leadsto \color{blue}{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}} \]
      2. *-commutative70.9%

        \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)} \]
      3. sub-neg70.9%

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 + \left(-y\right)\right)} \]
      4. sub-neg70.9%

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 - y\right)} \]
      5. add-sqr-sqrt39.1%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y} \cdot \sqrt{y}}\right) \]
      6. sqrt-unprod55.7%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y \cdot y}}\right) \]
      7. sqr-neg55.7%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \sqrt{\color{blue}{\left(-y\right) \cdot \left(-y\right)}}\right) \]
      8. sqrt-unprod19.8%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}\right) \]
      9. add-sqr-sqrt42.9%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\left(-y\right)}\right) \]
      10. distribute-rgt-out--42.9%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \left(-y\right) \cdot \sqrt{z \cdot 2}} \]
      11. *-commutative42.9%

        \[\leadsto \left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \color{blue}{\sqrt{z \cdot 2} \cdot \left(-y\right)} \]
      12. cancel-sign-sub-inv42.9%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right)} \]
      13. associate-*l*42.9%

        \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right)} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right) \]
      14. add-sqr-sqrt19.8%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \]
      15. sqrt-unprod55.7%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} \]
      16. sqr-neg55.7%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \sqrt{\color{blue}{y \cdot y}} \]
      17. sqrt-unprod39.1%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      18. add-sqr-sqrt70.9%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{y} \]
    5. Applied egg-rr70.9%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot y} \]

    if 2.99999999999999984e-13 < t

    1. Initial program 100.0%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \color{blue}{\left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
      2. sub-neg100.0%

        \[\leadsto \left(\sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 + \left(-y\right)\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      3. distribute-rgt-in100.0%

        \[\leadsto \color{blue}{\left(\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-y\right) \cdot \sqrt{z \cdot 2}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-y\right) \cdot \sqrt{z \cdot 2}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    5. Taylor expanded in z around inf 98.6%

      \[\leadsto \color{blue}{\left(z \cdot \left(-1 \cdot \left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{z}}\right) + 0.5 \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{z}}\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    6. Step-by-step derivation
      1. associate-*r*98.6%

        \[\leadsto \left(z \cdot \left(\color{blue}{\left(-1 \cdot \left(y \cdot \sqrt{2}\right)\right) \cdot \sqrt{\frac{1}{z}}} + 0.5 \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{z}}\right)\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
      2. associate-*r*98.6%

        \[\leadsto \left(z \cdot \left(\left(-1 \cdot \left(y \cdot \sqrt{2}\right)\right) \cdot \sqrt{\frac{1}{z}} + \color{blue}{\left(0.5 \cdot \left(x \cdot \sqrt{2}\right)\right) \cdot \sqrt{\frac{1}{z}}}\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
      3. distribute-rgt-out100.0%

        \[\leadsto \left(z \cdot \color{blue}{\left(\sqrt{\frac{1}{z}} \cdot \left(-1 \cdot \left(y \cdot \sqrt{2}\right) + 0.5 \cdot \left(x \cdot \sqrt{2}\right)\right)\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      4. mul-1-neg100.0%

        \[\leadsto \left(z \cdot \left(\sqrt{\frac{1}{z}} \cdot \left(\color{blue}{\left(-y \cdot \sqrt{2}\right)} + 0.5 \cdot \left(x \cdot \sqrt{2}\right)\right)\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
      5. *-commutative100.0%

        \[\leadsto \left(z \cdot \left(\sqrt{\frac{1}{z}} \cdot \left(\left(-y \cdot \sqrt{2}\right) + 0.5 \cdot \color{blue}{\left(\sqrt{2} \cdot x\right)}\right)\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{\left(z \cdot \left(\sqrt{\frac{1}{z}} \cdot \left(\left(-y \cdot \sqrt{2}\right) + 0.5 \cdot \left(\sqrt{2} \cdot x\right)\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    8. Taylor expanded in y around inf 65.3%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    9. Step-by-step derivation
      1. mul-1-neg65.3%

        \[\leadsto \color{blue}{\left(-\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
      2. rem-square-sqrt27.8%

        \[\leadsto \left(-\color{blue}{\sqrt{\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}} \cdot \sqrt{\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      3. fabs-sqr27.8%

        \[\leadsto \left(-\color{blue}{\left|\sqrt{\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}} \cdot \sqrt{\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}}\right|}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      4. rem-square-sqrt41.7%

        \[\leadsto \left(-\left|\color{blue}{\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}}\right|\right) \cdot e^{\frac{t \cdot t}{2}} \]
      5. rem-sqrt-square34.7%

        \[\leadsto \left(-\color{blue}{\sqrt{\left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \cdot \left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      6. associate-*l*34.7%

        \[\leadsto \left(-\sqrt{\color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right)} \cdot \left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      7. *-commutative34.7%

        \[\leadsto \left(-\sqrt{\left(y \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{2}\right)}\right) \cdot \left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      8. associate-*l*34.7%

        \[\leadsto \left(-\sqrt{\left(y \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      9. *-commutative34.7%

        \[\leadsto \left(-\sqrt{\left(y \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \left(y \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{2}\right)}\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      10. swap-sqr31.9%

        \[\leadsto \left(-\sqrt{\color{blue}{\left(y \cdot y\right) \cdot \left(\left(\sqrt{z} \cdot \sqrt{2}\right) \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      11. swap-sqr31.9%

        \[\leadsto \left(-\sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(\sqrt{2} \cdot \sqrt{2}\right)\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      12. rem-square-sqrt31.9%

        \[\leadsto \left(-\sqrt{\left(y \cdot y\right) \cdot \left(\color{blue}{z} \cdot \left(\sqrt{2} \cdot \sqrt{2}\right)\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      13. rem-square-sqrt31.9%

        \[\leadsto \left(-\sqrt{\left(y \cdot y\right) \cdot \left(z \cdot \color{blue}{2}\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      14. rem-square-sqrt31.9%

        \[\leadsto \left(-\sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      15. swap-sqr34.7%

        \[\leadsto \left(-\sqrt{\color{blue}{\left(y \cdot \sqrt{z \cdot 2}\right) \cdot \left(y \cdot \sqrt{z \cdot 2}\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    10. Simplified65.3%

      \[\leadsto \color{blue}{\left(y \cdot \left(-\sqrt{z \cdot 2}\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 3 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \sqrt{z \cdot 2} \cdot y\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(-y\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 70.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z \cdot 2}\\ \mathbf{if}\;t \leq 3 \cdot 10^{-13}:\\ \;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(t\_1 \cdot \left(-y\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (* z 2.0))))
   (if (<= t 3e-13)
     (* t_1 (- (* x 0.5) y))
     (* (exp (/ (* t t) 2.0)) (* t_1 (- y))))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z * 2.0));
	double tmp;
	if (t <= 3e-13) {
		tmp = t_1 * ((x * 0.5) - y);
	} else {
		tmp = exp(((t * t) / 2.0)) * (t_1 * -y);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((z * 2.0d0))
    if (t <= 3d-13) then
        tmp = t_1 * ((x * 0.5d0) - y)
    else
        tmp = exp(((t * t) / 2.0d0)) * (t_1 * -y)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z * 2.0));
	double tmp;
	if (t <= 3e-13) {
		tmp = t_1 * ((x * 0.5) - y);
	} else {
		tmp = Math.exp(((t * t) / 2.0)) * (t_1 * -y);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.sqrt((z * 2.0))
	tmp = 0
	if t <= 3e-13:
		tmp = t_1 * ((x * 0.5) - y)
	else:
		tmp = math.exp(((t * t) / 2.0)) * (t_1 * -y)
	return tmp
function code(x, y, z, t)
	t_1 = sqrt(Float64(z * 2.0))
	tmp = 0.0
	if (t <= 3e-13)
		tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y));
	else
		tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(t_1 * Float64(-y)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z * 2.0));
	tmp = 0.0;
	if (t <= 3e-13)
		tmp = t_1 * ((x * 0.5) - y);
	else
		tmp = exp(((t * t) / 2.0)) * (t_1 * -y);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 3e-13], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 3 \cdot 10^{-13}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\

\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(t\_1 \cdot \left(-y\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 2.99999999999999984e-13

    1. Initial program 99.7%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 70.9%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. *-rgt-identity70.9%

        \[\leadsto \color{blue}{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}} \]
      2. *-commutative70.9%

        \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)} \]
      3. sub-neg70.9%

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 + \left(-y\right)\right)} \]
      4. sub-neg70.9%

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 - y\right)} \]
      5. add-sqr-sqrt39.1%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y} \cdot \sqrt{y}}\right) \]
      6. sqrt-unprod55.7%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y \cdot y}}\right) \]
      7. sqr-neg55.7%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \sqrt{\color{blue}{\left(-y\right) \cdot \left(-y\right)}}\right) \]
      8. sqrt-unprod19.8%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}\right) \]
      9. add-sqr-sqrt42.9%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\left(-y\right)}\right) \]
      10. distribute-rgt-out--42.9%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \left(-y\right) \cdot \sqrt{z \cdot 2}} \]
      11. *-commutative42.9%

        \[\leadsto \left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \color{blue}{\sqrt{z \cdot 2} \cdot \left(-y\right)} \]
      12. cancel-sign-sub-inv42.9%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right)} \]
      13. associate-*l*42.9%

        \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right)} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right) \]
      14. add-sqr-sqrt19.8%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \]
      15. sqrt-unprod55.7%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} \]
      16. sqr-neg55.7%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \sqrt{\color{blue}{y \cdot y}} \]
      17. sqrt-unprod39.1%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      18. add-sqr-sqrt70.9%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{y} \]
    5. Applied egg-rr70.9%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot y} \]
    6. Step-by-step derivation
      1. fma-define70.9%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, \left(-\sqrt{z \cdot 2}\right) \cdot y\right)} \]
      2. distribute-lft-neg-out70.9%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, \color{blue}{-\sqrt{z \cdot 2} \cdot y}\right) \]
      3. add-sqr-sqrt70.9%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\sqrt{\color{blue}{\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}}} \cdot y\right) \]
      4. sqr-neg70.9%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\sqrt{\color{blue}{\left(-\sqrt{z \cdot 2}\right) \cdot \left(-\sqrt{z \cdot 2}\right)}} \cdot y\right) \]
      5. sqrt-unprod0.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\color{blue}{\left(\sqrt{-\sqrt{z \cdot 2}} \cdot \sqrt{-\sqrt{z \cdot 2}}\right)} \cdot y\right) \]
      6. add-sqr-sqrt42.9%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\color{blue}{\left(-\sqrt{z \cdot 2}\right)} \cdot y\right) \]
      7. fma-neg42.9%

        \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \left(-\sqrt{z \cdot 2}\right) \cdot y} \]
      8. *-commutative42.9%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \color{blue}{y \cdot \left(-\sqrt{z \cdot 2}\right)} \]
      9. add-sqr-sqrt0.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \color{blue}{\left(\sqrt{-\sqrt{z \cdot 2}} \cdot \sqrt{-\sqrt{z \cdot 2}}\right)} \]
      10. sqrt-unprod70.9%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \color{blue}{\sqrt{\left(-\sqrt{z \cdot 2}\right) \cdot \left(-\sqrt{z \cdot 2}\right)}} \]
      11. sqr-neg70.9%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{\color{blue}{\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}}} \]
      12. add-sqr-sqrt70.9%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{\color{blue}{z \cdot 2}} \]
    7. Applied egg-rr70.9%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{z \cdot 2}} \]
    8. Step-by-step derivation
      1. associate-*r*70.9%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2}} - y \cdot \sqrt{z \cdot 2} \]
      2. *-commutative70.9%

        \[\leadsto \color{blue}{\left(0.5 \cdot x\right)} \cdot \sqrt{z \cdot 2} - y \cdot \sqrt{z \cdot 2} \]
      3. distribute-rgt-out--70.9%

        \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(0.5 \cdot x - y\right)} \]
    9. Simplified70.9%

      \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(0.5 \cdot x - y\right)} \]

    if 2.99999999999999984e-13 < t

    1. Initial program 100.0%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative100.0%

        \[\leadsto \color{blue}{\left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
      2. sub-neg100.0%

        \[\leadsto \left(\sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 + \left(-y\right)\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      3. distribute-rgt-in100.0%

        \[\leadsto \color{blue}{\left(\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-y\right) \cdot \sqrt{z \cdot 2}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    4. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\left(\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-y\right) \cdot \sqrt{z \cdot 2}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    5. Taylor expanded in z around inf 98.6%

      \[\leadsto \color{blue}{\left(z \cdot \left(-1 \cdot \left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{z}}\right) + 0.5 \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{z}}\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    6. Step-by-step derivation
      1. associate-*r*98.6%

        \[\leadsto \left(z \cdot \left(\color{blue}{\left(-1 \cdot \left(y \cdot \sqrt{2}\right)\right) \cdot \sqrt{\frac{1}{z}}} + 0.5 \cdot \left(\left(x \cdot \sqrt{2}\right) \cdot \sqrt{\frac{1}{z}}\right)\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
      2. associate-*r*98.6%

        \[\leadsto \left(z \cdot \left(\left(-1 \cdot \left(y \cdot \sqrt{2}\right)\right) \cdot \sqrt{\frac{1}{z}} + \color{blue}{\left(0.5 \cdot \left(x \cdot \sqrt{2}\right)\right) \cdot \sqrt{\frac{1}{z}}}\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
      3. distribute-rgt-out100.0%

        \[\leadsto \left(z \cdot \color{blue}{\left(\sqrt{\frac{1}{z}} \cdot \left(-1 \cdot \left(y \cdot \sqrt{2}\right) + 0.5 \cdot \left(x \cdot \sqrt{2}\right)\right)\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      4. mul-1-neg100.0%

        \[\leadsto \left(z \cdot \left(\sqrt{\frac{1}{z}} \cdot \left(\color{blue}{\left(-y \cdot \sqrt{2}\right)} + 0.5 \cdot \left(x \cdot \sqrt{2}\right)\right)\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
      5. *-commutative100.0%

        \[\leadsto \left(z \cdot \left(\sqrt{\frac{1}{z}} \cdot \left(\left(-y \cdot \sqrt{2}\right) + 0.5 \cdot \color{blue}{\left(\sqrt{2} \cdot x\right)}\right)\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
    7. Simplified100.0%

      \[\leadsto \color{blue}{\left(z \cdot \left(\sqrt{\frac{1}{z}} \cdot \left(\left(-y \cdot \sqrt{2}\right) + 0.5 \cdot \left(\sqrt{2} \cdot x\right)\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    8. Taylor expanded in y around inf 65.3%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    9. Step-by-step derivation
      1. mul-1-neg65.3%

        \[\leadsto \color{blue}{\left(-\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
      2. rem-square-sqrt27.8%

        \[\leadsto \left(-\color{blue}{\sqrt{\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}} \cdot \sqrt{\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      3. fabs-sqr27.8%

        \[\leadsto \left(-\color{blue}{\left|\sqrt{\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}} \cdot \sqrt{\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}}\right|}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      4. rem-square-sqrt41.7%

        \[\leadsto \left(-\left|\color{blue}{\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}}\right|\right) \cdot e^{\frac{t \cdot t}{2}} \]
      5. rem-sqrt-square34.7%

        \[\leadsto \left(-\color{blue}{\sqrt{\left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right) \cdot \left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      6. associate-*l*34.7%

        \[\leadsto \left(-\sqrt{\color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right)} \cdot \left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      7. *-commutative34.7%

        \[\leadsto \left(-\sqrt{\left(y \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{2}\right)}\right) \cdot \left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      8. associate-*l*34.7%

        \[\leadsto \left(-\sqrt{\left(y \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      9. *-commutative34.7%

        \[\leadsto \left(-\sqrt{\left(y \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right) \cdot \left(y \cdot \color{blue}{\left(\sqrt{z} \cdot \sqrt{2}\right)}\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      10. swap-sqr31.9%

        \[\leadsto \left(-\sqrt{\color{blue}{\left(y \cdot y\right) \cdot \left(\left(\sqrt{z} \cdot \sqrt{2}\right) \cdot \left(\sqrt{z} \cdot \sqrt{2}\right)\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      11. swap-sqr31.9%

        \[\leadsto \left(-\sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(\left(\sqrt{z} \cdot \sqrt{z}\right) \cdot \left(\sqrt{2} \cdot \sqrt{2}\right)\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      12. rem-square-sqrt31.9%

        \[\leadsto \left(-\sqrt{\left(y \cdot y\right) \cdot \left(\color{blue}{z} \cdot \left(\sqrt{2} \cdot \sqrt{2}\right)\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      13. rem-square-sqrt31.9%

        \[\leadsto \left(-\sqrt{\left(y \cdot y\right) \cdot \left(z \cdot \color{blue}{2}\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      14. rem-square-sqrt31.9%

        \[\leadsto \left(-\sqrt{\left(y \cdot y\right) \cdot \color{blue}{\left(\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
      15. swap-sqr34.7%

        \[\leadsto \left(-\sqrt{\color{blue}{\left(y \cdot \sqrt{z \cdot 2}\right) \cdot \left(y \cdot \sqrt{z \cdot 2}\right)}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    10. Simplified65.3%

      \[\leadsto \color{blue}{\left(y \cdot \left(-\sqrt{z \cdot 2}\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 3 \cdot 10^{-13}:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(-y\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (exp (/ (* t t) 2.0)) (* (sqrt (* z 2.0)) (- (* x 0.5) y))))
double code(double x, double y, double z, double t) {
	return exp(((t * t) / 2.0)) * (sqrt((z * 2.0)) * ((x * 0.5) - y));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = exp(((t * t) / 2.0d0)) * (sqrt((z * 2.0d0)) * ((x * 0.5d0) - y))
end function
public static double code(double x, double y, double z, double t) {
	return Math.exp(((t * t) / 2.0)) * (Math.sqrt((z * 2.0)) * ((x * 0.5) - y));
}
def code(x, y, z, t):
	return math.exp(((t * t) / 2.0)) * (math.sqrt((z * 2.0)) * ((x * 0.5) - y))
function code(x, y, z, t)
	return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y)))
end
function tmp = code(x, y, z, t)
	tmp = exp(((t * t) / 2.0)) * (sqrt((z * 2.0)) * ((x * 0.5) - y));
end
code[x_, y_, z_, t_] := N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  2. Add Preprocessing
  3. Final simplification99.8%

    \[\leadsto e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right) \]
  4. Add Preprocessing

Alternative 6: 42.3% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z \cdot 2}\\ \mathbf{if}\;x \leq -2.3 \lor \neg \left(x \leq 4.8 \cdot 10^{-31}\right):\\ \;\;\;\;\left(x \cdot 0.5\right) \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(-y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (* z 2.0))))
   (if (or (<= x -2.3) (not (<= x 4.8e-31))) (* (* x 0.5) t_1) (* t_1 (- y)))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z * 2.0));
	double tmp;
	if ((x <= -2.3) || !(x <= 4.8e-31)) {
		tmp = (x * 0.5) * t_1;
	} else {
		tmp = t_1 * -y;
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((z * 2.0d0))
    if ((x <= (-2.3d0)) .or. (.not. (x <= 4.8d-31))) then
        tmp = (x * 0.5d0) * t_1
    else
        tmp = t_1 * -y
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z * 2.0));
	double tmp;
	if ((x <= -2.3) || !(x <= 4.8e-31)) {
		tmp = (x * 0.5) * t_1;
	} else {
		tmp = t_1 * -y;
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.sqrt((z * 2.0))
	tmp = 0
	if (x <= -2.3) or not (x <= 4.8e-31):
		tmp = (x * 0.5) * t_1
	else:
		tmp = t_1 * -y
	return tmp
function code(x, y, z, t)
	t_1 = sqrt(Float64(z * 2.0))
	tmp = 0.0
	if ((x <= -2.3) || !(x <= 4.8e-31))
		tmp = Float64(Float64(x * 0.5) * t_1);
	else
		tmp = Float64(t_1 * Float64(-y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z * 2.0));
	tmp = 0.0;
	if ((x <= -2.3) || ~((x <= 4.8e-31)))
		tmp = (x * 0.5) * t_1;
	else
		tmp = t_1 * -y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[x, -2.3], N[Not[LessEqual[x, 4.8e-31]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * (-y)), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;x \leq -2.3 \lor \neg \left(x \leq 4.8 \cdot 10^{-31}\right):\\
\;\;\;\;\left(x \cdot 0.5\right) \cdot t\_1\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(-y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.2999999999999998 or 4.8e-31 < x

    1. Initial program 99.8%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 60.6%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. add-cbrt-cube50.1%

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \color{blue}{\sqrt[3]{\left(\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}\right) \cdot \sqrt{z \cdot 2}}}\right) \cdot 1 \]
      2. add-sqr-sqrt50.2%

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt[3]{\color{blue}{\left(z \cdot 2\right)} \cdot \sqrt{z \cdot 2}}\right) \cdot 1 \]
      3. pow150.2%

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt[3]{\color{blue}{{\left(z \cdot 2\right)}^{1}} \cdot \sqrt{z \cdot 2}}\right) \cdot 1 \]
      4. pow1/250.2%

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt[3]{{\left(z \cdot 2\right)}^{1} \cdot \color{blue}{{\left(z \cdot 2\right)}^{0.5}}}\right) \cdot 1 \]
      5. pow-prod-up50.2%

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt[3]{\color{blue}{{\left(z \cdot 2\right)}^{\left(1 + 0.5\right)}}}\right) \cdot 1 \]
      6. metadata-eval50.2%

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt[3]{{\left(z \cdot 2\right)}^{\color{blue}{1.5}}}\right) \cdot 1 \]
    5. Applied egg-rr50.2%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \color{blue}{\sqrt[3]{{\left(z \cdot 2\right)}^{1.5}}}\right) \cdot 1 \]
    6. Taylor expanded in x around inf 42.0%

      \[\leadsto \left(\color{blue}{\left(0.5 \cdot x\right)} \cdot \sqrt[3]{{\left(z \cdot 2\right)}^{1.5}}\right) \cdot 1 \]
    7. Step-by-step derivation
      1. *-rgt-identity42.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot x\right) \cdot \sqrt[3]{{\left(z \cdot 2\right)}^{1.5}}} \]
      2. *-commutative42.0%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right)} \cdot \sqrt[3]{{\left(z \cdot 2\right)}^{1.5}} \]
      3. pow1/340.4%

        \[\leadsto \left(x \cdot 0.5\right) \cdot \color{blue}{{\left({\left(z \cdot 2\right)}^{1.5}\right)}^{0.3333333333333333}} \]
      4. pow-pow52.4%

        \[\leadsto \left(x \cdot 0.5\right) \cdot \color{blue}{{\left(z \cdot 2\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}} \]
      5. metadata-eval52.4%

        \[\leadsto \left(x \cdot 0.5\right) \cdot {\left(z \cdot 2\right)}^{\color{blue}{0.5}} \]
      6. pow1/252.4%

        \[\leadsto \left(x \cdot 0.5\right) \cdot \color{blue}{\sqrt{z \cdot 2}} \]
      7. pow152.4%

        \[\leadsto \color{blue}{{\left(\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2}\right)}^{1}} \]
      8. *-commutative52.4%

        \[\leadsto {\left(\color{blue}{\left(0.5 \cdot x\right)} \cdot \sqrt{z \cdot 2}\right)}^{1} \]
      9. associate-*r*52.4%

        \[\leadsto {\color{blue}{\left(0.5 \cdot \left(x \cdot \sqrt{z \cdot 2}\right)\right)}}^{1} \]
    8. Applied egg-rr52.4%

      \[\leadsto \color{blue}{{\left(0.5 \cdot \left(x \cdot \sqrt{z \cdot 2}\right)\right)}^{1}} \]
    9. Step-by-step derivation
      1. unpow152.4%

        \[\leadsto \color{blue}{0.5 \cdot \left(x \cdot \sqrt{z \cdot 2}\right)} \]
      2. associate-*r*52.4%

        \[\leadsto \color{blue}{\left(0.5 \cdot x\right) \cdot \sqrt{z \cdot 2}} \]
      3. *-commutative52.4%

        \[\leadsto \left(0.5 \cdot x\right) \cdot \sqrt{\color{blue}{2 \cdot z}} \]
    10. Simplified52.4%

      \[\leadsto \color{blue}{\left(0.5 \cdot x\right) \cdot \sqrt{2 \cdot z}} \]

    if -2.2999999999999998 < x < 4.8e-31

    1. Initial program 99.8%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 49.3%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Taylor expanded in x around 0 38.0%

      \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    5. Step-by-step derivation
      1. mul-1-neg38.0%

        \[\leadsto \left(\color{blue}{\left(-y\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    6. Simplified38.0%

      \[\leadsto \left(\color{blue}{\left(-y\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    7. Step-by-step derivation
      1. *-rgt-identity38.0%

        \[\leadsto \color{blue}{\left(-y\right) \cdot \sqrt{z \cdot 2}} \]
      2. distribute-lft-neg-out38.0%

        \[\leadsto \color{blue}{-y \cdot \sqrt{z \cdot 2}} \]
    8. Applied egg-rr38.0%

      \[\leadsto \color{blue}{-y \cdot \sqrt{z \cdot 2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.3 \lor \neg \left(x \leq 4.8 \cdot 10^{-31}\right):\\ \;\;\;\;\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(-y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 58.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z \cdot 2}\\ \mathbf{if}\;t \leq 0.025:\\ \;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (* z 2.0))))
   (if (<= t 0.025) (* t_1 (- (* x 0.5) y)) (* t_1 (* x (- 0.5 (/ y x)))))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z * 2.0));
	double tmp;
	if (t <= 0.025) {
		tmp = t_1 * ((x * 0.5) - y);
	} else {
		tmp = t_1 * (x * (0.5 - (y / x)));
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((z * 2.0d0))
    if (t <= 0.025d0) then
        tmp = t_1 * ((x * 0.5d0) - y)
    else
        tmp = t_1 * (x * (0.5d0 - (y / x)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z * 2.0));
	double tmp;
	if (t <= 0.025) {
		tmp = t_1 * ((x * 0.5) - y);
	} else {
		tmp = t_1 * (x * (0.5 - (y / x)));
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.sqrt((z * 2.0))
	tmp = 0
	if t <= 0.025:
		tmp = t_1 * ((x * 0.5) - y)
	else:
		tmp = t_1 * (x * (0.5 - (y / x)))
	return tmp
function code(x, y, z, t)
	t_1 = sqrt(Float64(z * 2.0))
	tmp = 0.0
	if (t <= 0.025)
		tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y));
	else
		tmp = Float64(t_1 * Float64(x * Float64(0.5 - Float64(y / x))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z * 2.0));
	tmp = 0.0;
	if (t <= 0.025)
		tmp = t_1 * ((x * 0.5) - y);
	else
		tmp = t_1 * (x * (0.5 - (y / x)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 0.025], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(x * N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 0.025:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 0.025000000000000001

    1. Initial program 99.7%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 71.0%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. *-rgt-identity71.0%

        \[\leadsto \color{blue}{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}} \]
      2. *-commutative71.0%

        \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)} \]
      3. sub-neg71.0%

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 + \left(-y\right)\right)} \]
      4. sub-neg71.0%

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 - y\right)} \]
      5. add-sqr-sqrt39.4%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y} \cdot \sqrt{y}}\right) \]
      6. sqrt-unprod55.9%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y \cdot y}}\right) \]
      7. sqr-neg55.9%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \sqrt{\color{blue}{\left(-y\right) \cdot \left(-y\right)}}\right) \]
      8. sqrt-unprod19.7%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}\right) \]
      9. add-sqr-sqrt42.6%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\left(-y\right)}\right) \]
      10. distribute-rgt-out--42.6%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \left(-y\right) \cdot \sqrt{z \cdot 2}} \]
      11. *-commutative42.6%

        \[\leadsto \left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \color{blue}{\sqrt{z \cdot 2} \cdot \left(-y\right)} \]
      12. cancel-sign-sub-inv42.6%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right)} \]
      13. associate-*l*42.6%

        \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right)} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right) \]
      14. add-sqr-sqrt19.7%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \]
      15. sqrt-unprod55.9%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} \]
      16. sqr-neg55.9%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \sqrt{\color{blue}{y \cdot y}} \]
      17. sqrt-unprod39.4%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      18. add-sqr-sqrt71.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{y} \]
    5. Applied egg-rr71.0%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot y} \]
    6. Step-by-step derivation
      1. fma-define71.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, \left(-\sqrt{z \cdot 2}\right) \cdot y\right)} \]
      2. distribute-lft-neg-out71.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, \color{blue}{-\sqrt{z \cdot 2} \cdot y}\right) \]
      3. add-sqr-sqrt71.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\sqrt{\color{blue}{\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}}} \cdot y\right) \]
      4. sqr-neg71.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\sqrt{\color{blue}{\left(-\sqrt{z \cdot 2}\right) \cdot \left(-\sqrt{z \cdot 2}\right)}} \cdot y\right) \]
      5. sqrt-unprod0.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\color{blue}{\left(\sqrt{-\sqrt{z \cdot 2}} \cdot \sqrt{-\sqrt{z \cdot 2}}\right)} \cdot y\right) \]
      6. add-sqr-sqrt42.6%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\color{blue}{\left(-\sqrt{z \cdot 2}\right)} \cdot y\right) \]
      7. fma-neg42.6%

        \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \left(-\sqrt{z \cdot 2}\right) \cdot y} \]
      8. *-commutative42.6%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \color{blue}{y \cdot \left(-\sqrt{z \cdot 2}\right)} \]
      9. add-sqr-sqrt0.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \color{blue}{\left(\sqrt{-\sqrt{z \cdot 2}} \cdot \sqrt{-\sqrt{z \cdot 2}}\right)} \]
      10. sqrt-unprod71.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \color{blue}{\sqrt{\left(-\sqrt{z \cdot 2}\right) \cdot \left(-\sqrt{z \cdot 2}\right)}} \]
      11. sqr-neg71.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{\color{blue}{\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}}} \]
      12. add-sqr-sqrt71.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{\color{blue}{z \cdot 2}} \]
    7. Applied egg-rr71.0%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{z \cdot 2}} \]
    8. Step-by-step derivation
      1. associate-*r*71.0%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2}} - y \cdot \sqrt{z \cdot 2} \]
      2. *-commutative71.0%

        \[\leadsto \color{blue}{\left(0.5 \cdot x\right)} \cdot \sqrt{z \cdot 2} - y \cdot \sqrt{z \cdot 2} \]
      3. distribute-rgt-out--71.0%

        \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(0.5 \cdot x - y\right)} \]
    9. Simplified71.0%

      \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(0.5 \cdot x - y\right)} \]

    if 0.025000000000000001 < t

    1. Initial program 100.0%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 15.2%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Taylor expanded in x around inf 27.2%

      \[\leadsto \left(\color{blue}{\left(x \cdot \left(0.5 + -1 \cdot \frac{y}{x}\right)\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    5. Step-by-step derivation
      1. mul-1-neg27.2%

        \[\leadsto \left(\left(x \cdot \left(0.5 + \color{blue}{\left(-\frac{y}{x}\right)}\right)\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
      2. unsub-neg27.2%

        \[\leadsto \left(\left(x \cdot \color{blue}{\left(0.5 - \frac{y}{x}\right)}\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    6. Simplified27.2%

      \[\leadsto \left(\color{blue}{\left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 0.025:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 57.1% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z \cdot 2}\\ \mathbf{if}\;t \leq 1.45 \cdot 10^{+113}:\\ \;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1 \cdot \left(\frac{y}{x} \cdot \left(-x\right)\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (* z 2.0))))
   (if (<= t 1.45e+113) (* t_1 (- (* x 0.5) y)) (* t_1 (* (/ y x) (- x))))))
double code(double x, double y, double z, double t) {
	double t_1 = sqrt((z * 2.0));
	double tmp;
	if (t <= 1.45e+113) {
		tmp = t_1 * ((x * 0.5) - y);
	} else {
		tmp = t_1 * ((y / x) * -x);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: t_1
    real(8) :: tmp
    t_1 = sqrt((z * 2.0d0))
    if (t <= 1.45d+113) then
        tmp = t_1 * ((x * 0.5d0) - y)
    else
        tmp = t_1 * ((y / x) * -x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double t_1 = Math.sqrt((z * 2.0));
	double tmp;
	if (t <= 1.45e+113) {
		tmp = t_1 * ((x * 0.5) - y);
	} else {
		tmp = t_1 * ((y / x) * -x);
	}
	return tmp;
}
def code(x, y, z, t):
	t_1 = math.sqrt((z * 2.0))
	tmp = 0
	if t <= 1.45e+113:
		tmp = t_1 * ((x * 0.5) - y)
	else:
		tmp = t_1 * ((y / x) * -x)
	return tmp
function code(x, y, z, t)
	t_1 = sqrt(Float64(z * 2.0))
	tmp = 0.0
	if (t <= 1.45e+113)
		tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y));
	else
		tmp = Float64(t_1 * Float64(Float64(y / x) * Float64(-x)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z * 2.0));
	tmp = 0.0;
	if (t <= 1.45e+113)
		tmp = t_1 * ((x * 0.5) - y);
	else
		tmp = t_1 * ((y / x) * -x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.45e+113], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(y / x), $MachinePrecision] * (-x)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 1.45 \cdot 10^{+113}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\frac{y}{x} \cdot \left(-x\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < 1.44999999999999992e113

    1. Initial program 99.7%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 65.7%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Step-by-step derivation
      1. *-rgt-identity65.7%

        \[\leadsto \color{blue}{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}} \]
      2. *-commutative65.7%

        \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)} \]
      3. sub-neg65.7%

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 + \left(-y\right)\right)} \]
      4. sub-neg65.7%

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 - y\right)} \]
      5. add-sqr-sqrt36.4%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y} \cdot \sqrt{y}}\right) \]
      6. sqrt-unprod52.3%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y \cdot y}}\right) \]
      7. sqr-neg52.3%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \sqrt{\color{blue}{\left(-y\right) \cdot \left(-y\right)}}\right) \]
      8. sqrt-unprod18.4%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}\right) \]
      9. add-sqr-sqrt39.8%

        \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\left(-y\right)}\right) \]
      10. distribute-rgt-out--39.8%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \left(-y\right) \cdot \sqrt{z \cdot 2}} \]
      11. *-commutative39.8%

        \[\leadsto \left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \color{blue}{\sqrt{z \cdot 2} \cdot \left(-y\right)} \]
      12. cancel-sign-sub-inv39.8%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right)} \]
      13. associate-*l*39.8%

        \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right)} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right) \]
      14. add-sqr-sqrt18.4%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \]
      15. sqrt-unprod52.3%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} \]
      16. sqr-neg52.3%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \sqrt{\color{blue}{y \cdot y}} \]
      17. sqrt-unprod36.4%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
      18. add-sqr-sqrt65.7%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{y} \]
    5. Applied egg-rr65.7%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot y} \]
    6. Step-by-step derivation
      1. fma-define65.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, \left(-\sqrt{z \cdot 2}\right) \cdot y\right)} \]
      2. distribute-lft-neg-out65.7%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, \color{blue}{-\sqrt{z \cdot 2} \cdot y}\right) \]
      3. add-sqr-sqrt65.7%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\sqrt{\color{blue}{\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}}} \cdot y\right) \]
      4. sqr-neg65.7%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\sqrt{\color{blue}{\left(-\sqrt{z \cdot 2}\right) \cdot \left(-\sqrt{z \cdot 2}\right)}} \cdot y\right) \]
      5. sqrt-unprod0.0%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\color{blue}{\left(\sqrt{-\sqrt{z \cdot 2}} \cdot \sqrt{-\sqrt{z \cdot 2}}\right)} \cdot y\right) \]
      6. add-sqr-sqrt39.8%

        \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\color{blue}{\left(-\sqrt{z \cdot 2}\right)} \cdot y\right) \]
      7. fma-neg39.8%

        \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \left(-\sqrt{z \cdot 2}\right) \cdot y} \]
      8. *-commutative39.8%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \color{blue}{y \cdot \left(-\sqrt{z \cdot 2}\right)} \]
      9. add-sqr-sqrt0.0%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \color{blue}{\left(\sqrt{-\sqrt{z \cdot 2}} \cdot \sqrt{-\sqrt{z \cdot 2}}\right)} \]
      10. sqrt-unprod65.7%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \color{blue}{\sqrt{\left(-\sqrt{z \cdot 2}\right) \cdot \left(-\sqrt{z \cdot 2}\right)}} \]
      11. sqr-neg65.7%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{\color{blue}{\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}}} \]
      12. add-sqr-sqrt65.7%

        \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{\color{blue}{z \cdot 2}} \]
    7. Applied egg-rr65.7%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{z \cdot 2}} \]
    8. Step-by-step derivation
      1. associate-*r*65.7%

        \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2}} - y \cdot \sqrt{z \cdot 2} \]
      2. *-commutative65.7%

        \[\leadsto \color{blue}{\left(0.5 \cdot x\right)} \cdot \sqrt{z \cdot 2} - y \cdot \sqrt{z \cdot 2} \]
      3. distribute-rgt-out--65.7%

        \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(0.5 \cdot x - y\right)} \]
    9. Simplified65.7%

      \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(0.5 \cdot x - y\right)} \]

    if 1.44999999999999992e113 < t

    1. Initial program 100.0%

      \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. Add Preprocessing
    3. Taylor expanded in t around 0 15.6%

      \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
    4. Taylor expanded in x around inf 28.3%

      \[\leadsto \left(\color{blue}{\left(x \cdot \left(0.5 + -1 \cdot \frac{y}{x}\right)\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    5. Step-by-step derivation
      1. mul-1-neg28.3%

        \[\leadsto \left(\left(x \cdot \left(0.5 + \color{blue}{\left(-\frac{y}{x}\right)}\right)\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
      2. unsub-neg28.3%

        \[\leadsto \left(\left(x \cdot \color{blue}{\left(0.5 - \frac{y}{x}\right)}\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    6. Simplified28.3%

      \[\leadsto \left(\color{blue}{\left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    7. Taylor expanded in y around inf 21.3%

      \[\leadsto \left(\left(x \cdot \color{blue}{\left(-1 \cdot \frac{y}{x}\right)}\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    8. Step-by-step derivation
      1. neg-mul-121.3%

        \[\leadsto \left(\left(x \cdot \color{blue}{\left(-\frac{y}{x}\right)}\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
      2. distribute-neg-frac221.3%

        \[\leadsto \left(\left(x \cdot \color{blue}{\frac{y}{-x}}\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
    9. Simplified21.3%

      \[\leadsto \left(\left(x \cdot \color{blue}{\frac{y}{-x}}\right) \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification56.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 1.45 \cdot 10^{+113}:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(\frac{y}{x} \cdot \left(-x\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 56.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) (- (* x 0.5) y)))
double code(double x, double y, double z, double t) {
	return sqrt((z * 2.0)) * ((x * 0.5) - y);
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = sqrt((z * 2.0d0)) * ((x * 0.5d0) - y)
end function
public static double code(double x, double y, double z, double t) {
	return Math.sqrt((z * 2.0)) * ((x * 0.5) - y);
}
def code(x, y, z, t):
	return math.sqrt((z * 2.0)) * ((x * 0.5) - y)
function code(x, y, z, t)
	return Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y))
end
function tmp = code(x, y, z, t)
	tmp = sqrt((z * 2.0)) * ((x * 0.5) - y);
end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  2. Add Preprocessing
  3. Taylor expanded in t around 0 55.5%

    \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
  4. Step-by-step derivation
    1. *-rgt-identity55.5%

      \[\leadsto \color{blue}{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}} \]
    2. *-commutative55.5%

      \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)} \]
    3. sub-neg55.5%

      \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 + \left(-y\right)\right)} \]
    4. sub-neg55.5%

      \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 - y\right)} \]
    5. add-sqr-sqrt31.3%

      \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y} \cdot \sqrt{y}}\right) \]
    6. sqrt-unprod46.1%

      \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{y \cdot y}}\right) \]
    7. sqr-neg46.1%

      \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \sqrt{\color{blue}{\left(-y\right) \cdot \left(-y\right)}}\right) \]
    8. sqrt-unprod15.3%

      \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\sqrt{-y} \cdot \sqrt{-y}}\right) \]
    9. add-sqr-sqrt33.7%

      \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - \color{blue}{\left(-y\right)}\right) \]
    10. distribute-rgt-out--33.4%

      \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \left(-y\right) \cdot \sqrt{z \cdot 2}} \]
    11. *-commutative33.4%

      \[\leadsto \left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} - \color{blue}{\sqrt{z \cdot 2} \cdot \left(-y\right)} \]
    12. cancel-sign-sub-inv33.4%

      \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right)} \]
    13. associate-*l*33.4%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right)} + \left(-\sqrt{z \cdot 2}\right) \cdot \left(-y\right) \]
    14. add-sqr-sqrt15.3%

      \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \]
    15. sqrt-unprod46.1%

      \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} \]
    16. sqr-neg46.1%

      \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \sqrt{\color{blue}{y \cdot y}} \]
    17. sqrt-unprod31.3%

      \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \]
    18. add-sqr-sqrt55.5%

      \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot \color{blue}{y} \]
  5. Applied egg-rr55.5%

    \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) + \left(-\sqrt{z \cdot 2}\right) \cdot y} \]
  6. Step-by-step derivation
    1. fma-define55.5%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, \left(-\sqrt{z \cdot 2}\right) \cdot y\right)} \]
    2. distribute-lft-neg-out55.5%

      \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, \color{blue}{-\sqrt{z \cdot 2} \cdot y}\right) \]
    3. add-sqr-sqrt55.5%

      \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\sqrt{\color{blue}{\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}}} \cdot y\right) \]
    4. sqr-neg55.5%

      \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\sqrt{\color{blue}{\left(-\sqrt{z \cdot 2}\right) \cdot \left(-\sqrt{z \cdot 2}\right)}} \cdot y\right) \]
    5. sqrt-unprod0.0%

      \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\color{blue}{\left(\sqrt{-\sqrt{z \cdot 2}} \cdot \sqrt{-\sqrt{z \cdot 2}}\right)} \cdot y\right) \]
    6. add-sqr-sqrt33.4%

      \[\leadsto \mathsf{fma}\left(x, 0.5 \cdot \sqrt{z \cdot 2}, -\color{blue}{\left(-\sqrt{z \cdot 2}\right)} \cdot y\right) \]
    7. fma-neg33.4%

      \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \left(-\sqrt{z \cdot 2}\right) \cdot y} \]
    8. *-commutative33.4%

      \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - \color{blue}{y \cdot \left(-\sqrt{z \cdot 2}\right)} \]
    9. add-sqr-sqrt0.0%

      \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \color{blue}{\left(\sqrt{-\sqrt{z \cdot 2}} \cdot \sqrt{-\sqrt{z \cdot 2}}\right)} \]
    10. sqrt-unprod55.5%

      \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \color{blue}{\sqrt{\left(-\sqrt{z \cdot 2}\right) \cdot \left(-\sqrt{z \cdot 2}\right)}} \]
    11. sqr-neg55.5%

      \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{\color{blue}{\sqrt{z \cdot 2} \cdot \sqrt{z \cdot 2}}} \]
    12. add-sqr-sqrt55.5%

      \[\leadsto x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{\color{blue}{z \cdot 2}} \]
  7. Applied egg-rr55.5%

    \[\leadsto \color{blue}{x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right) - y \cdot \sqrt{z \cdot 2}} \]
  8. Step-by-step derivation
    1. associate-*r*55.5%

      \[\leadsto \color{blue}{\left(x \cdot 0.5\right) \cdot \sqrt{z \cdot 2}} - y \cdot \sqrt{z \cdot 2} \]
    2. *-commutative55.5%

      \[\leadsto \color{blue}{\left(0.5 \cdot x\right)} \cdot \sqrt{z \cdot 2} - y \cdot \sqrt{z \cdot 2} \]
    3. distribute-rgt-out--55.5%

      \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(0.5 \cdot x - y\right)} \]
  9. Simplified55.5%

    \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(0.5 \cdot x - y\right)} \]
  10. Final simplification55.5%

    \[\leadsto \sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right) \]
  11. Add Preprocessing

Alternative 10: 29.6% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \sqrt{z \cdot 2} \cdot \left(-y\right) \end{array} \]
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) (- y)))
double code(double x, double y, double z, double t) {
	return sqrt((z * 2.0)) * -y;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = sqrt((z * 2.0d0)) * -y
end function
public static double code(double x, double y, double z, double t) {
	return Math.sqrt((z * 2.0)) * -y;
}
def code(x, y, z, t):
	return math.sqrt((z * 2.0)) * -y
function code(x, y, z, t)
	return Float64(sqrt(Float64(z * 2.0)) * Float64(-y))
end
function tmp = code(x, y, z, t)
	tmp = sqrt((z * 2.0)) * -y;
end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{z \cdot 2} \cdot \left(-y\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  2. Add Preprocessing
  3. Taylor expanded in t around 0 55.5%

    \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
  4. Taylor expanded in x around 0 23.2%

    \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
  5. Step-by-step derivation
    1. mul-1-neg23.2%

      \[\leadsto \left(\color{blue}{\left(-y\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
  6. Simplified23.2%

    \[\leadsto \left(\color{blue}{\left(-y\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
  7. Step-by-step derivation
    1. *-rgt-identity23.2%

      \[\leadsto \color{blue}{\left(-y\right) \cdot \sqrt{z \cdot 2}} \]
    2. distribute-lft-neg-out23.2%

      \[\leadsto \color{blue}{-y \cdot \sqrt{z \cdot 2}} \]
  8. Applied egg-rr23.2%

    \[\leadsto \color{blue}{-y \cdot \sqrt{z \cdot 2}} \]
  9. Final simplification23.2%

    \[\leadsto \sqrt{z \cdot 2} \cdot \left(-y\right) \]
  10. Add Preprocessing

Alternative 11: 2.5% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \sqrt{z \cdot 2} \cdot y \end{array} \]
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) y))
double code(double x, double y, double z, double t) {
	return sqrt((z * 2.0)) * y;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = sqrt((z * 2.0d0)) * y
end function
public static double code(double x, double y, double z, double t) {
	return Math.sqrt((z * 2.0)) * y;
}
def code(x, y, z, t):
	return math.sqrt((z * 2.0)) * y
function code(x, y, z, t)
	return Float64(sqrt(Float64(z * 2.0)) * y)
end
function tmp = code(x, y, z, t)
	tmp = sqrt((z * 2.0)) * y;
end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}

\\
\sqrt{z \cdot 2} \cdot y
\end{array}
Derivation
  1. Initial program 99.8%

    \[\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  2. Add Preprocessing
  3. Taylor expanded in t around 0 55.5%

    \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \color{blue}{1} \]
  4. Taylor expanded in x around 0 23.2%

    \[\leadsto \left(\color{blue}{\left(-1 \cdot y\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
  5. Step-by-step derivation
    1. mul-1-neg23.2%

      \[\leadsto \left(\color{blue}{\left(-y\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
  6. Simplified23.2%

    \[\leadsto \left(\color{blue}{\left(-y\right)} \cdot \sqrt{z \cdot 2}\right) \cdot 1 \]
  7. Step-by-step derivation
    1. *-rgt-identity23.2%

      \[\leadsto \color{blue}{\left(-y\right) \cdot \sqrt{z \cdot 2}} \]
    2. add-sqr-sqrt9.3%

      \[\leadsto \color{blue}{\left(\sqrt{-y} \cdot \sqrt{-y}\right)} \cdot \sqrt{z \cdot 2} \]
    3. sqrt-unprod15.2%

      \[\leadsto \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} \cdot \sqrt{z \cdot 2} \]
    4. sqr-neg15.2%

      \[\leadsto \sqrt{\color{blue}{y \cdot y}} \cdot \sqrt{z \cdot 2} \]
    5. sqrt-unprod1.4%

      \[\leadsto \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{z \cdot 2} \]
    6. add-sqr-sqrt2.2%

      \[\leadsto \color{blue}{y} \cdot \sqrt{z \cdot 2} \]
    7. pow12.2%

      \[\leadsto \color{blue}{{\left(y \cdot \sqrt{z \cdot 2}\right)}^{1}} \]
  8. Applied egg-rr2.2%

    \[\leadsto \color{blue}{{\left(y \cdot \sqrt{z \cdot 2}\right)}^{1}} \]
  9. Step-by-step derivation
    1. unpow12.2%

      \[\leadsto \color{blue}{y \cdot \sqrt{z \cdot 2}} \]
  10. Simplified2.2%

    \[\leadsto \color{blue}{y \cdot \sqrt{z \cdot 2}} \]
  11. Final simplification2.2%

    \[\leadsto \sqrt{z \cdot 2} \cdot y \]
  12. Add Preprocessing

Developer Target 1: 99.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot {\left(e^{1}\right)}^{\left(\frac{t \cdot t}{2}\right)} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp 1.0) (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * sqrt((z * 2.0))) * pow(exp(1.0), ((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (exp(1.0d0) ** ((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.pow(Math.exp(1.0), ((t * t) / 2.0));
}
def code(x, y, z, t):
	return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.pow(math.exp(1.0), ((t * t) / 2.0))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * (exp(1.0) ^ Float64(Float64(t * t) / 2.0)))
end
function tmp = code(x, y, z, t)
	tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (exp(1.0) ^ ((t * t) / 2.0));
end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[N[Exp[1.0], $MachinePrecision], N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot {\left(e^{1}\right)}^{\left(\frac{t \cdot t}{2}\right)}
\end{array}

Reproduce

?
herbie shell --seed 2024144 
(FPCore (x y z t)
  :name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
  :precision binary64

  :alt
  (! :herbie-platform default (* (* (- (* x 1/2) y) (sqrt (* z 2))) (pow (exp 1) (/ (* t t) 2))))

  (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))