
(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 12 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 (exp (* t t))) (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * (sqrt(exp((t * t))) * 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(exp((t * t))) * 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(Math.exp((t * t))) * Math.sqrt((z * 2.0)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * (math.sqrt(math.exp((t * t))) * math.sqrt((z * 2.0)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * Float64(sqrt(exp(Float64(t * t))) * sqrt(Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * (sqrt(exp((t * t))) * sqrt((z * 2.0))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[(N[Sqrt[N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \left(\sqrt{e^{t \cdot t}} \cdot \sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.4%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
exp-sqrt99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (exp (pow t 2.0)) (* z 2.0)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((exp(pow(t, 2.0)) * (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((exp((t ** 2.0d0)) * (z * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((Math.exp(Math.pow(t, 2.0)) * (z * 2.0)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((math.exp(math.pow(t, 2.0)) * (z * 2.0)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(exp((t ^ 2.0)) * Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((exp((t ^ 2.0)) * (z * 2.0))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[Exp[N[Power[t, 2.0], $MachinePrecision]], $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{e^{{t}^{2}} \cdot \left(z \cdot 2\right)}
\end{array}
Initial program 99.4%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
exp-sqrt99.8%
Simplified99.8%
exp-sqrt99.8%
add099.8%
exp-sqrt99.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow299.8%
Applied egg-rr99.8%
add099.8%
*-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= (* t t) 80000000.0)
(* (- (* x 0.5) y) t_1)
(* (exp (/ (* t t) 2.0)) (* (* x 0.5) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t * t) <= 80000000.0) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = exp(((t * t) / 2.0)) * ((x * 0.5) * 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 * t) <= 80000000.0d0) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = exp(((t * t) / 2.0d0)) * ((x * 0.5d0) * 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 * t) <= 80000000.0) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = Math.exp(((t * t) / 2.0)) * ((x * 0.5) * t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t * t) <= 80000000.0: tmp = ((x * 0.5) - y) * t_1 else: tmp = math.exp(((t * t) / 2.0)) * ((x * 0.5) * t_1) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (Float64(t * t) <= 80000000.0) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(Float64(x * 0.5) * 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 * t) <= 80000000.0) tmp = ((x * 0.5) - y) * t_1; else tmp = exp(((t * t) / 2.0)) * ((x * 0.5) * 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[N[(t * t), $MachinePrecision], 80000000.0], 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[(N[(x * 0.5), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 80000000:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(\left(x \cdot 0.5\right) \cdot t\_1\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 8e7Initial program 99.6%
Taylor expanded in t around 0 97.9%
associate-*r*97.9%
sqrt-prod98.3%
*-commutative98.3%
pow1/298.3%
metadata-eval98.3%
pow-div98.1%
pow198.1%
pow1/298.1%
pow198.1%
metadata-eval98.1%
pow-div58.6%
pow158.6%
*-commutative58.6%
add058.6%
Applied egg-rr98.3%
add098.3%
*-commutative98.3%
Simplified98.3%
if 8e7 < (*.f64 t t) Initial program 99.3%
add099.3%
flip-+83.7%
*-commutative83.7%
*-commutative83.7%
swap-sqr82.2%
add-sqr-sqrt82.2%
pow282.2%
fma-neg82.2%
metadata-eval82.2%
fma-neg82.2%
Applied egg-rr82.2%
--rgt-identity82.2%
--rgt-identity82.2%
*-commutative82.2%
times-frac95.6%
fma-neg95.6%
*-commutative95.6%
fma-neg95.6%
*-commutative95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in x around inf 68.1%
pow168.1%
pow1/268.1%
pow-div68.1%
metadata-eval68.1%
pow1/268.1%
add068.1%
Applied egg-rr68.1%
add068.1%
*-commutative68.1%
Simplified68.1%
Final simplification82.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 5.5e+37)
(* t_1 (sqrt (* z 2.0)))
(sqrt (* (* z 2.0) (pow t_1 2.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 5.5e+37) {
tmp = t_1 * sqrt((z * 2.0));
} else {
tmp = sqrt(((z * 2.0) * pow(t_1, 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 <= 5.5d+37) then
tmp = t_1 * sqrt((z * 2.0d0))
else
tmp = sqrt(((z * 2.0d0) * (t_1 ** 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 <= 5.5e+37) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(((z * 2.0) * Math.pow(t_1, 2.0)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 5.5e+37: tmp = t_1 * math.sqrt((z * 2.0)) else: tmp = math.sqrt(((z * 2.0) * math.pow(t_1, 2.0))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 5.5e+37) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(Float64(z * 2.0) * (t_1 ^ 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 <= 5.5e+37) tmp = t_1 * sqrt((z * 2.0)); else tmp = sqrt(((z * 2.0) * (t_1 ^ 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, 5.5e+37], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 5.5 \cdot 10^{+37}:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot {t\_1}^{2}}\\
\end{array}
\end{array}
if t < 5.50000000000000016e37Initial program 99.2%
Taylor expanded in t around 0 68.0%
associate-*r*68.0%
sqrt-prod68.3%
*-commutative68.3%
pow1/268.3%
metadata-eval68.3%
pow-div68.1%
pow168.1%
pow1/268.1%
pow168.1%
metadata-eval68.1%
pow-div52.7%
pow152.7%
*-commutative52.7%
add052.7%
Applied egg-rr68.3%
add068.3%
*-commutative68.3%
Simplified68.3%
if 5.50000000000000016e37 < t Initial program 100.0%
Taylor expanded in t around 0 13.2%
Applied egg-rr22.7%
associate-*r*22.7%
*-commutative22.7%
Simplified22.7%
Final simplification56.2%
(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.4%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0))))
(if (<= t 1.95e-10)
(* t_1 t_2)
(if (<= t 1.25e+181)
(* (/ 1.0 t_2) (* t_1 (* z 2.0)))
(/ (* z -2.0) (/ (- t_2) t_1))))))
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.95e-10) {
tmp = t_1 * t_2;
} else if (t <= 1.25e+181) {
tmp = (1.0 / t_2) * (t_1 * (z * 2.0));
} else {
tmp = (z * -2.0) / (-t_2 / 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) :: t_2
real(8) :: tmp
t_1 = (x * 0.5d0) - y
t_2 = sqrt((z * 2.0d0))
if (t <= 1.95d-10) then
tmp = t_1 * t_2
else if (t <= 1.25d+181) then
tmp = (1.0d0 / t_2) * (t_1 * (z * 2.0d0))
else
tmp = (z * (-2.0d0)) / (-t_2 / t_1)
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.95e-10) {
tmp = t_1 * t_2;
} else if (t <= 1.25e+181) {
tmp = (1.0 / t_2) * (t_1 * (z * 2.0));
} else {
tmp = (z * -2.0) / (-t_2 / t_1);
}
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.95e-10: tmp = t_1 * t_2 elif t <= 1.25e+181: tmp = (1.0 / t_2) * (t_1 * (z * 2.0)) else: tmp = (z * -2.0) / (-t_2 / t_1) 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.95e-10) tmp = Float64(t_1 * t_2); elseif (t <= 1.25e+181) tmp = Float64(Float64(1.0 / t_2) * Float64(t_1 * Float64(z * 2.0))); else tmp = Float64(Float64(z * -2.0) / Float64(Float64(-t_2) / t_1)); 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.95e-10) tmp = t_1 * t_2; elseif (t <= 1.25e+181) tmp = (1.0 / t_2) * (t_1 * (z * 2.0)); else tmp = (z * -2.0) / (-t_2 / t_1); 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.95e-10], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t, 1.25e+181], N[(N[(1.0 / t$95$2), $MachinePrecision] * N[(t$95$1 * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * -2.0), $MachinePrecision] / N[((-t$95$2) / t$95$1), $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.95 \cdot 10^{-10}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+181}:\\
\;\;\;\;\frac{1}{t\_2} \cdot \left(t\_1 \cdot \left(z \cdot 2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot -2}{\frac{-t\_2}{t\_1}}\\
\end{array}
\end{array}
if t < 1.95e-10Initial program 99.2%
Taylor expanded in t around 0 71.0%
associate-*r*71.0%
sqrt-prod71.3%
*-commutative71.3%
pow1/271.3%
metadata-eval71.3%
pow-div71.1%
pow171.1%
pow1/271.1%
pow171.1%
metadata-eval71.1%
pow-div53.4%
pow153.4%
*-commutative53.4%
add053.4%
Applied egg-rr71.3%
add071.3%
*-commutative71.3%
Simplified71.3%
if 1.95e-10 < t < 1.2500000000000001e181Initial program 100.0%
Taylor expanded in t around 0 12.3%
associate-*r*12.3%
sqrt-prod12.3%
*-commutative12.3%
pow1/212.3%
metadata-eval12.3%
pow-div12.3%
pow112.3%
pow1/212.3%
pow112.3%
metadata-eval12.3%
pow-div50.6%
pow150.6%
*-commutative50.6%
associate-*r/52.9%
clear-num52.9%
Applied egg-rr25.6%
associate-/r/25.6%
*-commutative25.6%
Simplified25.6%
if 1.2500000000000001e181 < t Initial program 100.0%
Taylor expanded in t around 0 14.7%
associate-*r*14.7%
sqrt-prod14.7%
*-commutative14.7%
pow1/214.7%
metadata-eval14.7%
pow-div14.7%
pow114.7%
pow1/214.7%
pow114.7%
metadata-eval14.7%
pow-div58.1%
pow158.1%
*-commutative58.1%
clear-num58.1%
frac-2neg58.1%
frac-times58.1%
Applied egg-rr27.6%
*-commutative27.6%
distribute-lft-neg-out27.6%
associate-*r/27.6%
*-rgt-identity27.6%
*-commutative27.6%
Simplified27.6%
Final simplification57.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0))))
(if (<= t 5e-11)
(* t_1 t_2)
(if (<= t 6.4e+180)
(/ (* t_1 (* z 2.0)) t_2)
(/ (* z -2.0) (/ (- t_2) t_1))))))
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 <= 5e-11) {
tmp = t_1 * t_2;
} else if (t <= 6.4e+180) {
tmp = (t_1 * (z * 2.0)) / t_2;
} else {
tmp = (z * -2.0) / (-t_2 / 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) :: t_2
real(8) :: tmp
t_1 = (x * 0.5d0) - y
t_2 = sqrt((z * 2.0d0))
if (t <= 5d-11) then
tmp = t_1 * t_2
else if (t <= 6.4d+180) then
tmp = (t_1 * (z * 2.0d0)) / t_2
else
tmp = (z * (-2.0d0)) / (-t_2 / t_1)
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 <= 5e-11) {
tmp = t_1 * t_2;
} else if (t <= 6.4e+180) {
tmp = (t_1 * (z * 2.0)) / t_2;
} else {
tmp = (z * -2.0) / (-t_2 / t_1);
}
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 <= 5e-11: tmp = t_1 * t_2 elif t <= 6.4e+180: tmp = (t_1 * (z * 2.0)) / t_2 else: tmp = (z * -2.0) / (-t_2 / t_1) 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 <= 5e-11) tmp = Float64(t_1 * t_2); elseif (t <= 6.4e+180) tmp = Float64(Float64(t_1 * Float64(z * 2.0)) / t_2); else tmp = Float64(Float64(z * -2.0) / Float64(Float64(-t_2) / t_1)); 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 <= 5e-11) tmp = t_1 * t_2; elseif (t <= 6.4e+180) tmp = (t_1 * (z * 2.0)) / t_2; else tmp = (z * -2.0) / (-t_2 / t_1); 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, 5e-11], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t, 6.4e+180], N[(N[(t$95$1 * N[(z * 2.0), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], N[(N[(z * -2.0), $MachinePrecision] / N[((-t$95$2) / t$95$1), $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 5 \cdot 10^{-11}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t \leq 6.4 \cdot 10^{+180}:\\
\;\;\;\;\frac{t\_1 \cdot \left(z \cdot 2\right)}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot -2}{\frac{-t\_2}{t\_1}}\\
\end{array}
\end{array}
if t < 5.00000000000000018e-11Initial program 99.2%
Taylor expanded in t around 0 71.0%
associate-*r*71.0%
sqrt-prod71.3%
*-commutative71.3%
pow1/271.3%
metadata-eval71.3%
pow-div71.1%
pow171.1%
pow1/271.1%
pow171.1%
metadata-eval71.1%
pow-div53.4%
pow153.4%
*-commutative53.4%
add053.4%
Applied egg-rr71.3%
add071.3%
*-commutative71.3%
Simplified71.3%
if 5.00000000000000018e-11 < t < 6.39999999999999987e180Initial program 100.0%
Taylor expanded in t around 0 12.3%
associate-*r*12.3%
sqrt-prod12.3%
*-commutative12.3%
pow1/212.3%
metadata-eval12.3%
pow-div12.3%
pow112.3%
pow1/212.3%
pow112.3%
metadata-eval12.3%
pow-div50.6%
pow150.6%
*-commutative50.6%
associate-*r/52.9%
Applied egg-rr25.6%
if 6.39999999999999987e180 < t Initial program 100.0%
Taylor expanded in t around 0 14.7%
associate-*r*14.7%
sqrt-prod14.7%
*-commutative14.7%
pow1/214.7%
metadata-eval14.7%
pow-div14.7%
pow114.7%
pow1/214.7%
pow114.7%
metadata-eval14.7%
pow-div58.1%
pow158.1%
*-commutative58.1%
clear-num58.1%
frac-2neg58.1%
frac-times58.1%
Applied egg-rr27.6%
*-commutative27.6%
distribute-lft-neg-out27.6%
associate-*r/27.6%
*-rgt-identity27.6%
*-commutative27.6%
Simplified27.6%
Final simplification57.6%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0)))) (if (<= t 1.95e-10) (* t_1 t_2) (/ (* t_1 (* z 2.0)) t_2))))
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.95e-10) {
tmp = t_1 * t_2;
} else {
tmp = (t_1 * (z * 2.0)) / t_2;
}
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.95d-10) then
tmp = t_1 * t_2
else
tmp = (t_1 * (z * 2.0d0)) / t_2
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.95e-10) {
tmp = t_1 * t_2;
} else {
tmp = (t_1 * (z * 2.0)) / t_2;
}
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.95e-10: tmp = t_1 * t_2 else: tmp = (t_1 * (z * 2.0)) / t_2 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.95e-10) tmp = Float64(t_1 * t_2); else tmp = Float64(Float64(t_1 * Float64(z * 2.0)) / t_2); 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.95e-10) tmp = t_1 * t_2; else tmp = (t_1 * (z * 2.0)) / t_2; 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.95e-10], N[(t$95$1 * t$95$2), $MachinePrecision], N[(N[(t$95$1 * N[(z * 2.0), $MachinePrecision]), $MachinePrecision] / t$95$2), $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.95 \cdot 10^{-10}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1 \cdot \left(z \cdot 2\right)}{t\_2}\\
\end{array}
\end{array}
if t < 1.95e-10Initial program 99.2%
Taylor expanded in t around 0 71.0%
associate-*r*71.0%
sqrt-prod71.3%
*-commutative71.3%
pow1/271.3%
metadata-eval71.3%
pow-div71.1%
pow171.1%
pow1/271.1%
pow171.1%
metadata-eval71.1%
pow-div53.4%
pow153.4%
*-commutative53.4%
add053.4%
Applied egg-rr71.3%
add071.3%
*-commutative71.3%
Simplified71.3%
if 1.95e-10 < t Initial program 100.0%
Taylor expanded in t around 0 13.4%
associate-*r*13.4%
sqrt-prod13.4%
*-commutative13.4%
pow1/213.4%
metadata-eval13.4%
pow-div13.4%
pow113.4%
pow1/213.4%
pow113.4%
metadata-eval13.4%
pow-div54.2%
pow154.2%
*-commutative54.2%
associate-*r/56.6%
Applied egg-rr22.8%
Final simplification56.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= x -6.4e+72) (not (<= x 2.9e+61)))
(/ (* x z) 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 <= -6.4e+72) || !(x <= 2.9e+61)) {
tmp = (x * z) / 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 <= (-6.4d+72)) .or. (.not. (x <= 2.9d+61))) then
tmp = (x * z) / 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 <= -6.4e+72) || !(x <= 2.9e+61)) {
tmp = (x * z) / 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 <= -6.4e+72) or not (x <= 2.9e+61): tmp = (x * z) / 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 <= -6.4e+72) || !(x <= 2.9e+61)) tmp = Float64(Float64(x * z) / 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 <= -6.4e+72) || ~((x <= 2.9e+61))) tmp = (x * z) / 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, -6.4e+72], N[Not[LessEqual[x, 2.9e+61]], $MachinePrecision]], N[(N[(x * z), $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 -6.4 \cdot 10^{+72} \lor \neg \left(x \leq 2.9 \cdot 10^{+61}\right):\\
\;\;\;\;\frac{x \cdot z}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-t\_1\right)\\
\end{array}
\end{array}
if x < -6.4000000000000003e72 or 2.9000000000000001e61 < x Initial program 99.8%
Taylor expanded in t around 0 58.0%
associate-*r*58.0%
sqrt-prod58.2%
*-commutative58.2%
pow1/258.2%
metadata-eval58.2%
pow-div58.1%
pow158.1%
pow1/258.1%
pow158.1%
metadata-eval58.1%
pow-div57.0%
pow157.0%
*-commutative57.0%
associate-*r/56.1%
Applied egg-rr59.9%
Taylor expanded in x around inf 48.0%
if -6.4000000000000003e72 < x < 2.9000000000000001e61Initial program 99.2%
Taylor expanded in t around 0 50.6%
Taylor expanded in x around 0 39.7%
mul-1-neg39.7%
associate-*l*39.8%
*-commutative39.8%
distribute-lft-neg-in39.8%
*-commutative39.8%
Simplified39.8%
sqrt-prod39.8%
distribute-lft-neg-out39.8%
neg-sub039.8%
add-sqr-sqrt15.4%
sqrt-unprod21.9%
sqr-neg21.9%
sqrt-unprod1.9%
add-sqr-sqrt2.5%
*-commutative2.5%
add-sqr-sqrt1.9%
sqrt-unprod21.9%
sqr-neg21.9%
sqrt-unprod15.4%
add-sqr-sqrt39.8%
Applied egg-rr39.8%
neg-sub039.8%
distribute-rgt-neg-in39.8%
Simplified39.8%
Final simplification43.0%
(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.4%
Taylor expanded in t around 0 53.5%
associate-*r*53.5%
sqrt-prod53.6%
*-commutative53.6%
pow1/253.6%
metadata-eval53.6%
pow-div53.5%
pow153.5%
pow1/253.5%
pow153.5%
metadata-eval53.5%
pow-div53.6%
pow153.6%
*-commutative53.6%
add053.6%
Applied egg-rr53.6%
add053.6%
*-commutative53.6%
Simplified53.6%
Final simplification53.6%
(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.4%
Taylor expanded in t around 0 53.5%
Taylor expanded in x around 0 28.8%
mul-1-neg28.8%
associate-*l*28.8%
*-commutative28.8%
distribute-lft-neg-in28.8%
*-commutative28.8%
Simplified28.8%
sqrt-prod28.9%
distribute-lft-neg-out28.9%
neg-sub028.9%
add-sqr-sqrt11.6%
sqrt-unprod16.4%
sqr-neg16.4%
sqrt-unprod1.6%
add-sqr-sqrt2.7%
*-commutative2.7%
add-sqr-sqrt1.6%
sqrt-unprod16.4%
sqr-neg16.4%
sqrt-unprod11.6%
add-sqr-sqrt28.9%
Applied egg-rr28.9%
neg-sub028.9%
distribute-rgt-neg-in28.9%
Simplified28.9%
Final simplification28.9%
(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.4%
Taylor expanded in t around 0 53.5%
Taylor expanded in x around 0 28.8%
mul-1-neg28.8%
associate-*l*28.8%
*-commutative28.8%
distribute-lft-neg-in28.8%
*-commutative28.8%
Simplified28.8%
sqrt-prod28.9%
add028.9%
*-commutative28.9%
add-sqr-sqrt17.2%
sqrt-unprod16.6%
sqr-neg16.6%
sqrt-unprod1.2%
add-sqr-sqrt2.7%
Applied egg-rr2.7%
*-commutative2.7%
add02.7%
Simplified2.7%
Final simplification2.7%
(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 2024034
(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))))