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

Percentage Accurate: 99.5% → 98.9%
Time: 9.9s
Alternatives: 7
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 7 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.5% 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.9% 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. 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}} \]
  3. 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}} \]
  4. 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}} \]

Alternative 2: 37.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \sqrt{z \cdot 2}\\ \mathbf{if}\;t \cdot t \leq 2.1 \cdot 10^{+19}:\\ \;\;\;\;t_1 \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(t_1 \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (sqrt (* z 2.0))))
   (if (<= (* t t) 2.1e+19)
     (* 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 * t) <= 2.1e+19) {
		tmp = 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 * t) <= 2.1d+19) then
        tmp = 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 * t) <= 2.1e+19) {
		tmp = 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 * t) <= 2.1e+19:
		tmp = 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 (Float64(t * t) <= 2.1e+19)
		tmp = Float64(t_1 * Float64(-y));
	else
		tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(t_1 * y));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	t_1 = sqrt((z * 2.0));
	tmp = 0.0;
	if ((t * t) <= 2.1e+19)
		tmp = 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[N[(t * t), $MachinePrecision], 2.1e+19], N[(t$95$1 * (-y)), $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 \cdot t \leq 2.1 \cdot 10^{+19}:\\
\;\;\;\;t_1 \cdot \left(-y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 t t) < 2.1e19

    1. Initial program 99.6%

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

      \[\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}} \]
    3. Step-by-step derivation
      1. mul-1-neg58.5%

        \[\leadsto \color{blue}{\left(-\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
      2. distribute-rgt-neg-in58.5%

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

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

      \[\leadsto \color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \left(-\sqrt{z}\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt0.0%

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

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

        \[\leadsto \left(y \cdot \left(\sqrt{2} \cdot \sqrt{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
      4. add-sqr-sqrt2.9%

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

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

        \[\leadsto \left(y \cdot \sqrt{\color{blue}{z \cdot 2}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    6. Applied egg-rr2.9%

      \[\leadsto \left(y \cdot \color{blue}{\sqrt{z \cdot 2}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    7. Taylor expanded in t around 0 2.9%

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

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

      \[\leadsto \color{blue}{y \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt1.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0 - y \cdot \color{blue}{\sqrt{2 \cdot z}} \]
    11. Applied egg-rr55.3%

      \[\leadsto \color{blue}{0 - y \cdot \sqrt{2 \cdot z}} \]
    12. Step-by-step derivation
      1. neg-sub055.3%

        \[\leadsto \color{blue}{-y \cdot \sqrt{2 \cdot z}} \]
      2. distribute-rgt-neg-in55.3%

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

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

    if 2.1e19 < (*.f64 t 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. Taylor expanded in x around 0 71.5%

      \[\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}} \]
    3. Step-by-step derivation
      1. mul-1-neg71.5%

        \[\leadsto \color{blue}{\left(-\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
      2. distribute-rgt-neg-in71.5%

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

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

      \[\leadsto \color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \left(-\sqrt{z}\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt0.0%

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

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

        \[\leadsto \left(y \cdot \left(\sqrt{2} \cdot \sqrt{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
      4. add-sqr-sqrt25.2%

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

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

        \[\leadsto \left(y \cdot \sqrt{\color{blue}{z \cdot 2}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    6. Applied egg-rr25.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot t \leq 2.1 \cdot 10^{+19}:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot y\right)\\ \end{array} \]

Alternative 3: 99.5% 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. 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) \]

Alternative 4: 62.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(-y\right)\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (exp (/ (* t t) 2.0)) (* (sqrt (* z 2.0)) (- y))))
double code(double x, double y, double z, double t) {
	return exp(((t * t) / 2.0)) * (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 = exp(((t * t) / 2.0d0)) * (sqrt((z * 2.0d0)) * -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)) * -y);
}
def code(x, y, z, t):
	return math.exp(((t * t) / 2.0)) * (math.sqrt((z * 2.0)) * -y)
function code(x, y, z, t)
	return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(sqrt(Float64(z * 2.0)) * Float64(-y)))
end
function tmp = code(x, y, z, t)
	tmp = exp(((t * t) / 2.0)) * (sqrt((z * 2.0)) * -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] * (-y)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(-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. Taylor expanded in x around 0 64.8%

    \[\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}} \]
  3. Step-by-step derivation
    1. mul-1-neg64.8%

      \[\leadsto \color{blue}{\left(-\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    2. distribute-rgt-neg-in64.8%

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

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

    \[\leadsto \color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \left(-\sqrt{z}\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
  5. Step-by-step derivation
    1. *-commutative64.8%

      \[\leadsto \left(y \cdot \color{blue}{\left(\left(-\sqrt{z}\right) \cdot \sqrt{2}\right)}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    2. distribute-lft-neg-out64.8%

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

      \[\leadsto \left(y \cdot \left(-\color{blue}{\sqrt{z \cdot 2}}\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
  6. Applied egg-rr64.9%

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

    \[\leadsto e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(-y\right)\right) \]

Alternative 5: 32.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \leq 250000:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot {y}^{2}}\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (<= t 250000.0)
   (* (sqrt (* z 2.0)) (- y))
   (sqrt (* (* z 2.0) (pow y 2.0)))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= 250000.0) {
		tmp = sqrt((z * 2.0)) * -y;
	} else {
		tmp = sqrt(((z * 2.0) * pow(y, 2.0)));
	}
	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) :: tmp
    if (t <= 250000.0d0) then
        tmp = sqrt((z * 2.0d0)) * -y
    else
        tmp = sqrt(((z * 2.0d0) * (y ** 2.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (t <= 250000.0) {
		tmp = Math.sqrt((z * 2.0)) * -y;
	} else {
		tmp = Math.sqrt(((z * 2.0) * Math.pow(y, 2.0)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if t <= 250000.0:
		tmp = math.sqrt((z * 2.0)) * -y
	else:
		tmp = math.sqrt(((z * 2.0) * math.pow(y, 2.0)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if (t <= 250000.0)
		tmp = Float64(sqrt(Float64(z * 2.0)) * Float64(-y));
	else
		tmp = sqrt(Float64(Float64(z * 2.0) * (y ^ 2.0)));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (t <= 250000.0)
		tmp = sqrt((z * 2.0)) * -y;
	else
		tmp = sqrt(((z * 2.0) * (y ^ 2.0)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[LessEqual[t, 250000.0], N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \leq 250000:\\
\;\;\;\;\sqrt{z \cdot 2} \cdot \left(-y\right)\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot {y}^{2}}\\


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

    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. Taylor expanded in x around 0 62.6%

      \[\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}} \]
    3. Step-by-step derivation
      1. mul-1-neg62.6%

        \[\leadsto \color{blue}{\left(-\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
      2. distribute-rgt-neg-in62.6%

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

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

      \[\leadsto \color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \left(-\sqrt{z}\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt0.0%

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

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

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

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

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

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

      \[\leadsto \left(y \cdot \color{blue}{\sqrt{z \cdot 2}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    7. Taylor expanded in t around 0 2.5%

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

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

      \[\leadsto \color{blue}{y \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)} \]
    10. Step-by-step derivation
      1. add-sqr-sqrt0.8%

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

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

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

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

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

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

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

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

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

        \[\leadsto 0 - y \cdot \color{blue}{\sqrt{2 \cdot z}} \]
    11. Applied egg-rr40.4%

      \[\leadsto \color{blue}{0 - y \cdot \sqrt{2 \cdot z}} \]
    12. Step-by-step derivation
      1. neg-sub040.4%

        \[\leadsto \color{blue}{-y \cdot \sqrt{2 \cdot z}} \]
      2. distribute-rgt-neg-in40.4%

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

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

    if 2.5e5 < 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. Taylor expanded in x around 0 71.4%

      \[\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}} \]
    3. Step-by-step derivation
      1. mul-1-neg71.4%

        \[\leadsto \color{blue}{\left(-\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
      2. distribute-rgt-neg-in71.4%

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

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

      \[\leadsto \color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \left(-\sqrt{z}\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt0.0%

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

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

        \[\leadsto \left(y \cdot \left(\sqrt{2} \cdot \sqrt{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
      4. add-sqr-sqrt23.8%

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

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

        \[\leadsto \left(y \cdot \sqrt{\color{blue}{z \cdot 2}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    6. Applied egg-rr23.8%

      \[\leadsto \left(y \cdot \color{blue}{\sqrt{z \cdot 2}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
    7. Taylor expanded in t around 0 1.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\left(2 \cdot z\right) \cdot \color{blue}{{y}^{2}}} \]
    11. Applied egg-rr16.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 250000:\\ \;\;\;\;\sqrt{z \cdot 2} \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot {y}^{2}}\\ \end{array} \]

Alternative 6: 30.3% 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. Taylor expanded in x around 0 64.8%

    \[\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}} \]
  3. Step-by-step derivation
    1. mul-1-neg64.8%

      \[\leadsto \color{blue}{\left(-\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    2. distribute-rgt-neg-in64.8%

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

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

    \[\leadsto \color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \left(-\sqrt{z}\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
  5. Step-by-step derivation
    1. add-sqr-sqrt0.0%

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

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

      \[\leadsto \left(y \cdot \left(\sqrt{2} \cdot \sqrt{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
    4. add-sqr-sqrt13.6%

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

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

      \[\leadsto \left(y \cdot \sqrt{\color{blue}{z \cdot 2}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  6. Applied egg-rr13.6%

    \[\leadsto \left(y \cdot \color{blue}{\sqrt{z \cdot 2}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  7. Taylor expanded in t around 0 2.1%

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

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

    \[\leadsto \color{blue}{y \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)} \]
  10. Step-by-step derivation
    1. add-sqr-sqrt0.8%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{0 - y \cdot \sqrt{2 \cdot z}} \]
  12. Step-by-step derivation
    1. neg-sub032.8%

      \[\leadsto \color{blue}{-y \cdot \sqrt{2 \cdot z}} \]
    2. distribute-rgt-neg-in32.8%

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

    \[\leadsto \color{blue}{y \cdot \left(-\sqrt{2 \cdot z}\right)} \]
  14. Final simplification32.8%

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

Alternative 7: 2.6% 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. Taylor expanded in x around 0 64.8%

    \[\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}} \]
  3. Step-by-step derivation
    1. mul-1-neg64.8%

      \[\leadsto \color{blue}{\left(-\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    2. distribute-rgt-neg-in64.8%

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

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

    \[\leadsto \color{blue}{\left(y \cdot \left(\sqrt{2} \cdot \left(-\sqrt{z}\right)\right)\right)} \cdot e^{\frac{t \cdot t}{2}} \]
  5. Step-by-step derivation
    1. add-sqr-sqrt0.0%

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

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

      \[\leadsto \left(y \cdot \left(\sqrt{2} \cdot \sqrt{\color{blue}{\sqrt{z} \cdot \sqrt{z}}}\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
    4. add-sqr-sqrt13.6%

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

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

      \[\leadsto \left(y \cdot \sqrt{\color{blue}{z \cdot 2}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  6. Applied egg-rr13.6%

    \[\leadsto \left(y \cdot \color{blue}{\sqrt{z \cdot 2}}\right) \cdot e^{\frac{t \cdot t}{2}} \]
  7. Taylor expanded in t around 0 2.1%

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

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

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

      \[\leadsto y \cdot \color{blue}{\sqrt{2 \cdot z}} \]
    2. expm1-log1p-u2.1%

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

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

    \[\leadsto y \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(\sqrt{2 \cdot z}\right)} - 1\right)} \]
  12. Step-by-step derivation
    1. expm1-def2.1%

      \[\leadsto y \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt{2 \cdot z}\right)\right)} \]
    2. expm1-log1p2.1%

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

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

    \[\leadsto \sqrt{z \cdot 2} \cdot y \]

Developer target: 99.5% 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 2023310 
(FPCore (x y z t)
  :name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
  :precision binary64

  :herbie-target
  (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp 1.0) (/ (* t t) 2.0)))

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