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

Percentage Accurate: 99.5% → 99.8%
Time: 10.0s
Alternatives: 6
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 6 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, 0.7× speedup?

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

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

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

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

Alternative 2: 99.8% accurate, 1.0× speedup?

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

      \[\leadsto \color{blue}{\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot e^{\frac{t \cdot t}{2}}\right)} \]
    2. 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. Step-by-step derivation
    1. expm1-log1p-u98.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 84.7% 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.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. associate-*l*99.8%

      \[\leadsto \color{blue}{\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{z \cdot 2} \cdot e^{\frac{t \cdot t}{2}}\right)} \]
    2. 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. Step-by-step derivation
    1. expm1-log1p-u98.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\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.5% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

Alternative 5: 16.5% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 16.6% accurate, 2.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 2023238 
(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))))