
(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 10 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 (* (* 2.0 z) (exp (pow t 2.0))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((2.0 * z) * 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(((2.0d0 * z) * 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(((2.0 * z) * Math.exp(Math.pow(t, 2.0))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((2.0 * z) * math.exp(math.pow(t, 2.0))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(2.0 * z) * exp((t ^ 2.0))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((2.0 * z) * exp((t ^ 2.0)))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(2.0 * z), $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(2 \cdot z\right) \cdot e^{{t}^{2}}}
\end{array}
Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow-exp99.8%
pow299.8%
Applied egg-rr99.8%
unpow199.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 6000000.0)
(* t_1 (sqrt (* 2.0 z)))
(* t_1 (pow (pow (* 2.0 z) 3.0) 0.16666666666666666)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 6000000.0) {
tmp = t_1 * sqrt((2.0 * z));
} else {
tmp = t_1 * pow(pow((2.0 * z), 3.0), 0.16666666666666666);
}
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 <= 6000000.0d0) then
tmp = t_1 * sqrt((2.0d0 * z))
else
tmp = t_1 * (((2.0d0 * z) ** 3.0d0) ** 0.16666666666666666d0)
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 <= 6000000.0) {
tmp = t_1 * Math.sqrt((2.0 * z));
} else {
tmp = t_1 * Math.pow(Math.pow((2.0 * z), 3.0), 0.16666666666666666);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 6000000.0: tmp = t_1 * math.sqrt((2.0 * z)) else: tmp = t_1 * math.pow(math.pow((2.0 * z), 3.0), 0.16666666666666666) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 6000000.0) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); else tmp = Float64(t_1 * ((Float64(2.0 * z) ^ 3.0) ^ 0.16666666666666666)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if (t <= 6000000.0) tmp = t_1 * sqrt((2.0 * z)); else tmp = t_1 * (((2.0 * z) ^ 3.0) ^ 0.16666666666666666); 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, 6000000.0], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Power[N[Power[N[(2.0 * z), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 6000000:\\
\;\;\;\;t\_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot {\left({\left(2 \cdot z\right)}^{3}\right)}^{0.16666666666666666}\\
\end{array}
\end{array}
if t < 6e6Initial program 99.7%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 66.6%
sqrt-prod66.8%
pow1/266.8%
*-commutative66.8%
Applied egg-rr66.8%
unpow1/266.8%
Simplified66.8%
if 6e6 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 15.4%
sqrt-prod15.4%
add-cbrt-cube27.3%
pow1/327.3%
add-sqr-sqrt27.3%
pow127.3%
pow1/227.3%
pow-prod-up27.3%
*-commutative27.3%
metadata-eval27.3%
Applied egg-rr27.3%
unpow1/327.3%
Simplified27.3%
pow1/327.3%
sqr-pow27.3%
pow-prod-down42.6%
pow-prod-up42.6%
metadata-eval42.6%
*-commutative42.6%
metadata-eval42.6%
Applied egg-rr42.6%
Final simplification61.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 1.55e-35)
(* t_1 (sqrt (* 2.0 z)))
(* t_1 (cbrt (pow (* 2.0 z) 1.5))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 1.55e-35) {
tmp = t_1 * sqrt((2.0 * z));
} else {
tmp = t_1 * cbrt(pow((2.0 * z), 1.5));
}
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 <= 1.55e-35) {
tmp = t_1 * Math.sqrt((2.0 * z));
} else {
tmp = t_1 * Math.cbrt(Math.pow((2.0 * z), 1.5));
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 1.55e-35) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); else tmp = Float64(t_1 * cbrt((Float64(2.0 * z) ^ 1.5))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 1.55e-35], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Power[N[Power[N[(2.0 * z), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 1.55 \cdot 10^{-35}:\\
\;\;\;\;t\_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt[3]{{\left(2 \cdot z\right)}^{1.5}}\\
\end{array}
\end{array}
if t < 1.55000000000000006e-35Initial program 99.7%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 66.0%
sqrt-prod66.2%
pow1/266.2%
*-commutative66.2%
Applied egg-rr66.2%
unpow1/266.2%
Simplified66.2%
if 1.55000000000000006e-35 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 24.2%
sqrt-prod24.2%
add-cbrt-cube34.5%
pow1/334.0%
add-sqr-sqrt34.0%
pow134.0%
pow1/234.0%
pow-prod-up34.0%
*-commutative34.0%
metadata-eval34.0%
Applied egg-rr34.0%
unpow1/334.5%
Simplified34.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 1.1e+15)
(* t_1 (sqrt (* 2.0 z)))
(sqrt (* 2.0 (* z (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 <= 1.1e+15) {
tmp = t_1 * sqrt((2.0 * z));
} else {
tmp = sqrt((2.0 * (z * 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 <= 1.1d+15) then
tmp = t_1 * sqrt((2.0d0 * z))
else
tmp = sqrt((2.0d0 * (z * (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 <= 1.1e+15) {
tmp = t_1 * Math.sqrt((2.0 * z));
} else {
tmp = Math.sqrt((2.0 * (z * Math.pow(t_1, 2.0))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 1.1e+15: tmp = t_1 * math.sqrt((2.0 * z)) else: tmp = math.sqrt((2.0 * (z * 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 <= 1.1e+15) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); else tmp = sqrt(Float64(2.0 * Float64(z * (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 <= 1.1e+15) tmp = t_1 * sqrt((2.0 * z)); else tmp = sqrt((2.0 * (z * (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, 1.1e+15], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(2.0 * N[(z * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 1.1 \cdot 10^{+15}:\\
\;\;\;\;t\_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(z \cdot {t\_1}^{2}\right)}\\
\end{array}
\end{array}
if t < 1.1e15Initial program 99.7%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 66.0%
sqrt-prod66.2%
pow1/266.2%
*-commutative66.2%
Applied egg-rr66.2%
unpow1/266.2%
Simplified66.2%
if 1.1e15 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 15.7%
sqrt-prod15.7%
*-commutative15.7%
pow115.7%
metadata-eval15.7%
sqrt-pow118.1%
sqrt-prod21.3%
pow1/221.3%
*-commutative21.3%
associate-*l*21.3%
fma-neg21.3%
Applied egg-rr21.3%
unpow1/221.3%
fma-neg21.3%
*-commutative21.3%
Simplified21.3%
Final simplification55.9%
(FPCore (x y z t) :precision binary64 (* (exp (/ (* t t) 2.0)) (* (- (* x 0.5) y) (sqrt (* 2.0 z)))))
double code(double x, double y, double z, double t) {
return exp(((t * t) / 2.0)) * (((x * 0.5) - y) * sqrt((2.0 * z)));
}
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((2.0d0 * z)))
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((2.0 * z)));
}
def code(x, y, z, t): return math.exp(((t * t) / 2.0)) * (((x * 0.5) - y) * math.sqrt((2.0 * z)))
function code(x, y, z, t) return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z)))) end
function tmp = code(x, y, z, t) tmp = exp(((t * t) / 2.0)) * (((x * 0.5) - y) * sqrt((2.0 * z))); 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[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\frac{t \cdot t}{2}} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (<= t 3.6e+22) (* (- (* x 0.5) y) (sqrt (* 2.0 z))) (* 0.5 (sqrt (* z (* 2.0 (pow x 2.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.6e+22) {
tmp = ((x * 0.5) - y) * sqrt((2.0 * z));
} else {
tmp = 0.5 * sqrt((z * (2.0 * pow(x, 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 (t <= 3.6d+22) then
tmp = ((x * 0.5d0) - y) * sqrt((2.0d0 * z))
else
tmp = 0.5d0 * sqrt((z * (2.0d0 * (x ** 2.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.6e+22) {
tmp = ((x * 0.5) - y) * Math.sqrt((2.0 * z));
} else {
tmp = 0.5 * Math.sqrt((z * (2.0 * Math.pow(x, 2.0))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 3.6e+22: tmp = ((x * 0.5) - y) * math.sqrt((2.0 * z)) else: tmp = 0.5 * math.sqrt((z * (2.0 * math.pow(x, 2.0)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 3.6e+22) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))); else tmp = Float64(0.5 * sqrt(Float64(z * Float64(2.0 * (x ^ 2.0))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 3.6e+22) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); else tmp = 0.5 * sqrt((z * (2.0 * (x ^ 2.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 3.6e+22], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Sqrt[N[(z * N[(2.0 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.6 \cdot 10^{+22}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \sqrt{z \cdot \left(2 \cdot {x}^{2}\right)}\\
\end{array}
\end{array}
if t < 3.6e22Initial program 99.7%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 65.7%
sqrt-prod65.9%
pow1/265.9%
*-commutative65.9%
Applied egg-rr65.9%
unpow1/265.9%
Simplified65.9%
if 3.6e22 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 16.0%
Taylor expanded in x around inf 6.0%
*-commutative6.0%
Simplified6.0%
add-sqr-sqrt1.5%
sqrt-unprod10.1%
*-commutative10.1%
*-commutative10.1%
swap-sqr15.0%
add-sqr-sqrt15.0%
swap-sqr15.0%
rem-square-sqrt15.0%
pow215.0%
Applied egg-rr15.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9e+113) (and (not (<= y -1.85e+50)) (<= y -2.7e-5))) (sqrt (* 2.0 (* y (* z (- y x))))) (* (sqrt (* 2.0 z)) (* x 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9e+113) || (!(y <= -1.85e+50) && (y <= -2.7e-5))) {
tmp = sqrt((2.0 * (y * (z * (y - x)))));
} else {
tmp = sqrt((2.0 * z)) * (x * 0.5);
}
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 <= (-9d+113)) .or. (.not. (y <= (-1.85d+50))) .and. (y <= (-2.7d-5))) then
tmp = sqrt((2.0d0 * (y * (z * (y - x)))))
else
tmp = sqrt((2.0d0 * z)) * (x * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9e+113) || (!(y <= -1.85e+50) && (y <= -2.7e-5))) {
tmp = Math.sqrt((2.0 * (y * (z * (y - x)))));
} else {
tmp = Math.sqrt((2.0 * z)) * (x * 0.5);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9e+113) or (not (y <= -1.85e+50) and (y <= -2.7e-5)): tmp = math.sqrt((2.0 * (y * (z * (y - x))))) else: tmp = math.sqrt((2.0 * z)) * (x * 0.5) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9e+113) || (!(y <= -1.85e+50) && (y <= -2.7e-5))) tmp = sqrt(Float64(2.0 * Float64(y * Float64(z * Float64(y - x))))); else tmp = Float64(sqrt(Float64(2.0 * z)) * Float64(x * 0.5)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -9e+113) || (~((y <= -1.85e+50)) && (y <= -2.7e-5))) tmp = sqrt((2.0 * (y * (z * (y - x))))); else tmp = sqrt((2.0 * z)) * (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9e+113], And[N[Not[LessEqual[y, -1.85e+50]], $MachinePrecision], LessEqual[y, -2.7e-5]]], N[Sqrt[N[(2.0 * N[(y * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+113} \lor \neg \left(y \leq -1.85 \cdot 10^{+50}\right) \land y \leq -2.7 \cdot 10^{-5}:\\
\;\;\;\;\sqrt{2 \cdot \left(y \cdot \left(z \cdot \left(y - x\right)\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot z} \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if y < -9.0000000000000001e113 or -1.85e50 < y < -2.6999999999999999e-5Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 62.1%
sqrt-prod62.2%
*-commutative62.2%
pow162.2%
metadata-eval62.2%
sqrt-pow151.2%
sqrt-prod55.6%
pow1/255.6%
*-commutative55.6%
associate-*l*55.6%
fma-neg55.6%
Applied egg-rr55.6%
unpow1/255.6%
fma-neg55.6%
*-commutative55.6%
Simplified55.6%
Taylor expanded in x around 0 41.2%
*-commutative41.2%
associate-*r*45.8%
associate-*l*45.8%
unpow245.8%
associate-*r*48.0%
*-commutative48.0%
distribute-rgt-in57.7%
+-commutative57.7%
associate-*r*57.7%
distribute-rgt-out57.7%
mul-1-neg57.7%
unsub-neg57.7%
Simplified57.7%
if -9.0000000000000001e113 < y < -1.85e50 or -2.6999999999999999e-5 < y Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 52.9%
Taylor expanded in x around inf 37.4%
*-commutative37.4%
Simplified37.4%
pow137.4%
*-commutative37.4%
associate-*l*37.4%
sqrt-prod37.5%
*-commutative37.5%
Applied egg-rr37.5%
unpow137.5%
associate-*r*37.5%
*-commutative37.5%
*-commutative37.5%
*-commutative37.5%
*-commutative37.5%
Simplified37.5%
Final simplification40.9%
(FPCore (x y z t) :precision binary64 (if (<= t 3.6e+22) (* (- (* x 0.5) y) (sqrt (* 2.0 z))) (sqrt (* 2.0 (* z (* x (- (* x 0.25) y)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.6e+22) {
tmp = ((x * 0.5) - y) * sqrt((2.0 * z));
} else {
tmp = sqrt((2.0 * (z * (x * ((x * 0.25) - y)))));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 3.6d+22) then
tmp = ((x * 0.5d0) - y) * sqrt((2.0d0 * z))
else
tmp = sqrt((2.0d0 * (z * (x * ((x * 0.25d0) - y)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.6e+22) {
tmp = ((x * 0.5) - y) * Math.sqrt((2.0 * z));
} else {
tmp = Math.sqrt((2.0 * (z * (x * ((x * 0.25) - y)))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 3.6e+22: tmp = ((x * 0.5) - y) * math.sqrt((2.0 * z)) else: tmp = math.sqrt((2.0 * (z * (x * ((x * 0.25) - y))))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 3.6e+22) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))); else tmp = sqrt(Float64(2.0 * Float64(z * Float64(x * Float64(Float64(x * 0.25) - y))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 3.6e+22) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); else tmp = sqrt((2.0 * (z * (x * ((x * 0.25) - y))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 3.6e+22], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(2.0 * N[(z * N[(x * N[(N[(x * 0.25), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.6 \cdot 10^{+22}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(z \cdot \left(x \cdot \left(x \cdot 0.25 - y\right)\right)\right)}\\
\end{array}
\end{array}
if t < 3.6e22Initial program 99.7%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 65.7%
sqrt-prod65.9%
pow1/265.9%
*-commutative65.9%
Applied egg-rr65.9%
unpow1/265.9%
Simplified65.9%
if 3.6e22 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 16.0%
sqrt-prod16.0%
*-commutative16.0%
pow116.0%
metadata-eval16.0%
sqrt-pow118.4%
sqrt-prod21.6%
pow1/221.6%
*-commutative21.6%
associate-*l*21.6%
fma-neg21.6%
Applied egg-rr21.6%
unpow1/221.6%
fma-neg21.6%
*-commutative21.6%
Simplified21.6%
Taylor expanded in y around 0 14.6%
mul-1-neg14.6%
*-commutative14.6%
distribute-lft-neg-in14.6%
unpow214.6%
associate-*r*14.6%
distribute-rgt-in14.6%
+-commutative14.6%
unsub-neg14.6%
Simplified14.6%
Final simplification54.3%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* 2.0 z))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((2.0 * z));
}
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((2.0d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((2.0 * z));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((2.0 * z))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}
\end{array}
Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 54.4%
sqrt-prod54.6%
pow1/254.6%
*-commutative54.6%
Applied egg-rr54.6%
unpow1/254.6%
Simplified54.6%
(FPCore (x y z t) :precision binary64 (* (sqrt (* 2.0 z)) (* x 0.5)))
double code(double x, double y, double z, double t) {
return sqrt((2.0 * z)) * (x * 0.5);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt((2.0d0 * z)) * (x * 0.5d0)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((2.0 * z)) * (x * 0.5);
}
def code(x, y, z, t): return math.sqrt((2.0 * z)) * (x * 0.5)
function code(x, y, z, t) return Float64(sqrt(Float64(2.0 * z)) * Float64(x * 0.5)) end
function tmp = code(x, y, z, t) tmp = sqrt((2.0 * z)) * (x * 0.5); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot z} \cdot \left(x \cdot 0.5\right)
\end{array}
Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 54.4%
Taylor expanded in x around inf 32.3%
*-commutative32.3%
Simplified32.3%
pow132.3%
*-commutative32.3%
associate-*l*32.3%
sqrt-prod32.3%
*-commutative32.3%
Applied egg-rr32.3%
unpow132.3%
associate-*r*32.3%
*-commutative32.3%
*-commutative32.3%
*-commutative32.3%
*-commutative32.3%
Simplified32.3%
Final simplification32.3%
(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 2024087
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:alt
(* (* (- (* 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))))