
(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 13 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 (* (- (* x 0.5) y) (sqrt (* (* z 2.0) (exp (pow t 2.0))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((z * 2.0) * exp(pow(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 ** 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(Math.pow(t, 2.0))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((z * 2.0) * math.exp(math.pow(t, 2.0))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(z * 2.0) * exp((t ^ 2.0))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((z * 2.0) * exp((t ^ 2.0)))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[Exp[N[Power[t, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot e^{{t}^{2}}}
\end{array}
Initial program 99.5%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow-exp99.8%
pow299.8%
Applied egg-rr99.8%
unpow199.8%
associate-*r*99.8%
Simplified99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0))))
(if (<= (* t t) 4e-5)
(* t_1 (sqrt (* (* z 2.0) (fma t t 1.0))))
(if (<= (* t t) 5e+208)
(* (exp (/ (* t t) 2.0)) (* y (- t_2)))
(* t_1 (* t_2 (* 0.5 (pow t 2.0))))))))
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 * t) <= 4e-5) {
tmp = t_1 * sqrt(((z * 2.0) * fma(t, t, 1.0)));
} else if ((t * t) <= 5e+208) {
tmp = exp(((t * t) / 2.0)) * (y * -t_2);
} else {
tmp = t_1 * (t_2 * (0.5 * pow(t, 2.0)));
}
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 (Float64(t * t) <= 4e-5) tmp = Float64(t_1 * sqrt(Float64(Float64(z * 2.0) * fma(t, t, 1.0)))); elseif (Float64(t * t) <= 5e+208) tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(y * Float64(-t_2))); else tmp = Float64(t_1 * Float64(t_2 * Float64(0.5 * (t ^ 2.0)))); end return 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[N[(t * t), $MachinePrecision], 4e-5], N[(t$95$1 * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * t), $MachinePrecision], 5e+208], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(y * (-t$95$2)), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$2 * N[(0.5 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 4 \cdot 10^{-5}:\\
\;\;\;\;t\_1 \cdot \sqrt{\left(z \cdot 2\right) \cdot \mathsf{fma}\left(t, t, 1\right)}\\
\mathbf{elif}\;t \cdot t \leq 5 \cdot 10^{+208}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(y \cdot \left(-t\_2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_2 \cdot \left(0.5 \cdot {t}^{2}\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 4.00000000000000033e-5Initial program 99.7%
associate-*l*99.7%
exp-sqrt99.7%
exp-prod99.7%
Simplified99.7%
pow199.7%
sqrt-unprod99.7%
associate-*l*99.7%
pow-exp99.7%
pow299.7%
Applied egg-rr99.7%
unpow199.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in t around 0 99.7%
+-commutative99.7%
unpow299.7%
fma-define99.7%
Simplified99.7%
if 4.00000000000000033e-5 < (*.f64 t t) < 5.0000000000000004e208Initial program 97.6%
Taylor expanded in x around 0 73.8%
mul-1-neg73.8%
*-commutative73.8%
distribute-rgt-neg-in73.8%
*-commutative73.8%
distribute-rgt-neg-in73.8%
Simplified73.8%
associate-*r*73.7%
sqrt-prod73.8%
distribute-rgt-neg-out73.8%
Applied egg-rr73.8%
distribute-rgt-neg-in73.8%
*-commutative73.8%
Simplified73.8%
if 5.0000000000000004e208 < (*.f64 t t) Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 48.3%
Taylor expanded in t around 0 96.4%
Taylor expanded in t around inf 96.4%
Final simplification94.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (* t t) 4e-5) (not (<= (* t t) 5e+208))) (* (- (* x 0.5) y) (sqrt (* (* z 2.0) (fma t t 1.0)))) (* (exp (/ (* t t) 2.0)) (* y (- (sqrt (* z 2.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (((t * t) <= 4e-5) || !((t * t) <= 5e+208)) {
tmp = ((x * 0.5) - y) * sqrt(((z * 2.0) * fma(t, t, 1.0)));
} else {
tmp = exp(((t * t) / 2.0)) * (y * -sqrt((z * 2.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((Float64(t * t) <= 4e-5) || !(Float64(t * t) <= 5e+208)) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(z * 2.0) * fma(t, t, 1.0)))); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(y * Float64(-sqrt(Float64(z * 2.0))))); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(t * t), $MachinePrecision], 4e-5], N[Not[LessEqual[N[(t * t), $MachinePrecision], 5e+208]], $MachinePrecision]], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(y * (-N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 4 \cdot 10^{-5} \lor \neg \left(t \cdot t \leq 5 \cdot 10^{+208}\right):\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot \mathsf{fma}\left(t, t, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(y \cdot \left(-\sqrt{z \cdot 2}\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 4.00000000000000033e-5 or 5.0000000000000004e208 < (*.f64 t t) Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow-exp99.8%
pow299.8%
Applied egg-rr99.8%
unpow199.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in t around 0 97.2%
+-commutative97.2%
unpow297.2%
fma-define97.2%
Simplified97.2%
if 4.00000000000000033e-5 < (*.f64 t t) < 5.0000000000000004e208Initial program 97.6%
Taylor expanded in x around 0 73.8%
mul-1-neg73.8%
*-commutative73.8%
distribute-rgt-neg-in73.8%
*-commutative73.8%
distribute-rgt-neg-in73.8%
Simplified73.8%
associate-*r*73.7%
sqrt-prod73.8%
distribute-rgt-neg-out73.8%
Applied egg-rr73.8%
distribute-rgt-neg-in73.8%
*-commutative73.8%
Simplified73.8%
Final simplification93.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= t 0.04)
(* (- (* x 0.5) y) t_1)
(* (exp (/ (* t t) 2.0)) (* y (- t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t <= 0.04) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = exp(((t * t) / 2.0)) * (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 (t <= 0.04d0) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = exp(((t * t) / 2.0d0)) * (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 (t <= 0.04) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = Math.exp(((t * t) / 2.0)) * (y * -t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t <= 0.04: tmp = ((x * 0.5) - y) * t_1 else: tmp = math.exp(((t * t) / 2.0)) * (y * -t_1) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 0.04) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * 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 (t <= 0.04) tmp = ((x * 0.5) - y) * t_1; else tmp = exp(((t * t) / 2.0)) * (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[LessEqual[t, 0.04], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(y * (-t$95$1)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 0.04:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(y \cdot \left(-t\_1\right)\right)\\
\end{array}
\end{array}
if t < 0.0400000000000000008Initial program 99.3%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow-exp99.8%
pow299.8%
Applied egg-rr99.8%
unpow199.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in t around 0 72.9%
if 0.0400000000000000008 < t Initial program 100.0%
Taylor expanded in x around 0 76.3%
mul-1-neg76.3%
*-commutative76.3%
distribute-rgt-neg-in76.3%
*-commutative76.3%
distribute-rgt-neg-in76.3%
Simplified76.3%
associate-*r*76.3%
sqrt-prod76.3%
distribute-rgt-neg-out76.3%
Applied egg-rr76.3%
distribute-rgt-neg-in76.3%
*-commutative76.3%
Simplified76.3%
Final simplification73.7%
(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.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0)))) (if (<= t 3.4) (* (- (* x 0.5) y) t_1) (* t_1 (/ (pow y 2.0) (- y))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t <= 3.4) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_1 * (pow(y, 2.0) / -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) :: tmp
t_1 = sqrt((z * 2.0d0))
if (t <= 3.4d0) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = t_1 * ((y ** 2.0d0) / -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 tmp;
if (t <= 3.4) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_1 * (Math.pow(y, 2.0) / -y);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t <= 3.4: tmp = ((x * 0.5) - y) * t_1 else: tmp = t_1 * (math.pow(y, 2.0) / -y) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 3.4) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(t_1 * Float64((y ^ 2.0) / Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 3.4) tmp = ((x * 0.5) - y) * t_1; else tmp = t_1 * ((y ^ 2.0) / -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 3.4], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[(N[Power[y, 2.0], $MachinePrecision] / (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 3.4:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \frac{{y}^{2}}{-y}\\
\end{array}
\end{array}
if t < 3.39999999999999991Initial program 99.3%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow-exp99.8%
pow299.8%
Applied egg-rr99.8%
unpow199.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in t around 0 72.9%
if 3.39999999999999991 < t Initial program 100.0%
Taylor expanded in t around 0 10.7%
Taylor expanded in x around 0 4.9%
mul-1-neg4.9%
Simplified4.9%
neg-sub04.9%
flip--28.8%
metadata-eval28.8%
pow228.8%
add-sqr-sqrt18.1%
sqrt-unprod1.3%
sqr-neg1.3%
sqrt-unprod2.0%
add-sqr-sqrt4.2%
sub-neg4.2%
neg-sub04.2%
add-sqr-sqrt2.0%
sqrt-unprod1.3%
sqr-neg1.3%
sqrt-unprod18.1%
add-sqr-sqrt28.8%
Applied egg-rr28.8%
sub0-neg28.8%
Simplified28.8%
Final simplification62.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= (* t t) 1.95e-5)
(* (- (* x 0.5) y) t_1)
(* t_1 (* y (+ (* 0.5 (/ x y)) -1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t * t) <= 1.95e-5) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_1 * (y * ((0.5 * (x / y)) + -1.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) <= 1.95d-5) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = t_1 * (y * ((0.5d0 * (x / y)) + (-1.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) <= 1.95e-5) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_1 * (y * ((0.5 * (x / y)) + -1.0));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t * t) <= 1.95e-5: tmp = ((x * 0.5) - y) * t_1 else: tmp = t_1 * (y * ((0.5 * (x / y)) + -1.0)) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (Float64(t * t) <= 1.95e-5) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(t_1 * Float64(y * Float64(Float64(0.5 * Float64(x / y)) + -1.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) <= 1.95e-5) tmp = ((x * 0.5) - y) * t_1; else tmp = t_1 * (y * ((0.5 * (x / y)) + -1.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], 1.95e-5], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[(y * N[(N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 1.95 \cdot 10^{-5}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(y \cdot \left(0.5 \cdot \frac{x}{y} + -1\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 1.95e-5Initial program 99.7%
associate-*l*99.7%
exp-sqrt99.7%
exp-prod99.7%
Simplified99.7%
pow199.7%
sqrt-unprod99.7%
associate-*l*99.7%
pow-exp99.7%
pow299.7%
Applied egg-rr99.7%
unpow199.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in t around 0 99.3%
if 1.95e-5 < (*.f64 t t) Initial program 99.2%
Taylor expanded in t around 0 14.4%
Taylor expanded in y around inf 26.1%
Final simplification64.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= x -1.12e-91) (not (<= x 4.6e+45)))
(* x (* 0.5 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.12e-91) || !(x <= 4.6e+45)) {
tmp = x * (0.5 * 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.12d-91)) .or. (.not. (x <= 4.6d+45))) then
tmp = x * (0.5d0 * 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.12e-91) || !(x <= 4.6e+45)) {
tmp = x * (0.5 * 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.12e-91) or not (x <= 4.6e+45): tmp = x * (0.5 * 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.12e-91) || !(x <= 4.6e+45)) tmp = Float64(x * Float64(0.5 * 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.12e-91) || ~((x <= 4.6e+45))) tmp = x * (0.5 * 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.12e-91], N[Not[LessEqual[x, 4.6e+45]], $MachinePrecision]], N[(x * N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(y * (-t$95$1)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;x \leq -1.12 \cdot 10^{-91} \lor \neg \left(x \leq 4.6 \cdot 10^{+45}\right):\\
\;\;\;\;x \cdot \left(0.5 \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-t\_1\right)\\
\end{array}
\end{array}
if x < -1.12e-91 or 4.60000000000000025e45 < x Initial program 99.8%
Taylor expanded in t around 0 62.0%
Taylor expanded in x around inf 53.2%
associate-*l*53.1%
Simplified53.1%
pow153.1%
*-commutative53.1%
*-commutative53.1%
sqrt-prod53.3%
Applied egg-rr53.3%
unpow153.3%
associate-*r*53.3%
*-commutative53.3%
Simplified53.3%
if -1.12e-91 < x < 4.60000000000000025e45Initial program 99.0%
Taylor expanded in t around 0 54.5%
Taylor expanded in x around 0 44.9%
mul-1-neg44.9%
Simplified44.9%
*-rgt-identity44.9%
distribute-lft-neg-out44.9%
neg-sub044.9%
Applied egg-rr44.9%
neg-sub044.9%
*-commutative44.9%
distribute-rgt-neg-in44.9%
*-commutative44.9%
Simplified44.9%
Final simplification49.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0)))) (if (<= t 4.2e-14) (* (- (* x 0.5) y) t_1) (* t_1 (* x (- 0.5 (/ y x)))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t <= 4.2e-14) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_1 * (x * (0.5 - (y / x)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if (t <= 4.2d-14) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = t_1 * (x * (0.5d0 - (y / x)))
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 <= 4.2e-14) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_1 * (x * (0.5 - (y / x)));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t <= 4.2e-14: tmp = ((x * 0.5) - y) * t_1 else: tmp = t_1 * (x * (0.5 - (y / x))) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 4.2e-14) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(t_1 * Float64(x * Float64(0.5 - Float64(y / x)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 4.2e-14) tmp = ((x * 0.5) - y) * t_1; else tmp = t_1 * (x * (0.5 - (y / x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 4.2e-14], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[(x * N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 4.2 \cdot 10^{-14}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)\\
\end{array}
\end{array}
if t < 4.1999999999999998e-14Initial program 99.3%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow-exp99.8%
pow299.8%
Applied egg-rr99.8%
unpow199.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in t around 0 72.5%
if 4.1999999999999998e-14 < t Initial program 100.0%
Taylor expanded in t around 0 14.8%
Taylor expanded in x around inf 28.6%
mul-1-neg28.6%
unsub-neg28.6%
Simplified28.6%
Final simplification61.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0)))) (if (<= t 0.82) (* (- (* x 0.5) y) t_1) (* t_1 (* x (/ (- y) x))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t <= 0.82) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_1 * (x * (-y / x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if (t <= 0.82d0) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = t_1 * (x * (-y / x))
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 <= 0.82) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_1 * (x * (-y / x));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t <= 0.82: tmp = ((x * 0.5) - y) * t_1 else: tmp = t_1 * (x * (-y / x)) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 0.82) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(t_1 * Float64(x * Float64(Float64(-y) / x))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 0.82) tmp = ((x * 0.5) - y) * t_1; else tmp = t_1 * (x * (-y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 0.82], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * N[(x * N[((-y) / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 0.82:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot \frac{-y}{x}\right)\\
\end{array}
\end{array}
if t < 0.819999999999999951Initial program 99.3%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow-exp99.8%
pow299.8%
Applied egg-rr99.8%
unpow199.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in t around 0 72.9%
if 0.819999999999999951 < t Initial program 100.0%
Taylor expanded in t around 0 10.7%
Taylor expanded in x around inf 25.2%
mul-1-neg25.2%
unsub-neg25.2%
Simplified25.2%
Taylor expanded in y around inf 19.5%
neg-mul-119.5%
distribute-neg-frac219.5%
Simplified19.5%
Final simplification60.6%
(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.5%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow-exp99.8%
pow299.8%
Applied egg-rr99.8%
unpow199.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in t around 0 58.5%
Final simplification58.5%
(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}
Initial program 99.5%
Taylor expanded in t around 0 58.5%
Taylor expanded in x around 0 27.7%
mul-1-neg27.7%
Simplified27.7%
*-rgt-identity27.7%
distribute-lft-neg-out27.7%
neg-sub027.7%
Applied egg-rr27.7%
neg-sub027.7%
*-commutative27.7%
distribute-rgt-neg-in27.7%
*-commutative27.7%
Simplified27.7%
Final simplification27.7%
(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}
Initial program 99.5%
Taylor expanded in t around 0 58.5%
Taylor expanded in x around 0 27.7%
mul-1-neg27.7%
Simplified27.7%
*-rgt-identity27.7%
add-sqr-sqrt14.4%
sqrt-unprod15.4%
sqr-neg15.4%
sqrt-unprod1.7%
add-sqr-sqrt3.5%
pow13.5%
Applied egg-rr3.5%
unpow13.5%
*-commutative3.5%
Simplified3.5%
Final simplification3.5%
(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 2024146
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:alt
(! :herbie-platform default (* (* (- (* x 1/2) y) (sqrt (* z 2))) (pow (exp 1) (/ (* t t) 2))))
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))