
(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) (pow (* z (* 2.0 (pow (exp t) t))) 0.5)))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * pow((z * (2.0 * pow(exp(t), t))), 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 = ((x * 0.5d0) - y) * ((z * (2.0d0 * (exp(t) ** t))) ** 0.5d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.pow((z * (2.0 * Math.pow(Math.exp(t), t))), 0.5);
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.pow((z * (2.0 * math.pow(math.exp(t), t))), 0.5)
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * (Float64(z * Float64(2.0 * (exp(t) ^ t))) ^ 0.5)) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * ((z * (2.0 * (exp(t) ^ t))) ^ 0.5); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Power[N[(z * N[(2.0 * N[Power[N[Exp[t], $MachinePrecision], t], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot {\left(z \cdot \left(2 \cdot {\left(e^{t}\right)}^{t}\right)\right)}^{0.5}
\end{array}
Initial program 99.1%
sqr-neg99.1%
associate-/l*99.1%
distribute-frac-neg99.1%
exp-neg99.1%
associate-*r/99.0%
*-rgt-identity99.0%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
pow1/299.8%
pow1/299.8%
pow-prod-down99.8%
associate-*l*99.8%
exp-prod99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (exp (* t t)) (* z 2.0)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((exp((t * t)) * (z * 2.0)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * 0.5d0) - y) * sqrt((exp((t * t)) * (z * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((Math.exp((t * t)) * (z * 2.0)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((math.exp((t * t)) * (z * 2.0)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(exp(Float64(t * t)) * Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((exp((t * t)) * (z * 2.0))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{e^{t \cdot t} \cdot \left(z \cdot 2\right)}
\end{array}
Initial program 99.1%
sqr-neg99.1%
associate-/l*99.1%
distribute-frac-neg99.1%
exp-neg99.1%
associate-*r/99.0%
*-rgt-identity99.0%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
expm1-log1p-u98.3%
expm1-udef74.4%
sqrt-unprod74.4%
associate-*l*74.4%
exp-prod74.4%
Applied egg-rr74.4%
expm1-def98.3%
expm1-log1p99.8%
associate-*r*99.8%
*-commutative99.8%
exp-prod99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* z 2.0) 1e+59)
(* t_1 (* (sqrt (* z 2.0)) (+ 1.0 (* 0.5 (* t t)))))
(* t_1 (pow (* z (* 2.0 (+ (* t t) 1.0))) 0.5)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((z * 2.0) <= 1e+59) {
tmp = t_1 * (sqrt((z * 2.0)) * (1.0 + (0.5 * (t * t))));
} else {
tmp = t_1 * pow((z * (2.0 * ((t * t) + 1.0))), 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) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if ((z * 2.0d0) <= 1d+59) then
tmp = t_1 * (sqrt((z * 2.0d0)) * (1.0d0 + (0.5d0 * (t * t))))
else
tmp = t_1 * ((z * (2.0d0 * ((t * t) + 1.0d0))) ** 0.5d0)
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 ((z * 2.0) <= 1e+59) {
tmp = t_1 * (Math.sqrt((z * 2.0)) * (1.0 + (0.5 * (t * t))));
} else {
tmp = t_1 * Math.pow((z * (2.0 * ((t * t) + 1.0))), 0.5);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (z * 2.0) <= 1e+59: tmp = t_1 * (math.sqrt((z * 2.0)) * (1.0 + (0.5 * (t * t)))) else: tmp = t_1 * math.pow((z * (2.0 * ((t * t) + 1.0))), 0.5) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(z * 2.0) <= 1e+59) tmp = Float64(t_1 * Float64(sqrt(Float64(z * 2.0)) * Float64(1.0 + Float64(0.5 * Float64(t * t))))); else tmp = Float64(t_1 * (Float64(z * Float64(2.0 * Float64(Float64(t * t) + 1.0))) ^ 0.5)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if ((z * 2.0) <= 1e+59) tmp = t_1 * (sqrt((z * 2.0)) * (1.0 + (0.5 * (t * t)))); else tmp = t_1 * ((z * (2.0 * ((t * t) + 1.0))) ^ 0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(z * 2.0), $MachinePrecision], 1e+59], N[(t$95$1 * N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Power[N[(z * N[(2.0 * N[(N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;z \cdot 2 \leq 10^{+59}:\\
\;\;\;\;t_1 \cdot \left(\sqrt{z \cdot 2} \cdot \left(1 + 0.5 \cdot \left(t \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot {\left(z \cdot \left(2 \cdot \left(t \cdot t + 1\right)\right)\right)}^{0.5}\\
\end{array}
\end{array}
if (*.f64 z 2) < 9.99999999999999972e58Initial program 98.6%
sqr-neg98.6%
associate-/l*98.6%
distribute-frac-neg98.6%
exp-neg98.6%
associate-*r/98.5%
*-rgt-identity98.5%
associate-*r/99.9%
*-rgt-identity99.9%
associate-*r/99.9%
exp-neg99.9%
distribute-frac-neg99.9%
associate-/l*99.9%
sqr-neg99.9%
exp-sqrt99.9%
Simplified99.9%
Taylor expanded in t around 0 89.6%
unpow289.6%
Simplified89.6%
if 9.99999999999999972e58 < (*.f64 z 2) Initial program 99.8%
sqr-neg99.8%
associate-/l*99.8%
distribute-frac-neg99.8%
exp-neg99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
pow1/299.8%
pow1/299.8%
pow-prod-down99.8%
associate-*l*99.8%
exp-prod99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 95.2%
+-commutative95.2%
unpow295.2%
Simplified95.2%
Final simplification91.8%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (pow (* z (* 2.0 (+ (* t t) 1.0))) 0.5)))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * pow((z * (2.0 * ((t * t) + 1.0))), 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 = ((x * 0.5d0) - y) * ((z * (2.0d0 * ((t * t) + 1.0d0))) ** 0.5d0)
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.pow((z * (2.0 * ((t * t) + 1.0))), 0.5);
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.pow((z * (2.0 * ((t * t) + 1.0))), 0.5)
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * (Float64(z * Float64(2.0 * Float64(Float64(t * t) + 1.0))) ^ 0.5)) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * ((z * (2.0 * ((t * t) + 1.0))) ^ 0.5); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Power[N[(z * N[(2.0 * N[(N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot {\left(z \cdot \left(2 \cdot \left(t \cdot t + 1\right)\right)\right)}^{0.5}
\end{array}
Initial program 99.1%
sqr-neg99.1%
associate-/l*99.1%
distribute-frac-neg99.1%
exp-neg99.1%
associate-*r/99.0%
*-rgt-identity99.0%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
pow1/299.8%
pow1/299.8%
pow-prod-down99.8%
associate-*l*99.8%
exp-prod99.8%
Applied egg-rr99.8%
Taylor expanded in t around 0 90.0%
+-commutative90.0%
unpow290.0%
Simplified90.0%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (<= t 3.6e+27) (* (- (* x 0.5) y) (pow (* z 2.0) 0.5)) (sqrt (* z (* 2.0 (* 0.25 (* x x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.6e+27) {
tmp = ((x * 0.5) - y) * pow((z * 2.0), 0.5);
} else {
tmp = sqrt((z * (2.0 * (0.25 * (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 (t <= 3.6d+27) then
tmp = ((x * 0.5d0) - y) * ((z * 2.0d0) ** 0.5d0)
else
tmp = sqrt((z * (2.0d0 * (0.25d0 * (x * x)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.6e+27) {
tmp = ((x * 0.5) - y) * Math.pow((z * 2.0), 0.5);
} else {
tmp = Math.sqrt((z * (2.0 * (0.25 * (x * x)))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 3.6e+27: tmp = ((x * 0.5) - y) * math.pow((z * 2.0), 0.5) else: tmp = math.sqrt((z * (2.0 * (0.25 * (x * x))))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 3.6e+27) tmp = Float64(Float64(Float64(x * 0.5) - y) * (Float64(z * 2.0) ^ 0.5)); else tmp = sqrt(Float64(z * Float64(2.0 * Float64(0.25 * Float64(x * x))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 3.6e+27) tmp = ((x * 0.5) - y) * ((z * 2.0) ^ 0.5); else tmp = sqrt((z * (2.0 * (0.25 * (x * x))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 3.6e+27], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Power[N[(z * 2.0), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(z * N[(2.0 * N[(0.25 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.6 \cdot 10^{+27}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot {\left(z \cdot 2\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(0.25 \cdot \left(x \cdot x\right)\right)\right)}\\
\end{array}
\end{array}
if t < 3.59999999999999983e27Initial program 99.3%
sqr-neg99.3%
associate-/l*99.3%
distribute-frac-neg99.3%
exp-neg99.3%
associate-*r/99.3%
*-rgt-identity99.3%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 72.7%
sqrt-prod73.0%
pow1/273.0%
Applied egg-rr73.0%
if 3.59999999999999983e27 < t Initial program 98.3%
Taylor expanded in t around 0 16.2%
associate-*r*16.2%
*-commutative16.2%
*-commutative16.2%
associate-*l*16.2%
*-commutative16.2%
Simplified16.2%
Taylor expanded in x around inf 9.9%
add-sqr-sqrt5.1%
sqrt-unprod15.1%
swap-sqr15.1%
add-sqr-sqrt15.1%
associate-*r*15.1%
*-commutative15.1%
associate-*r*15.1%
*-commutative15.1%
swap-sqr20.0%
pow220.0%
add-sqr-sqrt20.0%
Applied egg-rr20.0%
associate-*r*20.0%
*-commutative20.0%
unpow220.0%
*-commutative20.0%
*-commutative20.0%
swap-sqr20.0%
metadata-eval20.0%
Simplified20.0%
Final simplification61.0%
(FPCore (x y z t) :precision binary64 (if (<= t 3.5e+32) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (sqrt (* z (* 2.0 (* 0.25 (* x x)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.5e+32) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt((z * (2.0 * (0.25 * (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 (t <= 3.5d+32) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt((z * (2.0d0 * (0.25d0 * (x * x)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.5e+32) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt((z * (2.0 * (0.25 * (x * x)))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 3.5e+32: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt((z * (2.0 * (0.25 * (x * x))))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 3.5e+32) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(z * Float64(2.0 * Float64(0.25 * Float64(x * x))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 3.5e+32) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = sqrt((z * (2.0 * (0.25 * (x * x))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 3.5e+32], 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[(0.25 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.5 \cdot 10^{+32}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot \left(0.25 \cdot \left(x \cdot x\right)\right)\right)}\\
\end{array}
\end{array}
if t < 3.5000000000000001e32Initial program 99.3%
sqr-neg99.3%
associate-/l*99.3%
distribute-frac-neg99.3%
exp-neg99.3%
associate-*r/99.3%
*-rgt-identity99.3%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 72.7%
sqrt-prod73.0%
Applied egg-rr73.0%
if 3.5000000000000001e32 < t Initial program 98.3%
Taylor expanded in t around 0 16.2%
associate-*r*16.2%
*-commutative16.2%
*-commutative16.2%
associate-*l*16.2%
*-commutative16.2%
Simplified16.2%
Taylor expanded in x around inf 9.9%
add-sqr-sqrt5.1%
sqrt-unprod15.1%
swap-sqr15.1%
add-sqr-sqrt15.1%
associate-*r*15.1%
*-commutative15.1%
associate-*r*15.1%
*-commutative15.1%
swap-sqr20.0%
pow220.0%
add-sqr-sqrt20.0%
Applied egg-rr20.0%
associate-*r*20.0%
*-commutative20.0%
unpow220.0%
*-commutative20.0%
*-commutative20.0%
swap-sqr20.0%
metadata-eval20.0%
Simplified20.0%
Final simplification61.0%
(FPCore (x y z t) :precision binary64 (if (<= y -3.1e-7) (sqrt (* (* z 2.0) (* y y))) (* x (* 0.5 (sqrt (* z 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -3.1e-7) {
tmp = sqrt(((z * 2.0) * (y * y)));
} else {
tmp = x * (0.5 * 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.1d-7)) then
tmp = sqrt(((z * 2.0d0) * (y * y)))
else
tmp = x * (0.5d0 * 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.1e-7) {
tmp = Math.sqrt(((z * 2.0) * (y * y)));
} else {
tmp = x * (0.5 * Math.sqrt((z * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -3.1e-7: tmp = math.sqrt(((z * 2.0) * (y * y))) else: tmp = x * (0.5 * math.sqrt((z * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -3.1e-7) tmp = sqrt(Float64(Float64(z * 2.0) * Float64(y * y))); else tmp = Float64(x * Float64(0.5 * sqrt(Float64(z * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -3.1e-7) tmp = sqrt(((z * 2.0) * (y * y))); else tmp = x * (0.5 * sqrt((z * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -3.1e-7], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(x * N[(0.5 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{-7}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \left(y \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right)\\
\end{array}
\end{array}
if y < -3.1e-7Initial program 99.8%
Taylor expanded in t around 0 63.2%
associate-*r*63.1%
*-commutative63.1%
*-commutative63.1%
associate-*l*63.1%
*-commutative63.1%
Simplified63.1%
Taylor expanded in x around 0 48.9%
mul-1-neg48.9%
distribute-lft-neg-out48.9%
*-commutative48.9%
Simplified48.9%
expm1-log1p-u47.2%
expm1-udef39.3%
associate-*r*39.3%
sqrt-prod39.3%
add-sqr-sqrt39.3%
sqrt-unprod42.4%
sqr-neg42.4%
sqrt-prod0.0%
add-sqr-sqrt0.5%
Applied egg-rr0.5%
expm1-def0.3%
expm1-log1p1.2%
*-commutative1.2%
Simplified1.2%
add-sqr-sqrt0.0%
sqrt-unprod50.3%
*-commutative50.3%
*-commutative50.3%
*-commutative50.3%
*-commutative50.3%
swap-sqr52.0%
add-sqr-sqrt52.1%
Applied egg-rr52.1%
if -3.1e-7 < y Initial program 98.9%
Taylor expanded in t around 0 59.1%
associate-*r*59.0%
*-commutative59.0%
*-commutative59.0%
associate-*l*59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in x around inf 37.5%
expm1-log1p-u24.9%
expm1-udef14.0%
*-commutative14.0%
associate-*r*14.0%
*-commutative14.0%
associate-*l*14.0%
sqrt-prod14.0%
Applied egg-rr14.0%
expm1-def25.0%
expm1-log1p37.7%
associate-*l*37.7%
*-commutative37.7%
Simplified37.7%
Final simplification40.6%
(FPCore (x y z t) :precision binary64 (sqrt (* (* z 2.0) (* y y))))
double code(double x, double y, double z, double t) {
return sqrt(((z * 2.0) * (y * y)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = sqrt(((z * 2.0d0) * (y * y)))
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt(((z * 2.0) * (y * y)));
}
def code(x, y, z, t): return math.sqrt(((z * 2.0) * (y * y)))
function code(x, y, z, t) return sqrt(Float64(Float64(z * 2.0) * Float64(y * y))) end
function tmp = code(x, y, z, t) tmp = sqrt(((z * 2.0) * (y * y))); end
code[x_, y_, z_, t_] := N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(z \cdot 2\right) \cdot \left(y \cdot y\right)}
\end{array}
Initial program 99.1%
Taylor expanded in t around 0 59.9%
associate-*r*59.9%
*-commutative59.9%
*-commutative59.9%
associate-*l*59.9%
*-commutative59.9%
Simplified59.9%
Taylor expanded in x around 0 29.3%
mul-1-neg29.3%
distribute-lft-neg-out29.3%
*-commutative29.3%
Simplified29.3%
expm1-log1p-u16.5%
expm1-udef10.5%
associate-*r*10.5%
sqrt-prod10.5%
add-sqr-sqrt9.8%
sqrt-unprod12.6%
sqr-neg12.6%
sqrt-prod1.1%
add-sqr-sqrt2.6%
Applied egg-rr2.6%
expm1-def2.5%
expm1-log1p2.8%
*-commutative2.8%
Simplified2.8%
add-sqr-sqrt1.9%
sqrt-unprod16.0%
*-commutative16.0%
*-commutative16.0%
*-commutative16.0%
*-commutative16.0%
swap-sqr16.1%
add-sqr-sqrt16.1%
Applied egg-rr16.1%
Final simplification16.1%
(FPCore (x y z t) :precision binary64 (* y (sqrt (* z 2.0))))
double code(double x, double y, double z, double t) {
return y * sqrt((z * 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * sqrt((z * 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return y * Math.sqrt((z * 2.0));
}
def code(x, y, z, t): return y * math.sqrt((z * 2.0))
function code(x, y, z, t) return Float64(y * sqrt(Float64(z * 2.0))) end
function tmp = code(x, y, z, t) tmp = y * sqrt((z * 2.0)); end
code[x_, y_, z_, t_] := N[(y * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \sqrt{z \cdot 2}
\end{array}
Initial program 99.1%
Taylor expanded in t around 0 59.9%
associate-*r*59.9%
*-commutative59.9%
*-commutative59.9%
associate-*l*59.9%
*-commutative59.9%
Simplified59.9%
Taylor expanded in x around 0 29.3%
mul-1-neg29.3%
distribute-lft-neg-out29.3%
*-commutative29.3%
Simplified29.3%
expm1-log1p-u16.5%
expm1-udef10.5%
associate-*r*10.5%
sqrt-prod10.5%
add-sqr-sqrt9.8%
sqrt-unprod12.6%
sqr-neg12.6%
sqrt-prod1.1%
add-sqr-sqrt2.6%
Applied egg-rr2.6%
expm1-def2.5%
expm1-log1p2.8%
*-commutative2.8%
Simplified2.8%
Final simplification2.8%
(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 2023279
(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))))