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

Percentage Accurate: 99.2% → 99.2%
Time: 12.3s
Alternatives: 8
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 8 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.2% 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: 99.2% 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}{\frac{-2}{t}}} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (- (/ t (/ -2.0 t))))))
double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(-(t / (-2.0 / t)));
}
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 / ((-2.0d0) / t)))
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 / (-2.0 / t)));
}
def code(x, y, z, t):
	return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(-(t / (-2.0 / t)))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(-Float64(t / Float64(-2.0 / t)))))
end
function tmp = code(x, y, z, t)
	tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(-(t / (-2.0 / t)));
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[(t / N[(-2.0 / t), $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{-\frac{t}{\frac{-2}{t}}}
\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. frac-2neg99.8%

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

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

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

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

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

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

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

Alternative 2: 91.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t \cdot t \leq 200 \lor \neg \left(t \cdot t \leq 2 \cdot 10^{+230}\right):\\ \;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(1 + t \cdot \left(0.5 \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(x \cdot \sqrt{0.5 \cdot z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (if (or (<= (* t t) 200.0) (not (<= (* t t) 2e+230)))
   (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (+ 1.0 (* t (* 0.5 t))))
   (* (exp (/ (* t t) 2.0)) (* x (sqrt (* 0.5 z))))))
double code(double x, double y, double z, double t) {
	double tmp;
	if (((t * t) <= 200.0) || !((t * t) <= 2e+230)) {
		tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)));
	} else {
		tmp = exp(((t * t) / 2.0)) * (x * sqrt((0.5 * z)));
	}
	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 * t) <= 200.0d0) .or. (.not. ((t * t) <= 2d+230))) then
        tmp = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (1.0d0 + (t * (0.5d0 * t)))
    else
        tmp = exp(((t * t) / 2.0d0)) * (x * sqrt((0.5d0 * z)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z, double t) {
	double tmp;
	if (((t * t) <= 200.0) || !((t * t) <= 2e+230)) {
		tmp = (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)));
	} else {
		tmp = Math.exp(((t * t) / 2.0)) * (x * Math.sqrt((0.5 * z)));
	}
	return tmp;
}
def code(x, y, z, t):
	tmp = 0
	if ((t * t) <= 200.0) or not ((t * t) <= 2e+230):
		tmp = (((x * 0.5) - y) * math.sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)))
	else:
		tmp = math.exp(((t * t) / 2.0)) * (x * math.sqrt((0.5 * z)))
	return tmp
function code(x, y, z, t)
	tmp = 0.0
	if ((Float64(t * t) <= 200.0) || !(Float64(t * t) <= 2e+230))
		tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * Float64(1.0 + Float64(t * Float64(0.5 * t))));
	else
		tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(x * sqrt(Float64(0.5 * z))));
	end
	return tmp
end
function tmp_2 = code(x, y, z, t)
	tmp = 0.0;
	if (((t * t) <= 200.0) || ~(((t * t) <= 2e+230)))
		tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)));
	else
		tmp = exp(((t * t) / 2.0)) * (x * sqrt((0.5 * z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(t * t), $MachinePrecision], 200.0], N[Not[LessEqual[N[(t * t), $MachinePrecision], 2e+230]], $MachinePrecision]], N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(t * N[(0.5 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 200 \lor \neg \left(t \cdot t \leq 2 \cdot 10^{+230}\right):\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(1 + t \cdot \left(0.5 \cdot t\right)\right)\\

\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(x \cdot \sqrt{0.5 \cdot z}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 t t) < 200 or 2.0000000000000002e230 < (*.f64 t t)

    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 t around 0 98.0%

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

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

        \[\leadsto \left(x \cdot \sqrt{z \cdot 0.5}\right) \cdot \left(1 + \color{blue}{\left(0.5 \cdot t\right) \cdot t}\right) \]
      3. *-commutative59.3%

        \[\leadsto \left(x \cdot \sqrt{z \cdot 0.5}\right) \cdot \left(1 + \color{blue}{t \cdot \left(0.5 \cdot t\right)}\right) \]
    4. Simplified98.0%

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

    if 200 < (*.f64 t t) < 2.0000000000000002e230

    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. Step-by-step derivation
      1. add-sqr-sqrt44.0%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      2. sqrt-unprod42.0%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      3. *-commutative42.0%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      4. *-commutative42.0%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      5. swap-sqr42.0%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      6. add-sqr-sqrt42.0%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      7. pow242.0%

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

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

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

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

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

      \[\leadsto \sqrt{\color{blue}{\left(0.5 \cdot z\right) \cdot \left(x \cdot x\right)}} \cdot e^{\frac{t \cdot t}{2}} \]
    7. Step-by-step derivation
      1. sqrt-prod21.1%

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

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

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

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

        \[\leadsto \left(\color{blue}{\left|x\right|} \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
      3. unpow19.8%

        \[\leadsto \left(\left|\color{blue}{{x}^{1}}\right| \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
      4. sqr-pow9.4%

        \[\leadsto \left(\left|\color{blue}{{x}^{\left(\frac{1}{2}\right)} \cdot {x}^{\left(\frac{1}{2}\right)}}\right| \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
      5. fabs-sqr9.4%

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

        \[\leadsto \left(\color{blue}{{x}^{1}} \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
      7. unpow114.9%

        \[\leadsto \left(\color{blue}{x} \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
    10. Simplified84.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \cdot t \leq 200 \lor \neg \left(t \cdot t \leq 2 \cdot 10^{+230}\right):\\ \;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(1 + t \cdot \left(0.5 \cdot t\right)\right)\\ \mathbf{else}:\\ \;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(x \cdot \sqrt{0.5 \cdot z}\right)\\ \end{array} \]

Alternative 3: 99.2% 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}
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 \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}} \]

Alternative 4: 85.5% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(1 + t \cdot \left(0.5 \cdot t\right)\right) \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (+ 1.0 (* t (* 0.5 t)))))
double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)));
}
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))) * (1.0d0 + (t * (0.5d0 * t)))
end function
public static double code(double x, double y, double z, double t) {
	return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)));
}
def code(x, y, z, t):
	return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)))
function code(x, y, z, t)
	return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * Float64(1.0 + Float64(t * Float64(0.5 * t))))
end
function tmp = code(x, y, z, t)
	tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)));
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[(1.0 + N[(t * N[(0.5 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(1 + t \cdot \left(0.5 \cdot t\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 t around 0 86.2%

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

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

      \[\leadsto \left(x \cdot \sqrt{z \cdot 0.5}\right) \cdot \left(1 + \color{blue}{\left(0.5 \cdot t\right) \cdot t}\right) \]
    3. *-commutative53.0%

      \[\leadsto \left(x \cdot \sqrt{z \cdot 0.5}\right) \cdot \left(1 + \color{blue}{t \cdot \left(0.5 \cdot t\right)}\right) \]
  4. Simplified86.2%

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

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

Alternative 5: 65.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.3 \cdot 10^{+17}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\left(1 + t \cdot \left(0.5 \cdot t\right)\right) \cdot \left(x \cdot \sqrt{0.5 \cdot z}\right)\\


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

    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 t around 0 71.1%

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

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

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

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

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

        \[\leadsto \sqrt{z \cdot 2} \cdot \color{blue}{\left(x \cdot 0.5 + \left(-y\right)\right)} \]
      6. distribute-lft-in70.2%

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

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

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

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

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

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

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

    if 3.3e17 < 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. Step-by-step derivation
      1. add-sqr-sqrt48.7%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      2. sqrt-unprod48.7%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      3. *-commutative48.7%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      4. *-commutative48.7%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      5. swap-sqr48.7%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      6. add-sqr-sqrt48.7%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      7. pow248.7%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(0.5 \cdot z\right) \cdot {x}^{2}}} \cdot e^{\frac{t \cdot t}{2}} \]
      2. unpow239.5%

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

      \[\leadsto \sqrt{\color{blue}{\left(0.5 \cdot z\right) \cdot \left(x \cdot x\right)}} \cdot e^{\frac{t \cdot t}{2}} \]
    7. Step-by-step derivation
      1. sqrt-prod22.2%

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

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

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

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

        \[\leadsto \left(\color{blue}{\left|x\right|} \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
      3. unpow18.6%

        \[\leadsto \left(\left|\color{blue}{{x}^{1}}\right| \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
      4. sqr-pow7.9%

        \[\leadsto \left(\left|\color{blue}{{x}^{\left(\frac{1}{2}\right)} \cdot {x}^{\left(\frac{1}{2}\right)}}\right| \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
      5. fabs-sqr7.9%

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

        \[\leadsto \left(\color{blue}{{x}^{1}} \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
      7. unpow114.6%

        \[\leadsto \left(\color{blue}{x} \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
    10. Simplified76.3%

      \[\leadsto \color{blue}{\left(x \cdot \sqrt{z \cdot 0.5}\right)} \cdot e^{\frac{t \cdot t}{2}} \]
    11. Taylor expanded in t around 0 55.2%

      \[\leadsto \left(x \cdot \sqrt{z \cdot 0.5}\right) \cdot \color{blue}{\left(1 + 0.5 \cdot {t}^{2}\right)} \]
    12. Step-by-step derivation
      1. unpow255.2%

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

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

        \[\leadsto \left(x \cdot \sqrt{z \cdot 0.5}\right) \cdot \left(1 + \color{blue}{t \cdot \left(0.5 \cdot t\right)}\right) \]
    13. Simplified55.2%

      \[\leadsto \left(x \cdot \sqrt{z \cdot 0.5}\right) \cdot \color{blue}{\left(1 + t \cdot \left(0.5 \cdot t\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 3.3 \cdot 10^{+17}:\\ \;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + t \cdot \left(0.5 \cdot t\right)\right) \cdot \left(x \cdot \sqrt{0.5 \cdot z}\right)\\ \end{array} \]

Alternative 6: 56.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq 2 \cdot 10^{+160}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\left(0.5 \cdot z\right) \cdot \left(x \cdot x\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x 1/2) < 2.00000000000000001e160

    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 t around 0 55.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.00000000000000001e160 < (*.f64 x 1/2)

    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. add-sqr-sqrt99.8%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      2. sqrt-unprod80.2%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      3. *-commutative80.2%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      4. *-commutative80.2%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      5. swap-sqr77.7%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      6. add-sqr-sqrt77.7%

        \[\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 e^{\frac{t \cdot t}{2}} \]
      7. pow277.7%

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

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

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

        \[\leadsto \sqrt{\color{blue}{\left(0.5 \cdot z\right) \cdot {x}^{2}}} \cdot e^{\frac{t \cdot t}{2}} \]
      2. unpow277.7%

        \[\leadsto \sqrt{\left(0.5 \cdot z\right) \cdot \color{blue}{\left(x \cdot x\right)}} \cdot e^{\frac{t \cdot t}{2}} \]
    6. Simplified77.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot 0.5 \leq 2 \cdot 10^{+160}:\\ \;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\left(0.5 \cdot z\right) \cdot \left(x \cdot x\right)}\\ \end{array} \]

Alternative 7: 56.7% accurate, 2.0× speedup?

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

\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}
\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 t around 0 56.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 29.8% accurate, 2.0× speedup?

\[\begin{array}{l} \\ x \cdot \sqrt{0.5 \cdot z} \end{array} \]
(FPCore (x y z t) :precision binary64 (* x (sqrt (* 0.5 z))))
double code(double x, double y, double z, double t) {
	return x * sqrt((0.5 * z));
}
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 * sqrt((0.5d0 * z))
end function
public static double code(double x, double y, double z, double t) {
	return x * Math.sqrt((0.5 * z));
}
def code(x, y, z, t):
	return x * math.sqrt((0.5 * z))
function code(x, y, z, t)
	return Float64(x * sqrt(Float64(0.5 * z)))
end
function tmp = code(x, y, z, t)
	tmp = x * sqrt((0.5 * z));
end
code[x_, y_, z_, t_] := N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \sqrt{0.5 \cdot z}
\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. add-sqr-sqrt50.6%

      \[\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 e^{\frac{t \cdot t}{2}} \]
    2. sqrt-unprod41.1%

      \[\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 e^{\frac{t \cdot t}{2}} \]
    3. *-commutative41.1%

      \[\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 e^{\frac{t \cdot t}{2}} \]
    4. *-commutative41.1%

      \[\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 e^{\frac{t \cdot t}{2}} \]
    5. swap-sqr38.1%

      \[\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 e^{\frac{t \cdot t}{2}} \]
    6. add-sqr-sqrt38.1%

      \[\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 e^{\frac{t \cdot t}{2}} \]
    7. pow238.1%

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

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

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

      \[\leadsto \sqrt{\color{blue}{\left(0.5 \cdot z\right) \cdot {x}^{2}}} \cdot e^{\frac{t \cdot t}{2}} \]
    2. unpow227.1%

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

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

    \[\leadsto \sqrt{\left(0.5 \cdot z\right) \cdot \left(x \cdot x\right)} \cdot \color{blue}{1} \]
  8. Step-by-step derivation
    1. sqrt-prod21.6%

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

      \[\leadsto \left(\sqrt{\color{blue}{z \cdot 0.5}} \cdot \sqrt{x \cdot x}\right) \cdot 1 \]
  9. Applied egg-rr21.6%

    \[\leadsto \color{blue}{\left(\sqrt{z \cdot 0.5} \cdot \sqrt{x \cdot x}\right)} \cdot 1 \]
  10. Step-by-step derivation
    1. *-commutative21.6%

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

      \[\leadsto \left(\color{blue}{\left|x\right|} \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
    3. unpow119.8%

      \[\leadsto \left(\left|\color{blue}{{x}^{1}}\right| \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
    4. sqr-pow18.5%

      \[\leadsto \left(\left|\color{blue}{{x}^{\left(\frac{1}{2}\right)} \cdot {x}^{\left(\frac{1}{2}\right)}}\right| \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
    5. fabs-sqr18.5%

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

      \[\leadsto \left(\color{blue}{{x}^{1}} \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
    7. unpow133.1%

      \[\leadsto \left(\color{blue}{x} \cdot \sqrt{z \cdot 0.5}\right) \cdot 1 \]
  11. Simplified33.1%

    \[\leadsto \color{blue}{\left(x \cdot \sqrt{z \cdot 0.5}\right)} \cdot 1 \]
  12. Final simplification33.1%

    \[\leadsto x \cdot \sqrt{0.5 \cdot z} \]

Developer target: 99.2% 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 2023200 
(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))))