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

Percentage Accurate: 99.5% → 99.8%
Time: 14.6s
Alternatives: 8
Speedup: 1.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 alternatives:

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

Initial Program: 99.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

\\
\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot \left(2 \cdot e^{t \cdot t}\right)}
\end{array}
Derivation
  1. Initial program 99.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. *-commutative99.0%

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

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

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

    \[\leadsto \color{blue}{\sqrt{z \cdot 2} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{e^{t \cdot t}}\right)} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. exp-sqrt99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 85.6% accurate, 1.0× speedup?

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

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

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


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

    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. Step-by-step derivation
      1. *-commutative99.7%

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

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

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

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

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

    if 5.5000000000000003e-7 < (*.f64 t t)

    1. Initial program 98.4%

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

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

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

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

        \[\leadsto \left(0.5 \cdot \left(e^{\mathsf{log1p}\left(\color{blue}{x \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)}\right)} - 1\right)\right) \cdot e^{\frac{t \cdot t}{2}} \]
      4. *-commutative30.9%

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

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

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

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

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

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

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

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

Alternative 3: 60.5% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

    if 16 < t

    1. Initial program 96.6%

      \[\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. *-commutative96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\left(z \cdot 2\right) \cdot {\left(\mathsf{fma}\left(0.5, x, \color{blue}{y}\right)\right)}^{2}} \]
    7. Applied egg-rr37.1%

      \[\leadsto \color{blue}{\sqrt{\left(z \cdot 2\right) \cdot {\left(\mathsf{fma}\left(0.5, x, y\right)\right)}^{2}}} \]
    8. Taylor expanded in z around 0 37.1%

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

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

Alternative 4: 57.5% accurate, 1.7× speedup?

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

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

\mathbf{elif}\;t \leq 2 \cdot 10^{+173} \lor \neg \left(t \leq 3.55 \cdot 10^{+230}\right):\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(x \cdot \left(y + x \cdot 0.25\right)\right)}\\

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

    if 48 < t < 2e173 or 3.5499999999999999e230 < t

    1. Initial program 95.7%

      \[\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. *-commutative95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\left(z \cdot 2\right) \cdot {\left(\mathsf{fma}\left(0.5, x, \color{blue}{y}\right)\right)}^{2}} \]
    7. Applied egg-rr41.3%

      \[\leadsto \color{blue}{\sqrt{\left(z \cdot 2\right) \cdot {\left(\mathsf{fma}\left(0.5, x, y\right)\right)}^{2}}} \]
    8. Taylor expanded in x around inf 28.7%

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

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

        \[\leadsto \sqrt{\left(z \cdot 2\right) \cdot \left(x \cdot y + \color{blue}{{x}^{2} \cdot 0.25}\right)} \]
      3. unpow228.7%

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

        \[\leadsto \sqrt{\left(z \cdot 2\right) \cdot \left(x \cdot y + \color{blue}{x \cdot \left(x \cdot 0.25\right)}\right)} \]
      5. distribute-lft-out33.0%

        \[\leadsto \sqrt{\left(z \cdot 2\right) \cdot \color{blue}{\left(x \cdot \left(y + x \cdot 0.25\right)\right)}} \]
    10. Simplified33.0%

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

    if 2e173 < t < 3.5499999999999999e230

    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. *-commutative100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\left(z \cdot 2\right) \cdot {\left(\mathsf{fma}\left(0.5, x, \color{blue}{y}\right)\right)}^{2}} \]
    7. Applied egg-rr19.1%

      \[\leadsto \color{blue}{\sqrt{\left(z \cdot 2\right) \cdot {\left(\mathsf{fma}\left(0.5, x, y\right)\right)}^{2}}} \]
    8. Taylor expanded in x around 0 19.2%

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

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

        \[\leadsto \sqrt{\color{blue}{2 \cdot \left({y}^{2} \cdot z + x \cdot \left(y \cdot z\right)\right)}} \]
      3. unpow219.2%

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

        \[\leadsto \sqrt{2 \cdot \left(\color{blue}{y \cdot \left(y \cdot z\right)} + x \cdot \left(y \cdot z\right)\right)} \]
      5. distribute-rgt-out19.2%

        \[\leadsto \sqrt{2 \cdot \color{blue}{\left(\left(y \cdot z\right) \cdot \left(y + x\right)\right)}} \]
    10. Simplified19.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq 48:\\ \;\;\;\;\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot 2}\\ \mathbf{elif}\;t \leq 2 \cdot 10^{+173} \lor \neg \left(t \leq 3.55 \cdot 10^{+230}\right):\\ \;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(x \cdot \left(y + x \cdot 0.25\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{2 \cdot \left(\left(y \cdot z\right) \cdot \left(x + y\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 43.8% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{+14} \lor \neg \left(x \leq 1.3 \cdot 10^{+88}\right):\\
\;\;\;\;\left(0.5 \cdot x\right) \cdot t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.05e14 or 1.3e88 < x

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sqrt{2 \cdot z} \cdot \mathsf{fma}\left(0.5, x, y\right)} \]
    10. Taylor expanded in x around inf 49.3%

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

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

    if -1.05e14 < x < 1.3e88

    1. Initial program 98.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot x - y\right) \cdot {\color{blue}{\left({\left(z \cdot 2\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \]
      7. metadata-eval55.0%

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

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

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

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

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

Alternative 6: 57.7% accurate, 1.9× speedup?

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

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

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


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

    1. Initial program 99.3%

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

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

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

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

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

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

    if 2.8999999999999998e103 < t

    1. Initial program 97.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\left(z \cdot 2\right) \cdot {\left(\mathsf{fma}\left(0.5, x, \sqrt{\color{blue}{y \cdot y}}\right)\right)}^{2}} \]
      10. sqrt-unprod16.1%

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

        \[\leadsto \sqrt{\left(z \cdot 2\right) \cdot {\left(\mathsf{fma}\left(0.5, x, \color{blue}{y}\right)\right)}^{2}} \]
    7. Applied egg-rr40.3%

      \[\leadsto \color{blue}{\sqrt{\left(z \cdot 2\right) \cdot {\left(\mathsf{fma}\left(0.5, x, y\right)\right)}^{2}}} \]
    8. Taylor expanded in x around 0 17.0%

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

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

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

        \[\leadsto \sqrt{\left(z \cdot 2\right) \cdot \color{blue}{\left(y \cdot \left(y + x\right)\right)}} \]
    10. Simplified19.6%

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

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

Alternative 7: 30.2% accurate, 2.0× speedup?

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

\\
y \cdot \left(-\sqrt{z \cdot 2}\right)
\end{array}
Derivation
  1. Initial program 99.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. *-commutative99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(0.5 \cdot x - y\right) \cdot {\color{blue}{\left({\left(z \cdot 2\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \]
    7. metadata-eval57.5%

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

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

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

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

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

Alternative 8: 2.5% accurate, 2.0× speedup?

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

\\
y \cdot \sqrt{z \cdot 2}
\end{array}
Derivation
  1. Initial program 99.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. *-commutative99.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(0.5 \cdot x - y\right) \cdot {\color{blue}{\left({\left(z \cdot 2\right)}^{\left(\frac{0.5}{2}\right)}\right)}}^{2} \]
    7. metadata-eval57.5%

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

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

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

    \[\leadsto \color{blue}{y \cdot \left(-\sqrt{2 \cdot z}\right)} \]
  12. Step-by-step derivation
    1. distribute-rgt-neg-out30.8%

      \[\leadsto \color{blue}{-y \cdot \sqrt{2 \cdot z}} \]
    2. pow1/230.8%

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

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

      \[\leadsto -y \cdot {\left(z \cdot 2\right)}^{\color{blue}{\left(1.5 \cdot 0.3333333333333333\right)}} \]
    5. pow-pow27.9%

      \[\leadsto -y \cdot \color{blue}{{\left({\left(z \cdot 2\right)}^{1.5}\right)}^{0.3333333333333333}} \]
    6. distribute-lft-neg-in27.9%

      \[\leadsto \color{blue}{\left(-y\right) \cdot {\left({\left(z \cdot 2\right)}^{1.5}\right)}^{0.3333333333333333}} \]
    7. add-sqr-sqrt12.8%

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

      \[\leadsto \color{blue}{\sqrt{\left(-y\right) \cdot \left(-y\right)}} \cdot {\left({\left(z \cdot 2\right)}^{1.5}\right)}^{0.3333333333333333} \]
    9. sqr-neg13.5%

      \[\leadsto \sqrt{\color{blue}{y \cdot y}} \cdot {\left({\left(z \cdot 2\right)}^{1.5}\right)}^{0.3333333333333333} \]
    10. sqrt-prod3.3%

      \[\leadsto \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot {\left({\left(z \cdot 2\right)}^{1.5}\right)}^{0.3333333333333333} \]
    11. add-sqr-sqrt5.0%

      \[\leadsto \color{blue}{y} \cdot {\left({\left(z \cdot 2\right)}^{1.5}\right)}^{0.3333333333333333} \]
    12. expm1-log1p-u4.0%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(y \cdot {\left({\left(z \cdot 2\right)}^{1.5}\right)}^{0.3333333333333333}\right)\right)} \]
    13. expm1-udef4.0%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(y \cdot {\left({\left(z \cdot 2\right)}^{1.5}\right)}^{0.3333333333333333}\right)} - 1} \]
    14. pow-pow2.2%

      \[\leadsto e^{\mathsf{log1p}\left(y \cdot \color{blue}{{\left(z \cdot 2\right)}^{\left(1.5 \cdot 0.3333333333333333\right)}}\right)} - 1 \]
    15. *-commutative2.2%

      \[\leadsto e^{\mathsf{log1p}\left(y \cdot {\color{blue}{\left(2 \cdot z\right)}}^{\left(1.5 \cdot 0.3333333333333333\right)}\right)} - 1 \]
    16. metadata-eval2.2%

      \[\leadsto e^{\mathsf{log1p}\left(y \cdot {\left(2 \cdot z\right)}^{\color{blue}{0.5}}\right)} - 1 \]
    17. pow1/22.2%

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

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

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

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

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

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

Developer target: 99.5% accurate, 0.7× speedup?

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

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

Reproduce

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