
(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.0%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.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)))
(if (<= t 2.4e+15)
(* t_1 (sqrt (* z 2.0)))
(if (<= t 1.36e+68)
(sqrt (* z (* 2.0 (* t_1 t_1))))
(* 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 <= 2.4e+15) {
tmp = t_1 * sqrt((z * 2.0));
} else if (t <= 1.36e+68) {
tmp = sqrt((z * (2.0 * (t_1 * t_1))));
} 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 <= 2.4d+15) then
tmp = t_1 * sqrt((z * 2.0d0))
else if (t <= 1.36d+68) then
tmp = sqrt((z * (2.0d0 * (t_1 * t_1))))
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 <= 2.4e+15) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else if (t <= 1.36e+68) {
tmp = Math.sqrt((z * (2.0 * (t_1 * t_1))));
} 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 <= 2.4e+15: tmp = t_1 * math.sqrt((z * 2.0)) elif t <= 1.36e+68: tmp = math.sqrt((z * (2.0 * (t_1 * t_1)))) 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 <= 2.4e+15) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); elseif (t <= 1.36e+68) tmp = sqrt(Float64(z * Float64(2.0 * Float64(t_1 * t_1)))); else tmp = Float64(t * Float64(t_1 * Float64(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 <= 2.4e+15) tmp = t_1 * sqrt((z * 2.0)); elseif (t <= 1.36e+68) tmp = sqrt((z * (2.0 * (t_1 * t_1)))); 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, 2.4e+15], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.36e+68], N[Sqrt[N[(z * N[(2.0 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t * N[(t$95$1 * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 2.4 \cdot 10^{+15}:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{elif}\;t \leq 1.36 \cdot 10^{+68}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(t\_1 \cdot t\_1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(t\_1 \cdot \left(\sqrt{2} \cdot \sqrt{z}\right)\right)\\
\end{array}
\end{array}
if t < 2.4e15Initial program 98.7%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.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 62.2%
if 2.4e15 < t < 1.3600000000000001e68Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 4.3%
*-commutative4.3%
sqrt-prod4.3%
associate-*r*4.3%
*-commutative4.3%
add-sqr-sqrt2.6%
sqrt-unprod34.0%
*-commutative34.0%
*-commutative34.0%
swap-sqr33.9%
add-sqr-sqrt33.9%
swap-sqr33.9%
rem-square-sqrt33.9%
pow233.9%
Applied egg-rr33.9%
*-commutative33.9%
pow233.9%
Applied egg-rr33.9%
if 1.3600000000000001e68 < t Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 82.4%
+-commutative82.4%
unpow282.4%
fma-define82.4%
Simplified82.4%
Taylor expanded in t around inf 57.4%
associate-*l*46.1%
*-commutative46.1%
associate-*r*46.1%
Simplified46.1%
Final simplification58.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0))))
(if (<= t 3e+15)
(* t_1 t_2)
(if (<= t 1.9e+164)
(sqrt (* z (* 2.0 (* t_1 t_1))))
(* y (* (hypot 1.0 t) (- 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 <= 3e+15) {
tmp = t_1 * t_2;
} else if (t <= 1.9e+164) {
tmp = sqrt((z * (2.0 * (t_1 * t_1))));
} else {
tmp = y * (hypot(1.0, t) * -t_2);
}
return tmp;
}
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 <= 3e+15) {
tmp = t_1 * t_2;
} else if (t <= 1.9e+164) {
tmp = Math.sqrt((z * (2.0 * (t_1 * t_1))));
} else {
tmp = y * (Math.hypot(1.0, t) * -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 <= 3e+15: tmp = t_1 * t_2 elif t <= 1.9e+164: tmp = math.sqrt((z * (2.0 * (t_1 * t_1)))) else: tmp = y * (math.hypot(1.0, t) * -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 <= 3e+15) tmp = Float64(t_1 * t_2); elseif (t <= 1.9e+164) tmp = sqrt(Float64(z * Float64(2.0 * Float64(t_1 * t_1)))); else tmp = Float64(y * Float64(hypot(1.0, t) * Float64(-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 <= 3e+15) tmp = t_1 * t_2; elseif (t <= 1.9e+164) tmp = sqrt((z * (2.0 * (t_1 * t_1)))); else tmp = y * (hypot(1.0, t) * -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, 3e+15], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t, 1.9e+164], N[Sqrt[N[(z * N[(2.0 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(y * N[(N[Sqrt[1.0 ^ 2 + t ^ 2], $MachinePrecision] * (-t$95$2)), $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 3 \cdot 10^{+15}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{+164}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(t\_1 \cdot t\_1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\mathsf{hypot}\left(1, t\right) \cdot \left(-t\_2\right)\right)\\
\end{array}
\end{array}
if t < 3e15Initial program 98.7%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.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 62.2%
if 3e15 < t < 1.90000000000000011e164Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 7.9%
*-commutative7.9%
sqrt-prod7.9%
associate-*r*7.9%
*-commutative7.9%
add-sqr-sqrt6.1%
sqrt-unprod24.2%
*-commutative24.2%
*-commutative24.2%
swap-sqr27.9%
add-sqr-sqrt27.9%
swap-sqr27.9%
rem-square-sqrt27.9%
pow227.9%
Applied egg-rr27.9%
*-commutative27.9%
pow227.9%
Applied egg-rr27.9%
if 1.90000000000000011e164 < t Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 100.0%
+-commutative100.0%
unpow2100.0%
fma-define100.0%
Simplified100.0%
sqrt-prod100.0%
Applied egg-rr100.0%
fma-undefine100.0%
unpow2100.0%
+-commutative100.0%
unpow2100.0%
hypot-1-def67.8%
Simplified67.8%
Taylor expanded in x around 0 45.5%
neg-mul-145.5%
Simplified45.5%
Final simplification56.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 50000000.0)
(* (hypot 1.0 t) (* t_1 (sqrt (* z 2.0))))
(* t_1 (sqrt (* z (* 2.0 (pow t 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 50000000.0) {
tmp = hypot(1.0, t) * (t_1 * sqrt((z * 2.0)));
} else {
tmp = t_1 * sqrt((z * (2.0 * pow(t, 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 <= 50000000.0) {
tmp = Math.hypot(1.0, t) * (t_1 * Math.sqrt((z * 2.0)));
} else {
tmp = t_1 * Math.sqrt((z * (2.0 * Math.pow(t, 2.0))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 50000000.0: tmp = math.hypot(1.0, t) * (t_1 * math.sqrt((z * 2.0))) else: tmp = t_1 * math.sqrt((z * (2.0 * math.pow(t, 2.0)))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 50000000.0) tmp = Float64(hypot(1.0, t) * Float64(t_1 * sqrt(Float64(z * 2.0)))); else tmp = Float64(t_1 * sqrt(Float64(z * Float64(2.0 * (t ^ 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 <= 50000000.0) tmp = hypot(1.0, t) * (t_1 * sqrt((z * 2.0))); else tmp = t_1 * sqrt((z * (2.0 * (t ^ 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, 50000000.0], N[(N[Sqrt[1.0 ^ 2 + t ^ 2], $MachinePrecision] * N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(z * N[(2.0 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 50000000:\\
\;\;\;\;\mathsf{hypot}\left(1, t\right) \cdot \left(t\_1 \cdot \sqrt{z \cdot 2}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot \left(2 \cdot {t}^{2}\right)}\\
\end{array}
\end{array}
if t < 5e7Initial program 98.7%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.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 85.6%
+-commutative85.6%
unpow285.6%
fma-define85.6%
Simplified85.6%
sqrt-prod82.2%
Applied egg-rr82.2%
fma-undefine82.2%
unpow282.2%
+-commutative82.2%
unpow282.2%
hypot-1-def76.0%
Simplified76.0%
*-commutative76.0%
sub-neg76.0%
*-commutative76.0%
distribute-lft-in73.4%
*-commutative73.4%
Applied egg-rr73.4%
distribute-lft-out76.0%
distribute-rgt-out73.4%
associate-*r*73.9%
associate-*r*74.4%
distribute-rgt-out76.0%
distribute-rgt-in75.9%
+-commutative75.9%
*-commutative75.9%
+-commutative75.9%
sub-neg75.9%
*-commutative75.9%
Simplified75.9%
if 5e7 < t Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 71.4%
+-commutative71.4%
unpow271.4%
fma-define71.4%
Simplified71.4%
Taylor expanded in t around inf 71.4%
*-commutative71.4%
associate-*r*71.4%
*-commutative71.4%
associate-*l*71.4%
Simplified71.4%
Final simplification74.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 50000000.0)
(* t_1 (* (sqrt (* z 2.0)) (hypot 1.0 t)))
(* t_1 (sqrt (* z (* 2.0 (pow t 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 50000000.0) {
tmp = t_1 * (sqrt((z * 2.0)) * hypot(1.0, t));
} else {
tmp = t_1 * sqrt((z * (2.0 * pow(t, 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 <= 50000000.0) {
tmp = t_1 * (Math.sqrt((z * 2.0)) * Math.hypot(1.0, t));
} else {
tmp = t_1 * Math.sqrt((z * (2.0 * Math.pow(t, 2.0))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 50000000.0: tmp = t_1 * (math.sqrt((z * 2.0)) * math.hypot(1.0, t)) else: tmp = t_1 * math.sqrt((z * (2.0 * math.pow(t, 2.0)))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 50000000.0) tmp = Float64(t_1 * Float64(sqrt(Float64(z * 2.0)) * hypot(1.0, t))); else tmp = Float64(t_1 * sqrt(Float64(z * Float64(2.0 * (t ^ 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 <= 50000000.0) tmp = t_1 * (sqrt((z * 2.0)) * hypot(1.0, t)); else tmp = t_1 * sqrt((z * (2.0 * (t ^ 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, 50000000.0], 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[(z * N[(2.0 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 50000000:\\
\;\;\;\;t\_1 \cdot \left(\sqrt{z \cdot 2} \cdot \mathsf{hypot}\left(1, t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot \left(2 \cdot {t}^{2}\right)}\\
\end{array}
\end{array}
if t < 5e7Initial program 98.7%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.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 85.6%
+-commutative85.6%
unpow285.6%
fma-define85.6%
Simplified85.6%
sqrt-prod82.2%
Applied egg-rr82.2%
fma-undefine82.2%
unpow282.2%
+-commutative82.2%
unpow282.2%
hypot-1-def76.0%
Simplified76.0%
if 5e7 < t Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 71.4%
+-commutative71.4%
unpow271.4%
fma-define71.4%
Simplified71.4%
Taylor expanded in t around inf 71.4%
*-commutative71.4%
associate-*r*71.4%
*-commutative71.4%
associate-*l*71.4%
Simplified71.4%
(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 (* z (* 2.0 (pow t 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((z * (2.0 * pow(t, 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((z * (2.0d0 * (t ** 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((z * (2.0 * Math.pow(t, 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((z * (2.0 * math.pow(t, 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(z * Float64(2.0 * (t ^ 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((z * (2.0 * (t ^ 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[(z * N[(2.0 * N[Power[t, 2.0], $MachinePrecision]), $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{z \cdot \left(2 \cdot {t}^{2}\right)}\\
\end{array}
\end{array}
if t < 1Initial program 98.7%
associate-*l*99.7%
remove-double-neg99.7%
remove-double-neg99.7%
exp-sqrt99.7%
exp-prod99.7%
Simplified99.7%
pow199.7%
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 63.7%
if 1 < t Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 68.2%
+-commutative68.2%
unpow268.2%
fma-define68.2%
Simplified68.2%
Taylor expanded in t around inf 68.2%
*-commutative68.2%
associate-*r*68.2%
*-commutative68.2%
associate-*l*68.2%
Simplified68.2%
Final simplification64.8%
(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 98.7%
associate-*l*99.7%
remove-double-neg99.7%
remove-double-neg99.7%
exp-sqrt99.7%
exp-prod99.7%
Simplified99.7%
pow199.7%
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 63.7%
if 1 < t Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 68.2%
+-commutative68.2%
unpow268.2%
fma-define68.2%
Simplified68.2%
Taylor expanded in t around inf 45.7%
Final simplification59.3%
(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.0%
Final simplification99.0%
(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(Float64(z * 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[(N[(z * 2.0), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot \mathsf{fma}\left(t, t, 1\right)}
\end{array}
Initial program 99.0%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.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 82.3%
+-commutative82.3%
unpow282.3%
fma-define82.3%
Simplified82.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 2.3e+15)
(* t_1 (sqrt (* z 2.0)))
(sqrt (* z (* 2.0 (* t_1 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 2.3e+15) {
tmp = t_1 * sqrt((z * 2.0));
} else {
tmp = sqrt((z * (2.0 * (t_1 * 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 = (x * 0.5d0) - y
if (t <= 2.3d+15) then
tmp = t_1 * sqrt((z * 2.0d0))
else
tmp = sqrt((z * (2.0d0 * (t_1 * 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 tmp;
if (t <= 2.3e+15) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt((z * (2.0 * (t_1 * t_1))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 2.3e+15: tmp = t_1 * math.sqrt((z * 2.0)) else: tmp = math.sqrt((z * (2.0 * (t_1 * t_1)))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 2.3e+15) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(z * Float64(2.0 * Float64(t_1 * t_1)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if (t <= 2.3e+15) tmp = t_1 * sqrt((z * 2.0)); else tmp = sqrt((z * (2.0 * (t_1 * t_1)))); 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, 2.3e+15], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(z * N[(2.0 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 2.3 \cdot 10^{+15}:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(t\_1 \cdot t\_1\right)\right)}\\
\end{array}
\end{array}
if t < 2.3e15Initial program 98.7%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.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 62.2%
if 2.3e15 < t Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 10.8%
*-commutative10.8%
sqrt-prod10.8%
associate-*r*10.8%
*-commutative10.8%
add-sqr-sqrt5.2%
sqrt-unprod16.7%
*-commutative16.7%
*-commutative16.7%
swap-sqr21.6%
add-sqr-sqrt21.6%
swap-sqr21.6%
rem-square-sqrt21.6%
pow221.6%
Applied egg-rr21.6%
*-commutative21.6%
pow221.6%
Applied egg-rr21.6%
Final simplification53.0%
(FPCore (x y z t) :precision binary64 (if (<= t 6.6e+66) (* (- (* 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 <= 6.6e+66) {
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 <= 6.6d+66) 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 <= 6.6e+66) {
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 <= 6.6e+66: 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 <= 6.6e+66) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(z * Float64(2.0 * Float64(y * Float64(y - x))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 6.6e+66) 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, 6.6e+66], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(z * N[(2.0 * N[(y * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 6.6 \cdot 10^{+66}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(y \cdot \left(y - x\right)\right)\right)}\\
\end{array}
\end{array}
if t < 6.6000000000000003e66Initial program 98.8%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.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 59.7%
if 6.6000000000000003e66 < t Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 11.9%
*-commutative11.9%
sqrt-prod11.9%
associate-*r*11.9%
*-commutative11.9%
add-sqr-sqrt5.7%
sqrt-unprod13.5%
*-commutative13.5%
*-commutative13.5%
swap-sqr19.4%
add-sqr-sqrt19.4%
swap-sqr19.4%
rem-square-sqrt19.4%
pow219.4%
Applied egg-rr19.4%
Taylor expanded in x around 0 13.2%
+-commutative13.2%
unpow213.2%
associate-*r*13.2%
distribute-rgt-in13.2%
mul-1-neg13.2%
unsub-neg13.2%
Simplified13.2%
Final simplification50.8%
(FPCore (x y z t) :precision binary64 (if (<= y -3.2e+43) (sqrt (* z (* 2.0 (* y (- y x))))) (* 0.5 (* x (sqrt (* z 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.2e+43) {
tmp = sqrt((z * (2.0 * (y * (y - x)))));
} else {
tmp = 0.5 * (x * sqrt((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) :: tmp
if (y <= (-3.2d+43)) then
tmp = sqrt((z * (2.0d0 * (y * (y - x)))))
else
tmp = 0.5d0 * (x * sqrt((z * 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.2e+43) {
tmp = Math.sqrt((z * (2.0 * (y * (y - x)))));
} else {
tmp = 0.5 * (x * Math.sqrt((z * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.2e+43: tmp = math.sqrt((z * (2.0 * (y * (y - x))))) else: tmp = 0.5 * (x * math.sqrt((z * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.2e+43) tmp = sqrt(Float64(z * Float64(2.0 * Float64(y * Float64(y - x))))); else tmp = Float64(0.5 * Float64(x * sqrt(Float64(z * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.2e+43) tmp = sqrt((z * (2.0 * (y * (y - x))))); else tmp = 0.5 * (x * sqrt((z * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.2e+43], N[Sqrt[N[(z * N[(2.0 * N[(y * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(0.5 * N[(x * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+43}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(y \cdot \left(y - x\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \sqrt{z \cdot 2}\right)\\
\end{array}
\end{array}
if y < -3.20000000000000014e43Initial program 99.8%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.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 43.7%
*-commutative43.7%
sqrt-prod43.6%
associate-*r*43.6%
*-commutative43.6%
add-sqr-sqrt39.5%
sqrt-unprod40.0%
*-commutative40.0%
*-commutative40.0%
swap-sqr49.4%
add-sqr-sqrt49.4%
swap-sqr49.4%
rem-square-sqrt49.4%
pow249.4%
Applied egg-rr49.4%
Taylor expanded in x around 0 47.0%
+-commutative47.0%
unpow247.0%
associate-*r*47.0%
distribute-rgt-in49.4%
mul-1-neg49.4%
unsub-neg49.4%
Simplified49.4%
if -3.20000000000000014e43 < y Initial program 98.8%
Taylor expanded in t around 0 52.3%
Taylor expanded in x around inf 33.8%
associate-*l*33.8%
Simplified33.8%
pow133.8%
sqrt-prod33.9%
*-commutative33.9%
Applied egg-rr33.9%
unpow133.9%
Simplified33.9%
(FPCore (x y z t) :precision binary64 (* 0.5 (* x (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
return 0.5 * (x * 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 = 0.5d0 * (x * sqrt((z * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return 0.5 * (x * Math.sqrt((z * 2.0)));
}
def code(x, y, z, t): return 0.5 * (x * math.sqrt((z * 2.0)))
function code(x, y, z, t) return Float64(0.5 * Float64(x * sqrt(Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = 0.5 * (x * sqrt((z * 2.0))); end
code[x_, y_, z_, t_] := N[(0.5 * N[(x * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(x \cdot \sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.0%
Taylor expanded in t around 0 50.6%
Taylor expanded in x around inf 29.1%
associate-*l*29.0%
Simplified29.0%
pow129.0%
sqrt-prod29.1%
*-commutative29.1%
Applied egg-rr29.1%
unpow129.1%
Simplified29.1%
(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 2024170
(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))))