
(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 9 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.4%
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%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* 2.0 z))) (t_2 (exp (/ (* t t) 2.0)))) (if (<= t_2 2.0) (* (- (* x 0.5) y) t_1) (* t_2 (* y (- t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((2.0 * z));
double t_2 = exp(((t * t) / 2.0));
double tmp;
if (t_2 <= 2.0) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_2 * (y * -t_1);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((2.0d0 * z))
t_2 = exp(((t * t) / 2.0d0))
if (t_2 <= 2.0d0) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = t_2 * (y * -t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((2.0 * z));
double t_2 = Math.exp(((t * t) / 2.0));
double tmp;
if (t_2 <= 2.0) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = t_2 * (y * -t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((2.0 * z)) t_2 = math.exp(((t * t) / 2.0)) tmp = 0 if t_2 <= 2.0: tmp = ((x * 0.5) - y) * t_1 else: tmp = t_2 * (y * -t_1) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(2.0 * z)) t_2 = exp(Float64(Float64(t * t) / 2.0)) tmp = 0.0 if (t_2 <= 2.0) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(t_2 * Float64(y * Float64(-t_1))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((2.0 * z)); t_2 = exp(((t * t) / 2.0)); tmp = 0.0; if (t_2 <= 2.0) tmp = ((x * 0.5) - y) * t_1; else tmp = t_2 * (y * -t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, 2.0], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$2 * N[(y * (-t$95$1)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{2 \cdot z}\\
t_2 := e^{\frac{t \cdot t}{2}}\\
\mathbf{if}\;t\_2 \leq 2:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(y \cdot \left(-t\_1\right)\right)\\
\end{array}
\end{array}
if (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64))) < 2Initial program 99.7%
associate-*l*99.6%
exp-sqrt99.6%
exp-prod99.6%
Simplified99.6%
Taylor expanded in t around 0 99.0%
*-rgt-identity99.0%
*-commutative99.0%
sub-neg99.0%
distribute-lft-in99.0%
*-commutative99.0%
*-commutative99.0%
Applied egg-rr99.0%
distribute-lft-out99.0%
sub-neg99.0%
*-commutative99.0%
*-commutative99.0%
Simplified99.0%
if 2 < (exp.f64 (/.f64 (*.f64 t t) #s(literal 2 binary64))) Initial program 99.2%
Taylor expanded in x around 0 71.2%
mul-1-neg71.2%
distribute-rgt-neg-in71.2%
Simplified71.2%
distribute-rgt-neg-out71.2%
neg-sub071.2%
associate-*l*71.2%
sqrt-prod71.2%
Applied egg-rr71.2%
neg-sub071.2%
distribute-rgt-neg-in71.2%
Simplified71.2%
Final simplification85.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 3100.0)
(* t_1 (sqrt (* 2.0 z)))
(if (<= t 3.9e+46)
(sqrt (* (* 2.0 z) (pow t_1 2.0)))
(if (<= t 2.8e+64)
(* t_1 (cbrt (pow (* 2.0 z) 1.5)))
(* y (- (sqrt (* 2.0 (+ z (* z (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 <= 3100.0) {
tmp = t_1 * sqrt((2.0 * z));
} else if (t <= 3.9e+46) {
tmp = sqrt(((2.0 * z) * pow(t_1, 2.0)));
} else if (t <= 2.8e+64) {
tmp = t_1 * cbrt(pow((2.0 * z), 1.5));
} else {
tmp = y * -sqrt((2.0 * (z + (z * 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 <= 3100.0) {
tmp = t_1 * Math.sqrt((2.0 * z));
} else if (t <= 3.9e+46) {
tmp = Math.sqrt(((2.0 * z) * Math.pow(t_1, 2.0)));
} else if (t <= 2.8e+64) {
tmp = t_1 * Math.cbrt(Math.pow((2.0 * z), 1.5));
} else {
tmp = y * -Math.sqrt((2.0 * (z + (z * 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 <= 3100.0) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); elseif (t <= 3.9e+46) tmp = sqrt(Float64(Float64(2.0 * z) * (t_1 ^ 2.0))); elseif (t <= 2.8e+64) tmp = Float64(t_1 * cbrt((Float64(2.0 * z) ^ 1.5))); else tmp = Float64(y * Float64(-sqrt(Float64(2.0 * Float64(z + Float64(z * (t ^ 2.0))))))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 3100.0], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.9e+46], N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 2.8e+64], N[(t$95$1 * N[Power[N[Power[N[(2.0 * z), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(y * (-N[Sqrt[N[(2.0 * N[(z + N[(z * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 3100:\\
\;\;\;\;t\_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{elif}\;t \leq 3.9 \cdot 10^{+46}:\\
\;\;\;\;\sqrt{\left(2 \cdot z\right) \cdot {t\_1}^{2}}\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+64}:\\
\;\;\;\;t\_1 \cdot \sqrt[3]{{\left(2 \cdot z\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-\sqrt{2 \cdot \left(z + z \cdot {t}^{2}\right)}\right)\\
\end{array}
\end{array}
if t < 3100Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 71.8%
*-rgt-identity71.8%
*-commutative71.8%
sub-neg71.8%
distribute-lft-in71.3%
*-commutative71.3%
*-commutative71.3%
Applied egg-rr71.3%
distribute-lft-out71.8%
sub-neg71.8%
*-commutative71.8%
*-commutative71.8%
Simplified71.8%
if 3100 < t < 3.89999999999999995e46Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 25.5%
pow125.5%
metadata-eval25.5%
sqrt-pow134.4%
*-rgt-identity34.4%
sqrt-prod34.4%
*-commutative34.4%
pow1/234.4%
*-commutative34.4%
associate-*l*34.4%
Applied egg-rr34.4%
unpow1/234.4%
associate-*r*34.4%
*-commutative34.4%
Simplified34.4%
if 3.89999999999999995e46 < t < 2.80000000000000024e64Initial program 80.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 22.7%
sqrt-prod22.7%
add-cbrt-cube41.2%
add-sqr-sqrt41.2%
*-commutative41.2%
pow141.2%
pow1/241.2%
*-commutative41.2%
pow-prod-up41.2%
*-commutative41.2%
metadata-eval41.2%
Applied egg-rr41.2%
if 2.80000000000000024e64 < t Initial program 100.0%
Taylor expanded in x around 0 68.1%
mul-1-neg68.1%
distribute-rgt-neg-in68.1%
Simplified68.1%
distribute-rgt-neg-out68.1%
distribute-lft-neg-out68.1%
add-sqr-sqrt68.1%
sqr-neg68.1%
sqrt-unprod0.0%
add-sqr-sqrt29.8%
associate-*l*29.8%
associate-*l*29.8%
Applied egg-rr70.2%
distribute-rgt-neg-in70.2%
associate-*r*70.2%
Simplified70.2%
Taylor expanded in t around 0 55.8%
distribute-lft-out55.8%
*-commutative55.8%
Simplified55.8%
Final simplification67.0%
(FPCore (x y z t)
:precision binary64
(if (<= t 2.65e-5)
(* (- (* x 0.5) y) (sqrt (* 2.0 z)))
(if (<= t 5.4e+79)
(* (* x (* (sqrt z) (- 0.5 (/ y x)))) (sqrt 2.0))
(* y (- (sqrt (* 2.0 (+ z (* z (pow t 2.0))))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.65e-5) {
tmp = ((x * 0.5) - y) * sqrt((2.0 * z));
} else if (t <= 5.4e+79) {
tmp = (x * (sqrt(z) * (0.5 - (y / x)))) * sqrt(2.0);
} else {
tmp = y * -sqrt((2.0 * (z + (z * 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) :: tmp
if (t <= 2.65d-5) then
tmp = ((x * 0.5d0) - y) * sqrt((2.0d0 * z))
else if (t <= 5.4d+79) then
tmp = (x * (sqrt(z) * (0.5d0 - (y / x)))) * sqrt(2.0d0)
else
tmp = y * -sqrt((2.0d0 * (z + (z * (t ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.65e-5) {
tmp = ((x * 0.5) - y) * Math.sqrt((2.0 * z));
} else if (t <= 5.4e+79) {
tmp = (x * (Math.sqrt(z) * (0.5 - (y / x)))) * Math.sqrt(2.0);
} else {
tmp = y * -Math.sqrt((2.0 * (z + (z * Math.pow(t, 2.0)))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.65e-5: tmp = ((x * 0.5) - y) * math.sqrt((2.0 * z)) elif t <= 5.4e+79: tmp = (x * (math.sqrt(z) * (0.5 - (y / x)))) * math.sqrt(2.0) else: tmp = y * -math.sqrt((2.0 * (z + (z * math.pow(t, 2.0))))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.65e-5) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))); elseif (t <= 5.4e+79) tmp = Float64(Float64(x * Float64(sqrt(z) * Float64(0.5 - Float64(y / x)))) * sqrt(2.0)); else tmp = Float64(y * Float64(-sqrt(Float64(2.0 * Float64(z + Float64(z * (t ^ 2.0))))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.65e-5) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); elseif (t <= 5.4e+79) tmp = (x * (sqrt(z) * (0.5 - (y / x)))) * sqrt(2.0); else tmp = y * -sqrt((2.0 * (z + (z * (t ^ 2.0))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.65e-5], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.4e+79], N[(N[(x * N[(N[Sqrt[z], $MachinePrecision] * N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision], N[(y * (-N[Sqrt[N[(2.0 * N[(z + N[(z * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.65 \cdot 10^{-5}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{elif}\;t \leq 5.4 \cdot 10^{+79}:\\
\;\;\;\;\left(x \cdot \left(\sqrt{z} \cdot \left(0.5 - \frac{y}{x}\right)\right)\right) \cdot \sqrt{2}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-\sqrt{2 \cdot \left(z + z \cdot {t}^{2}\right)}\right)\\
\end{array}
\end{array}
if t < 2.65e-5Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 72.1%
*-rgt-identity72.1%
*-commutative72.1%
sub-neg72.1%
distribute-lft-in71.6%
*-commutative71.6%
*-commutative71.6%
Applied egg-rr71.6%
distribute-lft-out72.1%
sub-neg72.1%
*-commutative72.1%
*-commutative72.1%
Simplified72.1%
if 2.65e-5 < t < 5.3999999999999999e79Initial program 95.0%
associate-*l*99.9%
exp-sqrt99.9%
exp-prod99.9%
Simplified99.9%
Taylor expanded in t around 0 30.8%
pow130.8%
metadata-eval30.8%
sqrt-pow116.2%
*-rgt-identity16.2%
sqrt-prod16.2%
*-commutative16.2%
add-sqr-sqrt16.2%
pow216.2%
sqrt-prod16.2%
sqrt-pow111.2%
metadata-eval11.2%
pow111.2%
*-commutative11.2%
*-commutative11.2%
Applied egg-rr11.2%
unpow211.2%
add-sqr-sqrt30.8%
sqrt-prod30.8%
*-commutative30.8%
associate-*r*30.8%
Applied egg-rr30.8%
Taylor expanded in x around inf 35.7%
+-commutative35.7%
mul-1-neg35.7%
unsub-neg35.7%
distribute-rgt-out--35.7%
Simplified35.7%
if 5.3999999999999999e79 < t Initial program 100.0%
Taylor expanded in x around 0 68.2%
mul-1-neg68.2%
distribute-rgt-neg-in68.2%
Simplified68.2%
distribute-rgt-neg-out68.2%
distribute-lft-neg-out68.2%
add-sqr-sqrt68.2%
sqr-neg68.2%
sqrt-unprod0.0%
add-sqr-sqrt31.8%
associate-*l*31.8%
associate-*l*31.8%
Applied egg-rr68.2%
distribute-rgt-neg-in68.2%
associate-*r*68.2%
Simplified68.2%
Taylor expanded in t around 0 57.2%
distribute-lft-out57.2%
*-commutative57.2%
Simplified57.2%
Final simplification66.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 380.0)
(* 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 <= 380.0) {
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 <= 380.0d0) 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 <= 380.0) {
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 <= 380.0: 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 <= 380.0) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); else tmp = sqrt(Float64(Float64(2.0 * 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 <= 380.0) 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, 380.0], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(2.0 * z), $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 380:\\
\;\;\;\;t\_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(2 \cdot z\right) \cdot {t\_1}^{2}}\\
\end{array}
\end{array}
if t < 380Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 72.2%
*-rgt-identity72.2%
*-commutative72.2%
sub-neg72.2%
distribute-lft-in71.7%
*-commutative71.7%
*-commutative71.7%
Applied egg-rr71.7%
distribute-lft-out72.2%
sub-neg72.2%
*-commutative72.2%
*-commutative72.2%
Simplified72.2%
if 380 < t Initial program 98.4%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 22.9%
pow122.9%
metadata-eval22.9%
sqrt-pow123.7%
*-rgt-identity23.7%
sqrt-prod25.2%
*-commutative25.2%
pow1/225.2%
*-commutative25.2%
associate-*l*25.2%
Applied egg-rr25.2%
unpow1/225.2%
associate-*r*25.2%
*-commutative25.2%
Simplified25.2%
Final simplification60.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 11500000000000.0)
(* 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 <= 11500000000000.0) {
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 <= 11500000000000.0) {
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 <= 11500000000000.0) 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, 11500000000000.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], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 11500000000000:\\
\;\;\;\;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.15e13Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 71.6%
*-rgt-identity71.6%
*-commutative71.6%
sub-neg71.6%
distribute-lft-in71.1%
*-commutative71.1%
*-commutative71.1%
Applied egg-rr71.1%
distribute-lft-out71.6%
sub-neg71.6%
*-commutative71.6%
*-commutative71.6%
Simplified71.6%
if 1.15e13 < t Initial program 98.3%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 22.3%
sqrt-prod22.3%
add-cbrt-cube30.1%
add-sqr-sqrt30.1%
*-commutative30.1%
pow130.1%
pow1/230.1%
*-commutative30.1%
pow-prod-up30.1%
*-commutative30.1%
metadata-eval30.1%
Applied egg-rr30.1%
Final simplification62.1%
(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.4%
Final simplification99.4%
(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.4%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 60.2%
*-rgt-identity60.2%
*-commutative60.2%
sub-neg60.2%
distribute-lft-in59.5%
*-commutative59.5%
*-commutative59.5%
Applied egg-rr59.5%
distribute-lft-out60.2%
sub-neg60.2%
*-commutative60.2%
*-commutative60.2%
Simplified60.2%
Final simplification60.2%
(FPCore (x y z t) :precision binary64 (* y (- (sqrt (* 2.0 z)))))
double code(double x, double y, double z, double t) {
return 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 = y * -sqrt((2.0d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return y * -Math.sqrt((2.0 * z));
}
def code(x, y, z, t): return y * -math.sqrt((2.0 * z))
function code(x, y, z, t) return Float64(y * Float64(-sqrt(Float64(2.0 * z)))) end
function tmp = code(x, y, z, t) tmp = y * -sqrt((2.0 * z)); end
code[x_, y_, z_, t_] := N[(y * (-N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(-\sqrt{2 \cdot z}\right)
\end{array}
Initial program 99.4%
Taylor expanded in x around 0 60.8%
mul-1-neg60.8%
distribute-rgt-neg-in60.8%
Simplified60.8%
distribute-rgt-neg-out60.8%
distribute-lft-neg-out60.8%
add-sqr-sqrt60.8%
sqr-neg60.8%
sqrt-unprod0.0%
add-sqr-sqrt13.4%
associate-*l*13.4%
associate-*l*14.6%
Applied egg-rr62.2%
distribute-rgt-neg-in62.2%
associate-*r*62.2%
Simplified62.2%
Taylor expanded in t around 0 32.4%
Final simplification32.4%
(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 2024082
(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))))