
(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 8 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 (* t t)))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((2.0 * (z * exp((t * t)))));
}
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 * t)))))
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((t * t)))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((2.0 * (z * math.exp((t * t)))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * Float64(z * exp(Float64(t * t)))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((2.0 * (z * exp((t * t))))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(z * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z \cdot e^{t \cdot t}\right)}
\end{array}
Initial program 99.5%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef73.6%
sqrt-unprod73.6%
associate-*l*73.6%
exp-prod73.6%
Applied egg-rr73.6%
expm1-def98.5%
expm1-log1p99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
exp-prod99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* 2.0 z))))
(if (<= (* t t) 4.4e-5)
(* (- (* x 0.5) y) t_1)
(* (exp (/ (* t t) 2.0)) (* y (- t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((2.0 * z));
double tmp;
if ((t * t) <= 4.4e-5) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = exp(((t * t) / 2.0)) * (y * -t_1);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((2.0d0 * z))
if ((t * t) <= 4.4d-5) then
tmp = ((x * 0.5d0) - y) * t_1
else
tmp = exp(((t * t) / 2.0d0)) * (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 tmp;
if ((t * t) <= 4.4e-5) {
tmp = ((x * 0.5) - y) * t_1;
} else {
tmp = Math.exp(((t * t) / 2.0)) * (y * -t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((2.0 * z)) tmp = 0 if (t * t) <= 4.4e-5: tmp = ((x * 0.5) - y) * t_1 else: tmp = math.exp(((t * t) / 2.0)) * (y * -t_1) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(2.0 * z)) tmp = 0.0 if (Float64(t * t) <= 4.4e-5) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(y * Float64(-t_1))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((2.0 * z)); tmp = 0.0; if ((t * t) <= 4.4e-5) tmp = ((x * 0.5) - y) * t_1; else tmp = exp(((t * t) / 2.0)) * (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]}, If[LessEqual[N[(t * t), $MachinePrecision], 4.4e-5], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(y * (-t$95$1)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{2 \cdot z}\\
\mathbf{if}\;t \cdot t \leq 4.4 \cdot 10^{-5}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(y \cdot \left(-t_1\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 4.3999999999999999e-5Initial program 99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 99.1%
*-commutative99.1%
sqrt-prod99.3%
Applied egg-rr99.3%
if 4.3999999999999999e-5 < (*.f64 t t) Initial program 99.2%
add-cube-cbrt99.2%
pow399.2%
Applied egg-rr99.2%
unpow399.2%
add-cube-cbrt99.2%
sqrt-prod99.2%
*-commutative99.2%
associate-*r*99.2%
add-cbrt-cube82.9%
add-sqr-sqrt82.9%
cbrt-prod99.2%
associate-*r*99.2%
Applied egg-rr99.2%
Taylor expanded in x around 0 75.6%
Simplified75.6%
Final simplification87.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* 2.0 z))))
(if (<= y -8.6e-33)
(sqrt (* 2.0 (* z (* y y))))
(if (<= y 1.85e+42) (* x (* 0.5 t_1)) (* y (- t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((2.0 * z));
double tmp;
if (y <= -8.6e-33) {
tmp = sqrt((2.0 * (z * (y * y))));
} else if (y <= 1.85e+42) {
tmp = x * (0.5 * t_1);
} else {
tmp = y * -t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((2.0d0 * z))
if (y <= (-8.6d-33)) then
tmp = sqrt((2.0d0 * (z * (y * y))))
else if (y <= 1.85d+42) then
tmp = x * (0.5d0 * t_1)
else
tmp = y * -t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((2.0 * z));
double tmp;
if (y <= -8.6e-33) {
tmp = Math.sqrt((2.0 * (z * (y * y))));
} else if (y <= 1.85e+42) {
tmp = x * (0.5 * t_1);
} else {
tmp = y * -t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((2.0 * z)) tmp = 0 if y <= -8.6e-33: tmp = math.sqrt((2.0 * (z * (y * y)))) elif y <= 1.85e+42: tmp = x * (0.5 * t_1) else: tmp = y * -t_1 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(2.0 * z)) tmp = 0.0 if (y <= -8.6e-33) tmp = sqrt(Float64(2.0 * Float64(z * Float64(y * y)))); elseif (y <= 1.85e+42) tmp = Float64(x * Float64(0.5 * t_1)); else tmp = Float64(y * Float64(-t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((2.0 * z)); tmp = 0.0; if (y <= -8.6e-33) tmp = sqrt((2.0 * (z * (y * y)))); elseif (y <= 1.85e+42) tmp = x * (0.5 * t_1); else tmp = 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]}, If[LessEqual[y, -8.6e-33], N[Sqrt[N[(2.0 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 1.85e+42], N[(x * N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision], N[(y * (-t$95$1)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{2 \cdot z}\\
\mathbf{if}\;y \leq -8.6 \cdot 10^{-33}:\\
\;\;\;\;\sqrt{2 \cdot \left(z \cdot \left(y \cdot y\right)\right)}\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+42}:\\
\;\;\;\;x \cdot \left(0.5 \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-t_1\right)\\
\end{array}
\end{array}
if y < -8.60000000000000062e-33Initial program 99.9%
Taylor expanded in t around 0 55.9%
associate-*l*56.0%
*-commutative56.0%
fma-neg56.0%
Simplified56.0%
Taylor expanded in x around 0 43.4%
mul-1-neg43.4%
distribute-rgt-neg-in43.4%
Simplified43.4%
add-sqr-sqrt43.2%
sqrt-unprod58.4%
swap-sqr58.3%
add-sqr-sqrt58.4%
*-commutative58.4%
*-commutative58.4%
swap-sqr56.9%
sqr-neg56.9%
add-sqr-sqrt56.9%
Applied egg-rr56.9%
if -8.60000000000000062e-33 < y < 1.84999999999999998e42Initial program 99.0%
Taylor expanded in t around 0 55.3%
Taylor expanded in x around inf 46.0%
*-commutative46.0%
associate-*r*46.0%
*-commutative46.0%
Simplified46.0%
expm1-log1p-u29.7%
expm1-udef15.1%
*-commutative15.1%
*-commutative15.1%
associate-*l*15.1%
*-commutative15.1%
sqrt-prod15.1%
Applied egg-rr15.1%
expm1-def29.7%
expm1-log1p46.1%
associate-*l*46.1%
*-commutative46.1%
Simplified46.1%
if 1.84999999999999998e42 < y Initial program 99.9%
Taylor expanded in t around 0 57.2%
associate-*l*57.1%
*-commutative57.1%
fma-neg57.1%
Simplified57.1%
Taylor expanded in x around 0 46.3%
mul-1-neg46.3%
distribute-rgt-neg-in46.3%
Simplified46.3%
associate-*r*46.3%
distribute-rgt-neg-out46.3%
add-sqr-sqrt46.3%
sqr-neg46.3%
sqrt-unprod0.0%
add-sqr-sqrt1.1%
associate-*r*1.1%
*-commutative1.1%
associate-*l*1.1%
add-sqr-sqrt0.0%
sqrt-unprod46.4%
sqr-neg46.4%
add-sqr-sqrt46.4%
sqrt-prod46.4%
Applied egg-rr46.4%
distribute-lft-neg-in46.4%
*-commutative46.4%
*-commutative46.4%
Simplified46.4%
Final simplification49.4%
(FPCore (x y z t) :precision binary64 (if (<= t 2.05e+30) (* (- (* x 0.5) y) (sqrt (* 2.0 z))) (sqrt (* 2.0 (* z (* y y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.05e+30) {
tmp = ((x * 0.5) - y) * sqrt((2.0 * z));
} else {
tmp = sqrt((2.0 * (z * (y * 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 <= 2.05d+30) then
tmp = ((x * 0.5d0) - y) * sqrt((2.0d0 * z))
else
tmp = sqrt((2.0d0 * (z * (y * y))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.05e+30) {
tmp = ((x * 0.5) - y) * Math.sqrt((2.0 * z));
} else {
tmp = Math.sqrt((2.0 * (z * (y * y))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.05e+30: tmp = ((x * 0.5) - y) * math.sqrt((2.0 * z)) else: tmp = math.sqrt((2.0 * (z * (y * y)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.05e+30) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))); else tmp = sqrt(Float64(2.0 * Float64(z * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.05e+30) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); else tmp = sqrt((2.0 * (z * (y * y)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.05e+30], 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[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.05 \cdot 10^{+30}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(z \cdot \left(y \cdot y\right)\right)}\\
\end{array}
\end{array}
if t < 2.05000000000000003e30Initial program 99.3%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 68.6%
*-commutative68.6%
sqrt-prod68.7%
Applied egg-rr68.7%
if 2.05000000000000003e30 < t Initial program 100.0%
Taylor expanded in t around 0 8.3%
associate-*l*8.3%
*-commutative8.3%
fma-neg8.3%
Simplified8.3%
Taylor expanded in x around 0 6.8%
mul-1-neg6.8%
distribute-rgt-neg-in6.8%
Simplified6.8%
add-sqr-sqrt5.6%
sqrt-unprod21.8%
swap-sqr21.8%
add-sqr-sqrt21.8%
*-commutative21.8%
*-commutative21.8%
swap-sqr27.2%
sqr-neg27.2%
add-sqr-sqrt27.2%
Applied egg-rr27.2%
Final simplification60.0%
(FPCore (x y z t) :precision binary64 (if (<= t 2.2e+30) (* y (- (sqrt (* 2.0 z)))) (sqrt (* 2.0 (* z (* y y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.2e+30) {
tmp = y * -sqrt((2.0 * z));
} else {
tmp = sqrt((2.0 * (z * (y * 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 <= 2.2d+30) then
tmp = y * -sqrt((2.0d0 * z))
else
tmp = sqrt((2.0d0 * (z * (y * y))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2.2e+30) {
tmp = y * -Math.sqrt((2.0 * z));
} else {
tmp = Math.sqrt((2.0 * (z * (y * y))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 2.2e+30: tmp = y * -math.sqrt((2.0 * z)) else: tmp = math.sqrt((2.0 * (z * (y * y)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 2.2e+30) tmp = Float64(y * Float64(-sqrt(Float64(2.0 * z)))); else tmp = sqrt(Float64(2.0 * Float64(z * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 2.2e+30) tmp = y * -sqrt((2.0 * z)); else tmp = sqrt((2.0 * (z * (y * y)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 2.2e+30], N[(y * (-N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[Sqrt[N[(2.0 * N[(z * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.2 \cdot 10^{+30}:\\
\;\;\;\;y \cdot \left(-\sqrt{2 \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(z \cdot \left(y \cdot y\right)\right)}\\
\end{array}
\end{array}
if t < 2.2e30Initial program 99.3%
Taylor expanded in t around 0 68.6%
associate-*l*68.6%
*-commutative68.6%
fma-neg68.6%
Simplified68.6%
Taylor expanded in x around 0 34.1%
mul-1-neg34.1%
distribute-rgt-neg-in34.1%
Simplified34.1%
associate-*r*34.0%
distribute-rgt-neg-out34.0%
add-sqr-sqrt34.0%
sqr-neg34.0%
sqrt-unprod0.0%
add-sqr-sqrt2.4%
associate-*r*2.4%
*-commutative2.4%
associate-*l*2.4%
add-sqr-sqrt0.0%
sqrt-unprod34.1%
sqr-neg34.1%
add-sqr-sqrt34.1%
sqrt-prod34.2%
Applied egg-rr34.2%
distribute-lft-neg-in34.2%
*-commutative34.2%
*-commutative34.2%
Simplified34.2%
if 2.2e30 < t Initial program 100.0%
Taylor expanded in t around 0 8.3%
associate-*l*8.3%
*-commutative8.3%
fma-neg8.3%
Simplified8.3%
Taylor expanded in x around 0 6.8%
mul-1-neg6.8%
distribute-rgt-neg-in6.8%
Simplified6.8%
add-sqr-sqrt5.6%
sqrt-unprod21.8%
swap-sqr21.8%
add-sqr-sqrt21.8%
*-commutative21.8%
*-commutative21.8%
swap-sqr27.2%
sqr-neg27.2%
add-sqr-sqrt27.2%
Applied egg-rr27.2%
Final simplification32.7%
(FPCore (x y z t) :precision binary64 (if (<= x 6.5e-100) (* y (- (sqrt (* 2.0 z)))) (sqrt (* (* 0.5 z) (* x x)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 6.5e-100) {
tmp = y * -sqrt((2.0 * z));
} else {
tmp = sqrt(((0.5 * z) * (x * 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 (x <= 6.5d-100) then
tmp = y * -sqrt((2.0d0 * z))
else
tmp = sqrt(((0.5d0 * z) * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 6.5e-100) {
tmp = y * -Math.sqrt((2.0 * z));
} else {
tmp = Math.sqrt(((0.5 * z) * (x * x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 6.5e-100: tmp = y * -math.sqrt((2.0 * z)) else: tmp = math.sqrt(((0.5 * z) * (x * x))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 6.5e-100) tmp = Float64(y * Float64(-sqrt(Float64(2.0 * z)))); else tmp = sqrt(Float64(Float64(0.5 * z) * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 6.5e-100) tmp = y * -sqrt((2.0 * z)); else tmp = sqrt(((0.5 * z) * (x * x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 6.5e-100], N[(y * (-N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[Sqrt[N[(N[(0.5 * z), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{-100}:\\
\;\;\;\;y \cdot \left(-\sqrt{2 \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(0.5 \cdot z\right) \cdot \left(x \cdot x\right)}\\
\end{array}
\end{array}
if x < 6.50000000000000013e-100Initial program 99.3%
Taylor expanded in t around 0 55.7%
associate-*l*55.8%
*-commutative55.8%
fma-neg55.8%
Simplified55.8%
Taylor expanded in x around 0 33.7%
mul-1-neg33.7%
distribute-rgt-neg-in33.7%
Simplified33.7%
associate-*r*33.7%
distribute-rgt-neg-out33.7%
add-sqr-sqrt33.7%
sqr-neg33.7%
sqrt-unprod0.0%
add-sqr-sqrt2.2%
associate-*r*2.2%
*-commutative2.2%
associate-*l*2.2%
add-sqr-sqrt0.0%
sqrt-unprod33.7%
sqr-neg33.7%
add-sqr-sqrt33.7%
sqrt-prod33.8%
Applied egg-rr33.8%
distribute-lft-neg-in33.8%
*-commutative33.8%
*-commutative33.8%
Simplified33.8%
if 6.50000000000000013e-100 < x Initial program 99.8%
Taylor expanded in t around 0 56.1%
Taylor expanded in x around inf 39.5%
*-commutative39.5%
associate-*r*39.5%
*-commutative39.5%
Simplified39.5%
add-sqr-sqrt39.4%
sqrt-unprod44.8%
*-commutative44.8%
*-commutative44.8%
swap-sqr45.9%
add-sqr-sqrt45.9%
*-commutative45.9%
*-commutative45.9%
swap-sqr45.9%
add-sqr-sqrt46.0%
pow246.0%
Applied egg-rr46.0%
associate-*r*46.0%
*-commutative46.0%
unpow246.0%
swap-sqr46.0%
metadata-eval46.0%
Simplified46.0%
Taylor expanded in z around 0 46.0%
associate-*r*46.0%
unpow246.0%
Simplified46.0%
Final simplification37.9%
(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.5%
Taylor expanded in t around 0 55.8%
associate-*l*55.9%
*-commutative55.9%
fma-neg55.9%
Simplified55.9%
Taylor expanded in x around 0 28.3%
mul-1-neg28.3%
distribute-rgt-neg-in28.3%
Simplified28.3%
associate-*r*28.3%
distribute-rgt-neg-out28.3%
add-sqr-sqrt28.3%
sqr-neg28.3%
sqrt-unprod0.0%
add-sqr-sqrt2.2%
associate-*r*2.2%
*-commutative2.2%
associate-*l*2.2%
add-sqr-sqrt0.0%
sqrt-unprod28.4%
sqr-neg28.4%
add-sqr-sqrt28.4%
sqrt-prod28.4%
Applied egg-rr28.4%
distribute-lft-neg-in28.4%
*-commutative28.4%
*-commutative28.4%
Simplified28.4%
Final simplification28.4%
(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 * 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 \sqrt{2 \cdot z}
\end{array}
Initial program 99.5%
Taylor expanded in t around 0 55.8%
associate-*l*55.9%
*-commutative55.9%
fma-neg55.9%
Simplified55.9%
Taylor expanded in x around 0 28.3%
mul-1-neg28.3%
distribute-rgt-neg-in28.3%
Simplified28.3%
expm1-log1p-u18.0%
expm1-udef12.3%
*-commutative12.3%
associate-*l*12.3%
add-sqr-sqrt0.0%
sqrt-unprod1.9%
sqr-neg1.9%
add-sqr-sqrt1.9%
sqrt-prod1.9%
Applied egg-rr1.9%
expm1-def1.9%
expm1-log1p2.2%
*-commutative2.2%
Simplified2.2%
Final simplification2.2%
(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 2023202
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:herbie-target
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp 1.0) (/ (* t t) 2.0)))
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))