
(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:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (x y z t) :precision binary64 (* (exp (/ (* t t) 2.0)) (* (- (* x 0.5) y) (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
return exp(((t * t) / 2.0)) * (((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 = exp(((t * t) / 2.0d0)) * (((x * 0.5d0) - y) * sqrt((z * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return Math.exp(((t * t) / 2.0)) * (((x * 0.5) - y) * Math.sqrt((z * 2.0)));
}
def code(x, y, z, t): return math.exp(((t * t) / 2.0)) * (((x * 0.5) - y) * math.sqrt((z * 2.0)))
function code(x, y, z, t) return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = exp(((t * t) / 2.0)) * (((x * 0.5) - y) * sqrt((z * 2.0))); end
code[x_, y_, z_, t_] := N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\frac{t \cdot t}{2}} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0))) (t_2 (exp (/ (* t t) 2.0)))) (if (<= t_2 20.0) (* (- (* x 0.5) y) t_1) (* t_2 (* t_1 (- y))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double t_2 = exp(((t * t) / 2.0));
double tmp;
if (t_2 <= 20.0) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_2 * (t_1 * -y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
t_2 = exp(((t * t) / 2.0d0))
if (t_2 <= 20.0d0) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = t_2 * (t_1 * -y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double t_2 = Math.exp(((t * t) / 2.0));
double tmp;
if (t_2 <= 20.0) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_2 * (t_1 * -y);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) t_2 = math.exp(((t * t) / 2.0)) tmp = 0 if t_2 <= 20.0: tmp = ((x * 0.5) - y) * t_1 else: tmp = t_2 * (t_1 * -y) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) t_2 = exp(Float64(Float64(t * t) / 2.0)) tmp = 0.0 if (t_2 <= 20.0) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(t_2 * Float64(t_1 * Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); t_2 = exp(((t * t) / 2.0)); tmp = 0.0; if (t_2 <= 20.0) tmp = ((x * 0.5) - y) * t_1; else tmp = t_2 * (t_1 * -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 20.0], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$2 * N[(t$95$1 * (-y)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
t_2 := e^{\frac{t \cdot t}{2}}\\
\mathbf{if}\;t_2 \leq 20:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(t_1 \cdot \left(-y\right)\right)\\
\end{array}
\end{array}
if (exp.f64 (/.f64 (*.f64 t t) 2)) < 20Initial program 99.6%
sqr-neg99.6%
associate-/l*99.6%
distribute-frac-neg99.6%
exp-neg99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*r/99.6%
exp-neg99.6%
distribute-frac-neg99.6%
associate-/l*99.6%
sqr-neg99.6%
exp-sqrt99.6%
Simplified99.6%
expm1-log1p-u96.9%
expm1-udef51.4%
sqrt-unprod51.4%
associate-*l*51.4%
pow251.4%
Applied egg-rr51.4%
expm1-def96.9%
expm1-log1p99.6%
Simplified99.6%
Taylor expanded in t around 0 98.1%
if 20 < (exp.f64 (/.f64 (*.f64 t t) 2)) Initial program 100.0%
Taylor expanded in x around 0 70.2%
associate-*r*70.2%
*-commutative70.2%
associate-*r*70.2%
neg-mul-170.2%
Simplified70.2%
*-commutative70.2%
distribute-lft-neg-out70.2%
distribute-lft-neg-out70.2%
add-sqr-sqrt46.3%
sqrt-unprod53.7%
sqr-neg53.7%
sqrt-unprod10.7%
add-sqr-sqrt25.6%
associate-*l*25.6%
sqrt-prod25.6%
*-commutative25.6%
add-sqr-sqrt10.7%
sqrt-unprod53.7%
sqr-neg53.7%
sqrt-unprod46.3%
add-sqr-sqrt70.2%
Applied egg-rr70.2%
distribute-lft-neg-in70.2%
Simplified70.2%
Final simplification84.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))) (t_2 (exp (/ (* t t) 2.0))))
(if (<= t_2 20.0)
(* (- (* x 0.5) y) (* t_1 (hypot 1.0 t)))
(* t_2 (* t_1 (- y))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double t_2 = exp(((t * t) / 2.0));
double tmp;
if (t_2 <= 20.0) {
tmp = ((x * 0.5) - y) * (t_1 * hypot(1.0, t));
} else {
tmp = t_2 * (t_1 * -y);
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double t_2 = Math.exp(((t * t) / 2.0));
double tmp;
if (t_2 <= 20.0) {
tmp = ((x * 0.5) - y) * (t_1 * Math.hypot(1.0, t));
} else {
tmp = t_2 * (t_1 * -y);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) t_2 = math.exp(((t * t) / 2.0)) tmp = 0 if t_2 <= 20.0: tmp = ((x * 0.5) - y) * (t_1 * math.hypot(1.0, t)) else: tmp = t_2 * (t_1 * -y) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) t_2 = exp(Float64(Float64(t * t) / 2.0)) tmp = 0.0 if (t_2 <= 20.0) tmp = Float64(Float64(Float64(x * 0.5) - y) * Float64(t_1 * hypot(1.0, t))); else tmp = Float64(t_2 * Float64(t_1 * Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); t_2 = exp(((t * t) / 2.0)); tmp = 0.0; if (t_2 <= 20.0) tmp = ((x * 0.5) - y) * (t_1 * hypot(1.0, t)); else tmp = t_2 * (t_1 * -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 20.0], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[(t$95$1 * N[Sqrt[1.0 ^ 2 + t ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(t$95$1 * (-y)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
t_2 := e^{\frac{t \cdot t}{2}}\\
\mathbf{if}\;t_2 \leq 20:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \left(t_1 \cdot \mathsf{hypot}\left(1, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(t_1 \cdot \left(-y\right)\right)\\
\end{array}
\end{array}
if (exp.f64 (/.f64 (*.f64 t t) 2)) < 20Initial program 99.6%
sqr-neg99.6%
associate-/l*99.6%
distribute-frac-neg99.6%
exp-neg99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*r/99.6%
exp-neg99.6%
distribute-frac-neg99.6%
associate-/l*99.6%
sqr-neg99.6%
exp-sqrt99.6%
Simplified99.6%
expm1-log1p-u96.9%
expm1-udef51.4%
sqrt-unprod51.4%
associate-*l*51.4%
pow251.4%
Applied egg-rr51.4%
expm1-def96.9%
expm1-log1p99.6%
Simplified99.6%
Taylor expanded in t around 0 98.7%
+-commutative98.7%
unpow298.7%
fma-def98.7%
Simplified98.7%
associate-*r*98.7%
sqrt-prod98.7%
Applied egg-rr98.7%
fma-udef98.7%
unpow298.7%
+-commutative98.7%
unpow298.7%
hypot-1-def98.7%
Simplified98.7%
if 20 < (exp.f64 (/.f64 (*.f64 t t) 2)) Initial program 100.0%
Taylor expanded in x around 0 70.2%
associate-*r*70.2%
*-commutative70.2%
associate-*r*70.2%
neg-mul-170.2%
Simplified70.2%
*-commutative70.2%
distribute-lft-neg-out70.2%
distribute-lft-neg-out70.2%
add-sqr-sqrt46.3%
sqrt-unprod53.7%
sqr-neg53.7%
sqrt-unprod10.7%
add-sqr-sqrt25.6%
associate-*l*25.6%
sqrt-prod25.6%
*-commutative25.6%
add-sqr-sqrt10.7%
sqrt-unprod53.7%
sqr-neg53.7%
sqrt-unprod46.3%
add-sqr-sqrt70.2%
Applied egg-rr70.2%
distribute-lft-neg-in70.2%
Simplified70.2%
Final simplification85.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0)))
(t_2 (* (exp (/ (* t t) 2.0)) (* t_1 (- y))))
(t_3 (- (* x 0.5) y)))
(if (<= (* t t) 10.0)
(* t_3 (* t_1 (hypot 1.0 t)))
(if (<= (* t t) 1e+162)
t_2
(if (<= (* t t) 1e+214)
(* (sqrt z) (* t_3 (* t (sqrt 2.0))))
(if (<= (* t t) 4e+283)
t_2
(* t_3 (sqrt (* z (* 2.0 (fma t t 1.0)))))))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double t_2 = exp(((t * t) / 2.0)) * (t_1 * -y);
double t_3 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 10.0) {
tmp = t_3 * (t_1 * hypot(1.0, t));
} else if ((t * t) <= 1e+162) {
tmp = t_2;
} else if ((t * t) <= 1e+214) {
tmp = sqrt(z) * (t_3 * (t * sqrt(2.0)));
} else if ((t * t) <= 4e+283) {
tmp = t_2;
} else {
tmp = t_3 * sqrt((z * (2.0 * fma(t, t, 1.0))));
}
return tmp;
}
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) t_2 = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(t_1 * Float64(-y))) t_3 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(t * t) <= 10.0) tmp = Float64(t_3 * Float64(t_1 * hypot(1.0, t))); elseif (Float64(t * t) <= 1e+162) tmp = t_2; elseif (Float64(t * t) <= 1e+214) tmp = Float64(sqrt(z) * Float64(t_3 * Float64(t * sqrt(2.0)))); elseif (Float64(t * t) <= 4e+283) tmp = t_2; else tmp = Float64(t_3 * sqrt(Float64(z * Float64(2.0 * fma(t, t, 1.0))))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * (-y)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 10.0], N[(t$95$3 * N[(t$95$1 * N[Sqrt[1.0 ^ 2 + t ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * t), $MachinePrecision], 1e+162], t$95$2, If[LessEqual[N[(t * t), $MachinePrecision], 1e+214], N[(N[Sqrt[z], $MachinePrecision] * N[(t$95$3 * N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * t), $MachinePrecision], 4e+283], t$95$2, N[(t$95$3 * N[Sqrt[N[(z * N[(2.0 * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
t_2 := e^{\frac{t \cdot t}{2}} \cdot \left(t_1 \cdot \left(-y\right)\right)\\
t_3 := x \cdot 0.5 - y\\
\mathbf{if}\;t \cdot t \leq 10:\\
\;\;\;\;t_3 \cdot \left(t_1 \cdot \mathsf{hypot}\left(1, t\right)\right)\\
\mathbf{elif}\;t \cdot t \leq 10^{+162}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \cdot t \leq 10^{+214}:\\
\;\;\;\;\sqrt{z} \cdot \left(t_3 \cdot \left(t \cdot \sqrt{2}\right)\right)\\
\mathbf{elif}\;t \cdot t \leq 4 \cdot 10^{+283}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \sqrt{z \cdot \left(2 \cdot \mathsf{fma}\left(t, t, 1\right)\right)}\\
\end{array}
\end{array}
if (*.f64 t t) < 10Initial program 99.6%
sqr-neg99.6%
associate-/l*99.6%
distribute-frac-neg99.6%
exp-neg99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*r/99.6%
*-rgt-identity99.6%
associate-*r/99.6%
exp-neg99.6%
distribute-frac-neg99.6%
associate-/l*99.6%
sqr-neg99.6%
exp-sqrt99.6%
Simplified99.6%
expm1-log1p-u96.9%
expm1-udef51.4%
sqrt-unprod51.4%
associate-*l*51.4%
pow251.4%
Applied egg-rr51.4%
expm1-def96.9%
expm1-log1p99.6%
Simplified99.6%
Taylor expanded in t around 0 98.7%
+-commutative98.7%
unpow298.7%
fma-def98.7%
Simplified98.7%
associate-*r*98.7%
sqrt-prod98.7%
Applied egg-rr98.7%
fma-udef98.7%
unpow298.7%
+-commutative98.7%
unpow298.7%
hypot-1-def98.7%
Simplified98.7%
if 10 < (*.f64 t t) < 9.9999999999999994e161 or 9.9999999999999995e213 < (*.f64 t t) < 3.99999999999999982e283Initial program 100.0%
Taylor expanded in x around 0 80.4%
associate-*r*80.4%
*-commutative80.4%
associate-*r*80.4%
neg-mul-180.4%
Simplified80.4%
*-commutative80.4%
distribute-lft-neg-out80.4%
distribute-lft-neg-out80.4%
add-sqr-sqrt52.2%
sqrt-unprod54.3%
sqr-neg54.3%
sqrt-unprod4.3%
add-sqr-sqrt13.0%
associate-*l*13.0%
sqrt-prod13.0%
*-commutative13.0%
add-sqr-sqrt4.3%
sqrt-unprod54.3%
sqr-neg54.3%
sqrt-unprod52.2%
add-sqr-sqrt80.4%
Applied egg-rr80.4%
distribute-lft-neg-in80.4%
Simplified80.4%
if 9.9999999999999994e161 < (*.f64 t t) < 9.9999999999999995e213Initial program 100.0%
sqr-neg100.0%
associate-/l*100.0%
distribute-frac-neg100.0%
exp-neg100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
exp-neg100.0%
distribute-frac-neg100.0%
associate-/l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow2100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
Simplified100.0%
Taylor expanded in t around 0 46.6%
+-commutative46.6%
unpow246.6%
fma-def46.6%
Simplified46.6%
Taylor expanded in t around inf 44.5%
*-commutative44.5%
associate-*r*44.5%
*-commutative44.5%
Simplified44.5%
if 3.99999999999999982e283 < (*.f64 t t) Initial program 100.0%
sqr-neg100.0%
associate-/l*100.0%
distribute-frac-neg100.0%
exp-neg100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
exp-neg100.0%
distribute-frac-neg100.0%
associate-/l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow2100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
Simplified100.0%
Taylor expanded in t around 0 100.0%
+-commutative100.0%
unpow2100.0%
fma-def100.0%
Simplified100.0%
Final simplification92.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 1.0)
(* t_1 (sqrt (* z 2.0)))
(* (sqrt z) (* t_1 (* t (sqrt 2.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 1.0) {
tmp = t_1 * sqrt((z * 2.0));
} else {
tmp = sqrt(z) * (t_1 * (t * sqrt(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 = (x * 0.5d0) - y
if (t <= 1.0d0) then
tmp = t_1 * sqrt((z * 2.0d0))
else
tmp = sqrt(z) * (t_1 * (t * sqrt(2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 1.0) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(z) * (t_1 * (t * Math.sqrt(2.0)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 1.0: tmp = t_1 * math.sqrt((z * 2.0)) else: tmp = math.sqrt(z) * (t_1 * (t * math.sqrt(2.0))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 1.0) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); else tmp = Float64(sqrt(z) * Float64(t_1 * Float64(t * sqrt(2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if (t <= 1.0) tmp = t_1 * sqrt((z * 2.0)); else tmp = sqrt(z) * (t_1 * (t * sqrt(2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 1.0], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[z], $MachinePrecision] * N[(t$95$1 * N[(t * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 1:\\
\;\;\;\;t_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z} \cdot \left(t_1 \cdot \left(t \cdot \sqrt{2}\right)\right)\\
\end{array}
\end{array}
if t < 1Initial program 99.7%
sqr-neg99.7%
associate-/l*99.7%
distribute-frac-neg99.7%
exp-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
associate-*r/99.7%
*-rgt-identity99.7%
associate-*r/99.7%
exp-neg99.7%
distribute-frac-neg99.7%
associate-/l*99.7%
sqr-neg99.7%
exp-sqrt99.7%
Simplified99.7%
expm1-log1p-u97.9%
expm1-udef67.2%
sqrt-unprod67.2%
associate-*l*67.2%
pow267.2%
Applied egg-rr67.2%
expm1-def97.9%
expm1-log1p99.7%
Simplified99.7%
Taylor expanded in t around 0 70.5%
if 1 < t Initial program 100.0%
sqr-neg100.0%
associate-/l*100.0%
distribute-frac-neg100.0%
exp-neg100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
exp-neg100.0%
distribute-frac-neg100.0%
associate-/l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow2100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
Simplified100.0%
Taylor expanded in t around 0 71.1%
+-commutative71.1%
unpow271.1%
fma-def71.1%
Simplified71.1%
Taylor expanded in t around inf 67.7%
*-commutative67.7%
associate-*r*67.7%
*-commutative67.7%
Simplified67.7%
Final simplification69.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0)))) (if (<= t 1.0) (* t_1 t_2) (* t_1 (* t_2 t)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double t_2 = sqrt((z * 2.0));
double tmp;
if (t <= 1.0) {
tmp = t_1 * t_2;
} else {
tmp = t_1 * (t_2 * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 0.5d0) - y
t_2 = sqrt((z * 2.0d0))
if (t <= 1.0d0) then
tmp = t_1 * t_2
else
tmp = t_1 * (t_2 * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double t_2 = Math.sqrt((z * 2.0));
double tmp;
if (t <= 1.0) {
tmp = t_1 * t_2;
} else {
tmp = t_1 * (t_2 * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y t_2 = math.sqrt((z * 2.0)) tmp = 0 if t <= 1.0: tmp = t_1 * t_2 else: tmp = t_1 * (t_2 * t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) t_2 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 1.0) tmp = Float64(t_1 * t_2); else tmp = Float64(t_1 * Float64(t_2 * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; t_2 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 1.0) tmp = t_1 * t_2; else tmp = t_1 * (t_2 * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 1.0], N[(t$95$1 * t$95$2), $MachinePrecision], N[(t$95$1 * N[(t$95$2 * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 1:\\
\;\;\;\;t_1 \cdot t_2\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(t_2 \cdot t\right)\\
\end{array}
\end{array}
if t < 1Initial program 99.7%
sqr-neg99.7%
associate-/l*99.7%
distribute-frac-neg99.7%
exp-neg99.7%
associate-*r/99.7%
*-rgt-identity99.7%
associate-*r/99.7%
*-rgt-identity99.7%
associate-*r/99.7%
exp-neg99.7%
distribute-frac-neg99.7%
associate-/l*99.7%
sqr-neg99.7%
exp-sqrt99.7%
Simplified99.7%
expm1-log1p-u97.9%
expm1-udef67.2%
sqrt-unprod67.2%
associate-*l*67.2%
pow267.2%
Applied egg-rr67.2%
expm1-def97.9%
expm1-log1p99.7%
Simplified99.7%
Taylor expanded in t around 0 70.5%
if 1 < t Initial program 100.0%
sqr-neg100.0%
associate-/l*100.0%
distribute-frac-neg100.0%
exp-neg100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
*-rgt-identity100.0%
associate-*r/100.0%
exp-neg100.0%
distribute-frac-neg100.0%
associate-/l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow2100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
Simplified100.0%
Taylor expanded in t around 0 71.1%
+-commutative71.1%
unpow271.1%
fma-def71.1%
Simplified71.1%
Taylor expanded in t around inf 59.4%
associate-*l*59.4%
*-commutative59.4%
Simplified59.4%
sqrt-prod59.4%
Applied egg-rr59.4%
Final simplification68.1%
(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}
Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.4%
expm1-udef74.4%
sqrt-unprod74.4%
associate-*l*74.4%
pow274.4%
Applied egg-rr74.4%
expm1-def98.4%
expm1-log1p99.8%
Simplified99.8%
Taylor expanded in t around 0 61.7%
Final simplification61.7%
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) (* x 0.5)))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * (x * 0.5);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((z * 2.0d0)) * (x * 0.5d0)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * (x * 0.5);
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * (x * 0.5)
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * Float64(x * 0.5)) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * (x * 0.5); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 61.6%
Taylor expanded in x around inf 30.1%
associate-*r*30.1%
*-commutative30.1%
*-commutative30.1%
associate-*r*30.1%
*-commutative30.1%
Simplified30.1%
expm1-log1p-u18.8%
expm1-udef12.2%
*-commutative12.2%
*-commutative12.2%
associate-*l*12.2%
sqrt-prod12.2%
*-commutative12.2%
Applied egg-rr12.2%
expm1-def18.8%
expm1-log1p30.2%
*-commutative30.2%
*-commutative30.2%
Simplified30.2%
Final simplification30.2%
(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}
herbie shell --seed 2023318
(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))))