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

Percentage Accurate: 99.3% → 99.8%
Time: 17.4s
Alternatives: 9
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 9 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.3% 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.8% accurate, 1.0× speedup?

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

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

    \[\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-cube-cbrt99.3%

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

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

    \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}}\right)}^{3}} \cdot e^{\frac{t \cdot t}{2}} \]
  4. Step-by-step derivation
    1. expm1-log1p-u55.4%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\sqrt[3]{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}}\right)}^{3} \cdot e^{\frac{t \cdot t}{2}}\right)\right)} \]
    2. expm1-udef46.2%

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

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

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z \cdot e^{t \cdot t}\right)}\right)\right)} \]
    2. expm1-log1p99.9%

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

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

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

Alternative 2: 92.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \cdot t \leq 2 \cdot 10^{-23}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot z}\\

\mathbf{elif}\;t \cdot t \leq 2 \cdot 10^{+276}:\\
\;\;\;\;\sqrt{2 \cdot \left(z \cdot e^{t \cdot t}\right)} \cdot \left(-y\right)\\

\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{2 \cdot \left(z + z \cdot \left(t \cdot t\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 t t) < 1.99999999999999992e-23

    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 99.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
      11. associate-*l*24.6%

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

      \[\leadsto \color{blue}{{\left(z \cdot \left(2 \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)\right)}^{0.5}} \]
    5. Step-by-step derivation
      1. unpow1/224.6%

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

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

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

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

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

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

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

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

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

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

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

    if 1.99999999999999992e-23 < (*.f64 t t) < 2.0000000000000001e276

    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. sqr-neg100.0%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot e^{\color{blue}{\frac{-t}{\frac{2}{-t}}}}\right) \]
      12. associate-/l*100.0%

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(y \cdot \sqrt{2}\right) \cdot \sqrt{z \cdot e^{t \cdot t}}\right)\right)} \]
      2. expm1-udef37.2%

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

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

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

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

        \[\leadsto -\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot \sqrt{2 \cdot \left(z \cdot e^{t \cdot t}\right)}\right)\right)} \]
      2. expm1-log1p66.7%

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

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

    if 2.0000000000000001e276 < (*.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. Step-by-step derivation
      1. add-cube-cbrt100.0%

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

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

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}}\right)}^{3}} \cdot e^{\frac{t \cdot t}{2}} \]
    4. Step-by-step derivation
      1. expm1-log1p-u49.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\sqrt[3]{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}}\right)}^{3} \cdot e^{\frac{t \cdot t}{2}}\right)\right)} \]
      2. expm1-udef49.3%

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

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z \cdot e^{t \cdot t}\right)}\right)} - 1} \]
    6. Step-by-step derivation
      1. expm1-def49.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z \cdot e^{t \cdot t}\right)}\right)\right)} \]
      2. expm1-log1p100.0%

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

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

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

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

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

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

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

Alternative 3: 84.3% accurate, 1.9× speedup?

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

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

    \[\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-cube-cbrt99.3%

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

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

    \[\leadsto \color{blue}{{\left(\sqrt[3]{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}}\right)}^{3}} \cdot e^{\frac{t \cdot t}{2}} \]
  4. Step-by-step derivation
    1. expm1-log1p-u55.4%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left({\left(\sqrt[3]{\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}}\right)}^{3} \cdot e^{\frac{t \cdot t}{2}}\right)\right)} \]
    2. expm1-udef46.2%

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

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

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z \cdot e^{t \cdot t}\right)}\right)\right)} \]
    2. expm1-log1p99.9%

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

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

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

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

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

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

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

Alternative 4: 56.7% accurate, 1.9× speedup?

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

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

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


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

    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 52.5%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
      11. associate-*l*22.3%

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

      \[\leadsto \color{blue}{{\left(z \cdot \left(2 \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)\right)}^{0.5}} \]
    5. Step-by-step derivation
      1. unpow1/222.3%

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

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

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

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

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

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

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

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

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

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

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

    if 4.00000000000000007e184 < (*.f64 x 1/2)

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
      11. associate-*l*83.8%

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

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

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

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

        \[\leadsto {\color{blue}{\left(\left(0.5 \cdot z\right) \cdot {x}^{2}\right)}}^{0.5} \]
      3. *-commutative83.8%

        \[\leadsto {\left(\color{blue}{\left(z \cdot 0.5\right)} \cdot {x}^{2}\right)}^{0.5} \]
      4. unpow283.8%

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

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

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

Alternative 5: 44.0% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-26}:\\
\;\;\;\;\sqrt{\left(2 \cdot z\right) \cdot \left(y \cdot y\right)}\\

\mathbf{elif}\;y \leq 1.25 \cdot 10^{-90}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -6.5e-26

    1. Initial program 99.9%

      \[\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 63.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
      11. associate-*l*58.3%

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

      \[\leadsto \color{blue}{{\left(z \cdot \left(2 \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)\right)}^{0.5}} \]
    5. Taylor expanded in x around 0 52.8%

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

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

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

        \[\leadsto {\color{blue}{\left({y}^{2} \cdot \left(2 \cdot z\right)\right)}}^{0.5} \]
      4. unpow252.8%

        \[\leadsto {\left(\color{blue}{\left(y \cdot y\right)} \cdot \left(2 \cdot z\right)\right)}^{0.5} \]
      5. associate-*l*50.1%

        \[\leadsto {\color{blue}{\left(y \cdot \left(y \cdot \left(2 \cdot z\right)\right)\right)}}^{0.5} \]
    7. Simplified50.1%

      \[\leadsto {\color{blue}{\left(y \cdot \left(y \cdot \left(2 \cdot z\right)\right)\right)}}^{0.5} \]
    8. Step-by-step derivation
      1. unpow1/250.1%

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

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

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

    if -6.5e-26 < y < 1.25000000000000005e-90

    1. Initial program 99.9%

      \[\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 45.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
      11. associate-*l*27.0%

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot \sqrt{0.5}\right) \cdot \sqrt{z}\right)\right)} \]
      2. expm1-udef15.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(x \cdot \sqrt{0.5}\right) \cdot \sqrt{z}\right)} - 1} \]
      3. associate-*l*15.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{x \cdot \left(\sqrt{0.5} \cdot \sqrt{z}\right)}\right)} - 1 \]
      4. pow1/215.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \left(\color{blue}{{0.5}^{0.5}} \cdot \sqrt{z}\right)\right)} - 1 \]
      5. pow1/215.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \left({0.5}^{0.5} \cdot \color{blue}{{z}^{0.5}}\right)\right)} - 1 \]
      6. pow-prod-down15.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \color{blue}{{\left(0.5 \cdot z\right)}^{0.5}}\right)} - 1 \]
    7. Applied egg-rr15.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x \cdot {\left(0.5 \cdot z\right)}^{0.5}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left(0.5 \cdot z\right)}^{0.5}\right)\right)} \]
      2. expm1-log1p41.2%

        \[\leadsto \color{blue}{x \cdot {\left(0.5 \cdot z\right)}^{0.5}} \]
      3. unpow1/241.2%

        \[\leadsto x \cdot \color{blue}{\sqrt{0.5 \cdot z}} \]
      4. *-commutative41.2%

        \[\leadsto x \cdot \sqrt{\color{blue}{z \cdot 0.5}} \]
    9. Simplified41.2%

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

    if 1.25000000000000005e-90 < y

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

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{\color{blue}{\left(-t\right) \cdot \left(-t\right)}}{2}} \]
      2. 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}}}} \]
      3. 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}{\frac{2}{-t}}}} \]
      4. exp-neg99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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-unprod40.4%

        \[\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. swap-sqr44.4%

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

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

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

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

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

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

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

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

Alternative 6: 43.9% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
t_1 := \sqrt{\left(2 \cdot z\right) \cdot \left(y \cdot y\right)}\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{-25}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 1.85 \cdot 10^{-90}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\

\mathbf{else}:\\
\;\;\;\;-t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.8e-25

    1. Initial program 99.9%

      \[\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 63.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
      11. associate-*l*58.3%

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

      \[\leadsto \color{blue}{{\left(z \cdot \left(2 \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)\right)}^{0.5}} \]
    5. Taylor expanded in x around 0 52.8%

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

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

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

        \[\leadsto {\color{blue}{\left({y}^{2} \cdot \left(2 \cdot z\right)\right)}}^{0.5} \]
      4. unpow252.8%

        \[\leadsto {\left(\color{blue}{\left(y \cdot y\right)} \cdot \left(2 \cdot z\right)\right)}^{0.5} \]
      5. associate-*l*50.1%

        \[\leadsto {\color{blue}{\left(y \cdot \left(y \cdot \left(2 \cdot z\right)\right)\right)}}^{0.5} \]
    7. Simplified50.1%

      \[\leadsto {\color{blue}{\left(y \cdot \left(y \cdot \left(2 \cdot z\right)\right)\right)}}^{0.5} \]
    8. Step-by-step derivation
      1. unpow1/250.1%

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

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

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

    if -1.8e-25 < y < 1.85000000000000009e-90

    1. Initial program 99.9%

      \[\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 45.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
      11. associate-*l*27.0%

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot \sqrt{0.5}\right) \cdot \sqrt{z}\right)\right)} \]
      2. expm1-udef15.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(x \cdot \sqrt{0.5}\right) \cdot \sqrt{z}\right)} - 1} \]
      3. associate-*l*15.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{x \cdot \left(\sqrt{0.5} \cdot \sqrt{z}\right)}\right)} - 1 \]
      4. pow1/215.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \left(\color{blue}{{0.5}^{0.5}} \cdot \sqrt{z}\right)\right)} - 1 \]
      5. pow1/215.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \left({0.5}^{0.5} \cdot \color{blue}{{z}^{0.5}}\right)\right)} - 1 \]
      6. pow-prod-down15.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \color{blue}{{\left(0.5 \cdot z\right)}^{0.5}}\right)} - 1 \]
    7. Applied egg-rr15.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x \cdot {\left(0.5 \cdot z\right)}^{0.5}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left(0.5 \cdot z\right)}^{0.5}\right)\right)} \]
      2. expm1-log1p41.2%

        \[\leadsto \color{blue}{x \cdot {\left(0.5 \cdot z\right)}^{0.5}} \]
      3. unpow1/241.2%

        \[\leadsto x \cdot \color{blue}{\sqrt{0.5 \cdot z}} \]
      4. *-commutative41.2%

        \[\leadsto x \cdot \sqrt{\color{blue}{z \cdot 0.5}} \]
    9. Simplified41.2%

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

    if 1.85000000000000009e-90 < y

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

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{\color{blue}{\left(-t\right) \cdot \left(-t\right)}}{2}} \]
      2. 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}}}} \]
      3. 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}{\frac{2}{-t}}}} \]
      4. exp-neg99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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-unprod40.4%

        \[\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. swap-sqr44.4%

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

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

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

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

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

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

Alternative 7: 42.0% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-26} \lor \neg \left(y \leq 1.25 \cdot 10^{-90}\right):\\
\;\;\;\;\sqrt{2 \cdot z} \cdot \left(-y\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.0000000000000001e-26 or 1.25000000000000005e-90 < y

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

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{\color{blue}{\left(-t\right) \cdot \left(-t\right)}}{2}} \]
      2. 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}}}} \]
      3. 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}{\frac{2}{-t}}}} \]
      4. exp-neg99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -y \cdot \color{blue}{\sqrt{2 \cdot z}} \]
    13. Simplified44.6%

      \[\leadsto -y \cdot \color{blue}{\sqrt{2 \cdot z}} \]

    if -2.0000000000000001e-26 < y < 1.25000000000000005e-90

    1. Initial program 99.9%

      \[\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 45.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
      11. associate-*l*27.0%

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot \sqrt{0.5}\right) \cdot \sqrt{z}\right)\right)} \]
      2. expm1-udef15.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(x \cdot \sqrt{0.5}\right) \cdot \sqrt{z}\right)} - 1} \]
      3. associate-*l*15.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{x \cdot \left(\sqrt{0.5} \cdot \sqrt{z}\right)}\right)} - 1 \]
      4. pow1/215.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \left(\color{blue}{{0.5}^{0.5}} \cdot \sqrt{z}\right)\right)} - 1 \]
      5. pow1/215.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \left({0.5}^{0.5} \cdot \color{blue}{{z}^{0.5}}\right)\right)} - 1 \]
      6. pow-prod-down15.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \color{blue}{{\left(0.5 \cdot z\right)}^{0.5}}\right)} - 1 \]
    7. Applied egg-rr15.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x \cdot {\left(0.5 \cdot z\right)}^{0.5}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left(0.5 \cdot z\right)}^{0.5}\right)\right)} \]
      2. expm1-log1p41.2%

        \[\leadsto \color{blue}{x \cdot {\left(0.5 \cdot z\right)}^{0.5}} \]
      3. unpow1/241.2%

        \[\leadsto x \cdot \color{blue}{\sqrt{0.5 \cdot z}} \]
      4. *-commutative41.2%

        \[\leadsto x \cdot \sqrt{\color{blue}{z \cdot 0.5}} \]
    9. Simplified41.2%

      \[\leadsto \color{blue}{x \cdot \sqrt{z \cdot 0.5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.3%

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

Alternative 8: 43.0% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-23}:\\
\;\;\;\;\sqrt{\left(2 \cdot z\right) \cdot \left(y \cdot y\right)}\\

\mathbf{elif}\;y \leq 1.85 \cdot 10^{-90}:\\
\;\;\;\;x \cdot \sqrt{0.5 \cdot z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.1e-23

    1. Initial program 99.9%

      \[\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 63.4%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
      11. associate-*l*58.3%

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

      \[\leadsto \color{blue}{{\left(z \cdot \left(2 \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)\right)}^{0.5}} \]
    5. Taylor expanded in x around 0 52.8%

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

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

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

        \[\leadsto {\color{blue}{\left({y}^{2} \cdot \left(2 \cdot z\right)\right)}}^{0.5} \]
      4. unpow252.8%

        \[\leadsto {\left(\color{blue}{\left(y \cdot y\right)} \cdot \left(2 \cdot z\right)\right)}^{0.5} \]
      5. associate-*l*50.1%

        \[\leadsto {\color{blue}{\left(y \cdot \left(y \cdot \left(2 \cdot z\right)\right)\right)}}^{0.5} \]
    7. Simplified50.1%

      \[\leadsto {\color{blue}{\left(y \cdot \left(y \cdot \left(2 \cdot z\right)\right)\right)}}^{0.5} \]
    8. Step-by-step derivation
      1. unpow1/250.1%

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

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

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

    if -1.1e-23 < y < 1.85000000000000009e-90

    1. Initial program 99.9%

      \[\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 45.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
      11. associate-*l*27.0%

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot \sqrt{0.5}\right) \cdot \sqrt{z}\right)\right)} \]
      2. expm1-udef15.5%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(x \cdot \sqrt{0.5}\right) \cdot \sqrt{z}\right)} - 1} \]
      3. associate-*l*15.5%

        \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{x \cdot \left(\sqrt{0.5} \cdot \sqrt{z}\right)}\right)} - 1 \]
      4. pow1/215.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \left(\color{blue}{{0.5}^{0.5}} \cdot \sqrt{z}\right)\right)} - 1 \]
      5. pow1/215.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \left({0.5}^{0.5} \cdot \color{blue}{{z}^{0.5}}\right)\right)} - 1 \]
      6. pow-prod-down15.5%

        \[\leadsto e^{\mathsf{log1p}\left(x \cdot \color{blue}{{\left(0.5 \cdot z\right)}^{0.5}}\right)} - 1 \]
    7. Applied egg-rr15.5%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x \cdot {\left(0.5 \cdot z\right)}^{0.5}\right)} - 1} \]
    8. Step-by-step derivation
      1. expm1-def27.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left(0.5 \cdot z\right)}^{0.5}\right)\right)} \]
      2. expm1-log1p41.2%

        \[\leadsto \color{blue}{x \cdot {\left(0.5 \cdot z\right)}^{0.5}} \]
      3. unpow1/241.2%

        \[\leadsto x \cdot \color{blue}{\sqrt{0.5 \cdot z}} \]
      4. *-commutative41.2%

        \[\leadsto x \cdot \sqrt{\color{blue}{z \cdot 0.5}} \]
    9. Simplified41.2%

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

    if 1.85000000000000009e-90 < y

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

        \[\leadsto \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{\color{blue}{\left(-t\right) \cdot \left(-t\right)}}{2}} \]
      2. 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}}}} \]
      3. 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}{\frac{2}{-t}}}} \]
      4. exp-neg99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -y \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{\sqrt{2 \cdot z}}\right)} - 1\right) \]
    11. Applied egg-rr22.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-def39.2%

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

        \[\leadsto -y \cdot \color{blue}{\sqrt{2 \cdot z}} \]
    13. Simplified40.3%

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

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

Alternative 9: 30.3% 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.9%

    \[\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 52.2%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\left(z \cdot 2\right) \cdot {\left(x \cdot 0.5 - y\right)}^{2}\right)}^{0.5}} \]
    11. associate-*l*29.5%

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

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

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

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(x \cdot \sqrt{0.5}\right) \cdot \sqrt{z}\right)\right)} \]
    2. expm1-udef11.8%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(x \cdot \sqrt{0.5}\right) \cdot \sqrt{z}\right)} - 1} \]
    3. associate-*l*11.8%

      \[\leadsto e^{\mathsf{log1p}\left(\color{blue}{x \cdot \left(\sqrt{0.5} \cdot \sqrt{z}\right)}\right)} - 1 \]
    4. pow1/211.8%

      \[\leadsto e^{\mathsf{log1p}\left(x \cdot \left(\color{blue}{{0.5}^{0.5}} \cdot \sqrt{z}\right)\right)} - 1 \]
    5. pow1/211.8%

      \[\leadsto e^{\mathsf{log1p}\left(x \cdot \left({0.5}^{0.5} \cdot \color{blue}{{z}^{0.5}}\right)\right)} - 1 \]
    6. pow-prod-down11.8%

      \[\leadsto e^{\mathsf{log1p}\left(x \cdot \color{blue}{{\left(0.5 \cdot z\right)}^{0.5}}\right)} - 1 \]
  7. Applied egg-rr11.8%

    \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(x \cdot {\left(0.5 \cdot z\right)}^{0.5}\right)} - 1} \]
  8. Step-by-step derivation
    1. expm1-def17.0%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left(0.5 \cdot z\right)}^{0.5}\right)\right)} \]
    2. expm1-log1p24.8%

      \[\leadsto \color{blue}{x \cdot {\left(0.5 \cdot z\right)}^{0.5}} \]
    3. unpow1/224.8%

      \[\leadsto x \cdot \color{blue}{\sqrt{0.5 \cdot z}} \]
    4. *-commutative24.8%

      \[\leadsto x \cdot \sqrt{\color{blue}{z \cdot 0.5}} \]
  9. Simplified24.8%

    \[\leadsto \color{blue}{x \cdot \sqrt{z \cdot 0.5}} \]
  10. Final simplification24.8%

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

Developer target: 99.3% 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 2023280 
(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))))