
(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 (* 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(z * Float64(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[(z * N[(2.0 * N[Exp[N[Power[t, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot \left(2 \cdot e^{{t}^{2}}\right)}
\end{array}
Initial program 99.1%
sqr-neg99.1%
associate-/l*99.1%
distribute-frac-neg99.1%
exp-neg99.1%
associate-*r/99.1%
*-rgt-identity99.1%
associate-*r/99.9%
*-rgt-identity99.9%
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.0%
sqrt-unprod74.0%
associate-*l*74.0%
pow274.0%
Applied egg-rr74.0%
expm1-def98.4%
expm1-log1p99.9%
Simplified99.9%
Final simplification99.9%
(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.1%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 1.0)
(* t_1 (sqrt (* z 2.0)))
(* t_1 (sqrt (* (pow t 2.0) (* z 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 = t_1 * sqrt((pow(t, 2.0) * (z * 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 = t_1 * sqrt(((t ** 2.0d0) * (z * 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 = t_1 * Math.sqrt((Math.pow(t, 2.0) * (z * 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 = t_1 * math.sqrt((math.pow(t, 2.0) * (z * 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(t_1 * sqrt(Float64((t ^ 2.0) * Float64(z * 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 = t_1 * sqrt(((t ^ 2.0) * (z * 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[(t$95$1 * N[Sqrt[N[(N[Power[t, 2.0], $MachinePrecision] * N[(z * 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}:\\
\;\;\;\;t_1 \cdot \sqrt{{t}^{2} \cdot \left(z \cdot 2\right)}\\
\end{array}
\end{array}
if t < 1Initial program 99.3%
sqr-neg99.3%
associate-/l*99.3%
distribute-frac-neg99.3%
exp-neg99.3%
associate-*r/99.3%
*-rgt-identity99.3%
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.0%
expm1-udef66.9%
sqrt-unprod66.9%
associate-*l*66.9%
pow266.9%
Applied egg-rr66.9%
expm1-def98.0%
expm1-log1p99.8%
Simplified99.8%
Taylor expanded in t around 0 71.0%
if 1 < t Initial program 98.2%
sqr-neg98.2%
associate-/l*98.2%
distribute-frac-neg98.2%
exp-neg98.2%
associate-*r/98.2%
*-rgt-identity98.2%
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 79.3%
+-commutative79.3%
unpow279.3%
fma-def79.3%
Simplified79.3%
Taylor expanded in t around inf 79.3%
*-commutative79.3%
*-commutative79.3%
*-commutative79.3%
associate-*l*79.3%
Simplified79.3%
Final simplification72.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 1e+16)
(* t_1 (* (sqrt (* z 2.0)) (hypot 1.0 t)))
(* t_1 (sqrt (* (pow t 2.0) (* z 2.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 1e+16) {
tmp = t_1 * (sqrt((z * 2.0)) * hypot(1.0, t));
} else {
tmp = t_1 * sqrt((pow(t, 2.0) * (z * 2.0)));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 1e+16) {
tmp = t_1 * (Math.sqrt((z * 2.0)) * Math.hypot(1.0, t));
} else {
tmp = t_1 * Math.sqrt((Math.pow(t, 2.0) * (z * 2.0)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 1e+16: tmp = t_1 * (math.sqrt((z * 2.0)) * math.hypot(1.0, t)) else: tmp = t_1 * math.sqrt((math.pow(t, 2.0) * (z * 2.0))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 1e+16) tmp = Float64(t_1 * Float64(sqrt(Float64(z * 2.0)) * hypot(1.0, t))); else tmp = Float64(t_1 * sqrt(Float64((t ^ 2.0) * Float64(z * 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 <= 1e+16) tmp = t_1 * (sqrt((z * 2.0)) * hypot(1.0, t)); else tmp = t_1 * sqrt(((t ^ 2.0) * (z * 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, 1e+16], N[(t$95$1 * N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[Sqrt[1.0 ^ 2 + t ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(N[Power[t, 2.0], $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 10^{+16}:\\
\;\;\;\;t_1 \cdot \left(\sqrt{z \cdot 2} \cdot \mathsf{hypot}\left(1, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \sqrt{{t}^{2} \cdot \left(z \cdot 2\right)}\\
\end{array}
\end{array}
if t < 1e16Initial program 99.3%
sqr-neg99.3%
associate-/l*99.3%
distribute-frac-neg99.3%
exp-neg99.3%
associate-*r/99.3%
*-rgt-identity99.3%
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.0%
expm1-udef67.4%
sqrt-unprod67.4%
associate-*l*67.4%
pow267.4%
Applied egg-rr67.4%
expm1-def98.0%
expm1-log1p99.8%
Simplified99.8%
Taylor expanded in t around 0 89.2%
distribute-lft-out89.2%
*-commutative89.2%
Simplified89.2%
+-commutative89.2%
*-commutative89.2%
*-un-lft-identity89.2%
distribute-rgt-out89.2%
unpow289.2%
fma-udef89.2%
associate-*l*89.2%
*-commutative89.2%
sqrt-prod88.7%
*-commutative88.7%
Applied egg-rr88.7%
*-commutative88.7%
fma-udef88.7%
unpow288.7%
+-commutative88.7%
unpow288.7%
hypot-1-def83.6%
Simplified83.6%
if 1e16 < t Initial program 98.1%
sqr-neg98.1%
associate-/l*98.1%
distribute-frac-neg98.1%
exp-neg98.1%
associate-*r/98.1%
*-rgt-identity98.1%
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 81.7%
+-commutative81.7%
unpow281.7%
fma-def81.7%
Simplified81.7%
Taylor expanded in t around inf 81.7%
*-commutative81.7%
*-commutative81.7%
*-commutative81.7%
associate-*l*81.7%
Simplified81.7%
Final simplification83.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 1.0)
(* t_1 (sqrt (* z 2.0)))
(* (* t (* t_1 (sqrt 2.0))) (sqrt z)))))
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 = (t * (t_1 * sqrt(2.0))) * sqrt(z);
}
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 = (t * (t_1 * sqrt(2.0d0))) * sqrt(z)
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 = (t * (t_1 * Math.sqrt(2.0))) * Math.sqrt(z);
}
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 = (t * (t_1 * math.sqrt(2.0))) * math.sqrt(z) 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(Float64(t * Float64(t_1 * sqrt(2.0))) * sqrt(z)); 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 = (t * (t_1 * sqrt(2.0))) * sqrt(z); 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[(t * N[(t$95$1 * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $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}:\\
\;\;\;\;\left(t \cdot \left(t_1 \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\\
\end{array}
\end{array}
if t < 1Initial program 99.3%
sqr-neg99.3%
associate-/l*99.3%
distribute-frac-neg99.3%
exp-neg99.3%
associate-*r/99.3%
*-rgt-identity99.3%
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.0%
expm1-udef66.9%
sqrt-unprod66.9%
associate-*l*66.9%
pow266.9%
Applied egg-rr66.9%
expm1-def98.0%
expm1-log1p99.8%
Simplified99.8%
Taylor expanded in t around 0 71.0%
if 1 < t Initial program 98.2%
sqr-neg98.2%
associate-/l*98.2%
distribute-frac-neg98.2%
exp-neg98.2%
associate-*r/98.2%
*-rgt-identity98.2%
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 79.3%
distribute-lft-out79.3%
*-commutative79.3%
Simplified79.3%
Taylor expanded in t around inf 46.1%
Final simplification65.7%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* z (* 2.0 (fma t t 1.0))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((z * (2.0 * fma(t, t, 1.0))));
}
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * Float64(2.0 * fma(t, t, 1.0))))) end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * N[(2.0 * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot \left(2 \cdot \mathsf{fma}\left(t, t, 1\right)\right)}
\end{array}
Initial program 99.1%
sqr-neg99.1%
associate-/l*99.1%
distribute-frac-neg99.1%
exp-neg99.1%
associate-*r/99.1%
*-rgt-identity99.1%
associate-*r/99.9%
*-rgt-identity99.9%
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.0%
sqrt-unprod74.0%
associate-*l*74.0%
pow274.0%
Applied egg-rr74.0%
expm1-def98.4%
expm1-log1p99.9%
Simplified99.9%
Taylor expanded in t around 0 87.7%
+-commutative87.7%
unpow287.7%
fma-def87.7%
Simplified87.7%
Final simplification87.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 6.8e+20)
(* 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 <= 6.8e+20) {
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 <= 6.8d+20) 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 <= 6.8e+20) {
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 <= 6.8e+20: 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 <= 6.8e+20) 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 <= 6.8e+20) 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, 6.8e+20], 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 6.8 \cdot 10^{+20}:\\
\;\;\;\;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 < 6.8e20Initial program 99.3%
sqr-neg99.3%
associate-/l*99.3%
distribute-frac-neg99.3%
exp-neg99.3%
associate-*r/99.3%
*-rgt-identity99.3%
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.0%
expm1-udef67.6%
sqrt-unprod67.6%
associate-*l*67.6%
pow267.6%
Applied egg-rr67.6%
expm1-def98.1%
expm1-log1p99.8%
Simplified99.8%
Taylor expanded in t around 0 70.2%
if 6.8e20 < t Initial program 98.0%
Taylor expanded in t around 0 11.1%
*-commutative11.1%
associate-*r*11.1%
add-sqr-sqrt3.8%
sqrt-prod13.2%
unpow213.2%
sqrt-prod15.1%
sqrt-prod15.1%
*-commutative15.1%
associate-*l*15.1%
*-commutative15.1%
Applied egg-rr15.1%
Final simplification59.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= y -7.2e+37) (not (<= y 1.4e-59)))
(* t_1 (- y))
(* 0.5 (* x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((y <= -7.2e+37) || !(y <= 1.4e-59)) {
tmp = t_1 * -y;
} else {
tmp = 0.5 * (x * 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 ((y <= (-7.2d+37)) .or. (.not. (y <= 1.4d-59))) then
tmp = t_1 * -y
else
tmp = 0.5d0 * (x * 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 ((y <= -7.2e+37) || !(y <= 1.4e-59)) {
tmp = t_1 * -y;
} else {
tmp = 0.5 * (x * t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (y <= -7.2e+37) or not (y <= 1.4e-59): tmp = t_1 * -y else: tmp = 0.5 * (x * t_1) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if ((y <= -7.2e+37) || !(y <= 1.4e-59)) tmp = Float64(t_1 * Float64(-y)); else tmp = Float64(0.5 * Float64(x * t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((y <= -7.2e+37) || ~((y <= 1.4e-59))) tmp = t_1 * -y; else tmp = 0.5 * (x * 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[y, -7.2e+37], N[Not[LessEqual[y, 1.4e-59]], $MachinePrecision]], N[(t$95$1 * (-y)), $MachinePrecision], N[(0.5 * N[(x * t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;y \leq -7.2 \cdot 10^{+37} \lor \neg \left(y \leq 1.4 \cdot 10^{-59}\right):\\
\;\;\;\;t_1 \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot t_1\right)\\
\end{array}
\end{array}
if y < -7.19999999999999995e37 or 1.3999999999999999e-59 < y Initial program 99.8%
Taylor expanded in t around 0 63.2%
Taylor expanded in x around 0 51.0%
mul-1-neg51.0%
associate-*l*51.0%
*-commutative51.0%
*-commutative51.0%
distribute-rgt-neg-in51.0%
*-commutative51.0%
Simplified51.0%
sqrt-prod51.1%
*-commutative51.1%
Applied egg-rr51.1%
if -7.19999999999999995e37 < y < 1.3999999999999999e-59Initial program 98.3%
Taylor expanded in t around 0 53.2%
Taylor expanded in x around inf 43.3%
associate-*l*43.3%
Simplified43.3%
sqrt-prod11.7%
*-commutative11.7%
Applied egg-rr43.4%
Final simplification47.3%
(FPCore (x y z t) :precision binary64 (if (<= t 9.2e+86) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (sqrt (* (* z 2.0) (* y (- y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 9.2e+86) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt(((z * 2.0) * (y * (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) :: tmp
if (t <= 9.2d+86) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt(((z * 2.0d0) * (y * (y - x))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 9.2e+86) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(((z * 2.0) * (y * (y - x))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 9.2e+86: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt(((z * 2.0) * (y * (y - x)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 9.2e+86) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(Float64(z * 2.0) * Float64(y * Float64(y - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 9.2e+86) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = sqrt(((z * 2.0) * (y * (y - x)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 9.2e+86], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(y * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9.2 \cdot 10^{+86}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(y \cdot \left(y - x\right)\right)}\\
\end{array}
\end{array}
if t < 9.19999999999999958e86Initial program 99.3%
sqr-neg99.3%
associate-/l*99.3%
distribute-frac-neg99.3%
exp-neg99.3%
associate-*r/99.3%
*-rgt-identity99.3%
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.1%
expm1-udef68.6%
sqrt-unprod68.6%
associate-*l*68.6%
pow268.6%
Applied egg-rr68.6%
expm1-def98.1%
expm1-log1p99.8%
Simplified99.8%
Taylor expanded in t around 0 68.5%
if 9.19999999999999958e86 < t Initial program 97.7%
Taylor expanded in t around 0 10.0%
*-commutative10.0%
associate-*r*10.0%
add-sqr-sqrt4.1%
sqrt-prod12.9%
unpow212.9%
sqrt-prod15.1%
sqrt-prod15.1%
*-commutative15.1%
associate-*l*15.1%
*-commutative15.1%
Applied egg-rr15.1%
Taylor expanded in x around 0 12.5%
+-commutative12.5%
unpow212.5%
associate-*r*12.5%
distribute-rgt-out12.5%
mul-1-neg12.5%
Simplified12.5%
Final simplification58.8%
(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.1%
sqr-neg99.1%
associate-/l*99.1%
distribute-frac-neg99.1%
exp-neg99.1%
associate-*r/99.1%
*-rgt-identity99.1%
associate-*r/99.9%
*-rgt-identity99.9%
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.0%
sqrt-unprod74.0%
associate-*l*74.0%
pow274.0%
Applied egg-rr74.0%
expm1-def98.4%
expm1-log1p99.9%
Simplified99.9%
Taylor expanded in t around 0 58.4%
Final simplification58.4%
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) (- y)))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * -y;
}
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)) * -y
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * -y;
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * -y
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * Float64(-y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * -y; end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(-y\right)
\end{array}
Initial program 99.1%
Taylor expanded in t around 0 58.2%
Taylor expanded in x around 0 31.3%
mul-1-neg31.3%
associate-*l*31.3%
*-commutative31.3%
*-commutative31.3%
distribute-rgt-neg-in31.3%
*-commutative31.3%
Simplified31.3%
sqrt-prod31.4%
*-commutative31.4%
Applied egg-rr31.4%
Final simplification31.4%
(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.1%
Taylor expanded in t around 0 58.2%
Taylor expanded in x around 0 31.3%
mul-1-neg31.3%
associate-*l*31.3%
*-commutative31.3%
*-commutative31.3%
distribute-rgt-neg-in31.3%
*-commutative31.3%
Simplified31.3%
expm1-log1p-u21.5%
expm1-udef14.3%
*-commutative14.3%
sqrt-prod14.3%
pow1/214.3%
exp-to-pow14.2%
add-sqr-sqrt12.9%
sqrt-unprod14.6%
sqr-neg14.6%
sqrt-unprod1.2%
add-sqr-sqrt1.7%
*-commutative1.7%
exp-to-pow1.7%
pow1/21.7%
*-commutative1.7%
Applied egg-rr1.7%
expm1-def1.6%
expm1-log1p1.9%
*-commutative1.9%
Simplified1.9%
Final simplification1.9%
(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 2023308
(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))))