
(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 12 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 (* (sqrt (* z 2.0)) (* (- (* x 0.5) y) (pow (exp t) (* 0.5 t)))))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * (((x * 0.5) - y) * pow(exp(t), (0.5 * 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 = sqrt((z * 2.0d0)) * (((x * 0.5d0) - y) * (exp(t) ** (0.5d0 * t)))
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * (((x * 0.5) - y) * Math.pow(Math.exp(t), (0.5 * t)));
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * (((x * 0.5) - y) * math.pow(math.exp(t), (0.5 * t)))
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(Float64(x * 0.5) - y) * (exp(t) ^ Float64(0.5 * t)))) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * (((x * 0.5) - y) * (exp(t) ^ (0.5 * t))); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Power[N[Exp[t], $MachinePrecision], N[(0.5 * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot {\left(e^{t}\right)}^{\left(0.5 \cdot t\right)}\right)
\end{array}
Initial program 99.0%
*-commutative99.0%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
pow-exp99.8%
pow1/299.8%
pow-pow99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) (* (- (* x 0.5) y) (sqrt (exp (* t t))))))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * (((x * 0.5) - y) * sqrt(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 = sqrt((z * 2.0d0)) * (((x * 0.5d0) - y) * sqrt(exp((t * t))))
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * (((x * 0.5) - y) * Math.sqrt(Math.exp((t * t))));
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * (((x * 0.5) - y) * math.sqrt(math.exp((t * t))))
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(exp(Float64(t * t))))) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * (((x * 0.5) - y) * sqrt(exp((t * t)))); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{e^{t \cdot t}}\right)
\end{array}
Initial program 99.0%
*-commutative99.0%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))) (t_2 (- (* x 0.5) y)))
(if (<= (* t t) 1e-9)
(* t_1 t_2)
(if (<= (* t t) 5e+111)
(* (exp (/ (* t t) 2.0)) (* t_1 (- y)))
(* t_1 (* 0.5 (* t_2 (pow t 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double t_2 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 1e-9) {
tmp = t_1 * t_2;
} else if ((t * t) <= 5e+111) {
tmp = exp(((t * t) / 2.0)) * (t_1 * -y);
} else {
tmp = t_1 * (0.5 * (t_2 * pow(t, 2.0)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
t_2 = (x * 0.5d0) - y
if ((t * t) <= 1d-9) then
tmp = t_1 * t_2
else if ((t * t) <= 5d+111) then
tmp = exp(((t * t) / 2.0d0)) * (t_1 * -y)
else
tmp = t_1 * (0.5d0 * (t_2 * (t ** 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double t_2 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 1e-9) {
tmp = t_1 * t_2;
} else if ((t * t) <= 5e+111) {
tmp = Math.exp(((t * t) / 2.0)) * (t_1 * -y);
} else {
tmp = t_1 * (0.5 * (t_2 * Math.pow(t, 2.0)));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) t_2 = (x * 0.5) - y tmp = 0 if (t * t) <= 1e-9: tmp = t_1 * t_2 elif (t * t) <= 5e+111: tmp = math.exp(((t * t) / 2.0)) * (t_1 * -y) else: tmp = t_1 * (0.5 * (t_2 * math.pow(t, 2.0))) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) t_2 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(t * t) <= 1e-9) tmp = Float64(t_1 * t_2); elseif (Float64(t * t) <= 5e+111) tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(t_1 * Float64(-y))); else tmp = Float64(t_1 * Float64(0.5 * Float64(t_2 * (t ^ 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); t_2 = (x * 0.5) - y; tmp = 0.0; if ((t * t) <= 1e-9) tmp = t_1 * t_2; elseif ((t * t) <= 5e+111) tmp = exp(((t * t) / 2.0)) * (t_1 * -y); else tmp = t_1 * (0.5 * (t_2 * (t ^ 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 1e-9], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[N[(t * t), $MachinePrecision], 5e+111], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * (-y)), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(0.5 * N[(t$95$2 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
t_2 := x \cdot 0.5 - y\\
\mathbf{if}\;t \cdot t \leq 10^{-9}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t \cdot t \leq 5 \cdot 10^{+111}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(t\_1 \cdot \left(-y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(0.5 \cdot \left(t\_2 \cdot {t}^{2}\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 1.00000000000000006e-9Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 99.2%
if 1.00000000000000006e-9 < (*.f64 t t) < 4.9999999999999997e111Initial program 99.8%
Taylor expanded in x around 0 76.7%
mul-1-neg76.7%
associate-*l*76.7%
*-commutative76.7%
distribute-rgt-neg-in76.7%
*-commutative76.7%
Simplified76.7%
*-commutative76.7%
sqrt-prod76.7%
Applied egg-rr76.7%
if 4.9999999999999997e111 < (*.f64 t t) Initial program 98.1%
*-commutative98.1%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in t around inf 88.1%
Final simplification92.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= (* t t) 1e-9)
(* t_1 (- (* 0.5 (- x (* y (pow t 2.0)))) y))
(if (<= (* t t) 5e+111)
(* (exp (/ (* t t) 2.0)) (* t_1 (- y)))
(* t_1 (* 0.5 (* (- (* x 0.5) y) (pow t 2.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t * t) <= 1e-9) {
tmp = t_1 * ((0.5 * (x - (y * pow(t, 2.0)))) - y);
} else if ((t * t) <= 5e+111) {
tmp = exp(((t * t) / 2.0)) * (t_1 * -y);
} else {
tmp = t_1 * (0.5 * (((x * 0.5) - y) * pow(t, 2.0)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if ((t * t) <= 1d-9) then
tmp = t_1 * ((0.5d0 * (x - (y * (t ** 2.0d0)))) - y)
else if ((t * t) <= 5d+111) then
tmp = exp(((t * t) / 2.0d0)) * (t_1 * -y)
else
tmp = t_1 * (0.5d0 * (((x * 0.5d0) - y) * (t ** 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double tmp;
if ((t * t) <= 1e-9) {
tmp = t_1 * ((0.5 * (x - (y * Math.pow(t, 2.0)))) - y);
} else if ((t * t) <= 5e+111) {
tmp = Math.exp(((t * t) / 2.0)) * (t_1 * -y);
} else {
tmp = t_1 * (0.5 * (((x * 0.5) - y) * Math.pow(t, 2.0)));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t * t) <= 1e-9: tmp = t_1 * ((0.5 * (x - (y * math.pow(t, 2.0)))) - y) elif (t * t) <= 5e+111: tmp = math.exp(((t * t) / 2.0)) * (t_1 * -y) else: tmp = t_1 * (0.5 * (((x * 0.5) - y) * math.pow(t, 2.0))) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (Float64(t * t) <= 1e-9) tmp = Float64(t_1 * Float64(Float64(0.5 * Float64(x - Float64(y * (t ^ 2.0)))) - y)); elseif (Float64(t * t) <= 5e+111) tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(t_1 * Float64(-y))); else tmp = Float64(t_1 * Float64(0.5 * Float64(Float64(Float64(x * 0.5) - y) * (t ^ 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((t * t) <= 1e-9) tmp = t_1 * ((0.5 * (x - (y * (t ^ 2.0)))) - y); elseif ((t * t) <= 5e+111) tmp = exp(((t * t) / 2.0)) * (t_1 * -y); else tmp = t_1 * (0.5 * (((x * 0.5) - y) * (t ^ 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 1e-9], N[(t$95$1 * N[(N[(0.5 * N[(x - N[(y * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * t), $MachinePrecision], 5e+111], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * (-y)), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(0.5 * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 10^{-9}:\\
\;\;\;\;t\_1 \cdot \left(0.5 \cdot \left(x - y \cdot {t}^{2}\right) - y\right)\\
\mathbf{elif}\;t \cdot t \leq 5 \cdot 10^{+111}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(t\_1 \cdot \left(-y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(0.5 \cdot \left(\left(x \cdot 0.5 - y\right) \cdot {t}^{2}\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 1.00000000000000006e-9Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
pow-exp99.7%
pow1/299.7%
pow-pow99.7%
Applied egg-rr99.7%
Taylor expanded in t around 0 99.7%
distribute-lft-out99.7%
Simplified99.7%
Taylor expanded in x around 0 99.5%
associate-*r*99.5%
neg-mul-199.5%
Simplified99.5%
if 1.00000000000000006e-9 < (*.f64 t t) < 4.9999999999999997e111Initial program 99.8%
Taylor expanded in x around 0 76.7%
mul-1-neg76.7%
associate-*l*76.7%
*-commutative76.7%
distribute-rgt-neg-in76.7%
*-commutative76.7%
Simplified76.7%
*-commutative76.7%
sqrt-prod76.7%
Applied egg-rr76.7%
if 4.9999999999999997e111 < (*.f64 t t) Initial program 98.1%
*-commutative98.1%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in t around inf 88.1%
Final simplification92.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= (* t t) 1e-9)
(* t_1 (- (* x 0.5) y))
(* (exp (/ (* t t) 2.0)) (* t_1 (- y))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t * t) <= 1e-9) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = exp(((t * t) / 2.0)) * (t_1 * -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) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if ((t * t) <= 1d-9) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = exp(((t * t) / 2.0d0)) * (t_1 * -y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double tmp;
if ((t * t) <= 1e-9) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = Math.exp(((t * t) / 2.0)) * (t_1 * -y);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t * t) <= 1e-9: tmp = t_1 * ((x * 0.5) - y) else: tmp = math.exp(((t * t) / 2.0)) * (t_1 * -y) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (Float64(t * t) <= 1e-9) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(t_1 * Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((t * t) <= 1e-9) tmp = t_1 * ((x * 0.5) - y); else tmp = exp(((t * t) / 2.0)) * (t_1 * -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 1e-9], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 10^{-9}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(t\_1 \cdot \left(-y\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 1.00000000000000006e-9Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 99.2%
if 1.00000000000000006e-9 < (*.f64 t t) Initial program 98.4%
Taylor expanded in x around 0 72.3%
mul-1-neg72.3%
associate-*l*72.3%
*-commutative72.3%
distribute-rgt-neg-in72.3%
*-commutative72.3%
Simplified72.3%
*-commutative72.3%
sqrt-prod72.3%
Applied egg-rr72.3%
Final simplification85.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= (* t t) 1e+64)
(* t_1 (- (* x 0.5) y))
(* t_1 (* (pow t 2.0) (* x 0.25))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t * t) <= 1e+64) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * (pow(t, 2.0) * (x * 0.25));
}
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((z * 2.0d0))
if ((t * t) <= 1d+64) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = t_1 * ((t ** 2.0d0) * (x * 0.25d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double tmp;
if ((t * t) <= 1e+64) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * (Math.pow(t, 2.0) * (x * 0.25));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t * t) <= 1e+64: tmp = t_1 * ((x * 0.5) - y) else: tmp = t_1 * (math.pow(t, 2.0) * (x * 0.25)) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (Float64(t * t) <= 1e+64) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(t_1 * Float64((t ^ 2.0) * Float64(x * 0.25))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((t * t) <= 1e+64) tmp = t_1 * ((x * 0.5) - y); else tmp = t_1 * ((t ^ 2.0) * (x * 0.25)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 1e+64], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[Power[t, 2.0], $MachinePrecision] * N[(x * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \cdot t \leq 10^{+64}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left({t}^{2} \cdot \left(x \cdot 0.25\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 1.00000000000000002e64Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 94.4%
if 1.00000000000000002e64 < (*.f64 t t) Initial program 98.3%
*-commutative98.3%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in x around inf 49.2%
Taylor expanded in t around inf 49.2%
associate-*r*49.2%
*-commutative49.2%
Simplified49.2%
Taylor expanded in x around 0 49.2%
*-commutative49.2%
associate-*l*49.2%
Simplified49.2%
Final simplification73.2%
(FPCore (x y z t) :precision binary64 (* (exp (/ (* t t) 2.0)) (* (sqrt (* z 2.0)) (- (* x 0.5) y))))
double code(double x, double y, double z, double t) {
return exp(((t * t) / 2.0)) * (sqrt((z * 2.0)) * ((x * 0.5) - 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 = exp(((t * t) / 2.0d0)) * (sqrt((z * 2.0d0)) * ((x * 0.5d0) - y))
end function
public static double code(double x, double y, double z, double t) {
return Math.exp(((t * t) / 2.0)) * (Math.sqrt((z * 2.0)) * ((x * 0.5) - y));
}
def code(x, y, z, t): return math.exp(((t * t) / 2.0)) * (math.sqrt((z * 2.0)) * ((x * 0.5) - y))
function code(x, y, z, t) return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y))) end
function tmp = code(x, y, z, t) tmp = exp(((t * t) / 2.0)) * (sqrt((z * 2.0)) * ((x * 0.5) - y)); end
code[x_, y_, z_, t_] := N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\frac{t \cdot t}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right)
\end{array}
Initial program 99.0%
Final simplification99.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= t 2.3e+32)
(* t_1 (- (* x 0.5) y))
(* t_1 (* 0.5 (* x (/ t (/ 2.0 t))))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t <= 2.3e+32) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * (0.5 * (x * (t / (2.0 / t))));
}
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((z * 2.0d0))
if (t <= 2.3d+32) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = t_1 * (0.5d0 * (x * (t / (2.0d0 / t))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double tmp;
if (t <= 2.3e+32) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * (0.5 * (x * (t / (2.0 / t))));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t <= 2.3e+32: tmp = t_1 * ((x * 0.5) - y) else: tmp = t_1 * (0.5 * (x * (t / (2.0 / t)))) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 2.3e+32) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(t_1 * Float64(0.5 * Float64(x * Float64(t / Float64(2.0 / t))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 2.3e+32) tmp = t_1 * ((x * 0.5) - y); else tmp = t_1 * (0.5 * (x * (t / (2.0 / t)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 2.3e+32], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(0.5 * N[(x * N[(t / N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 2.3 \cdot 10^{+32}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(0.5 \cdot \left(x \cdot \frac{t}{\frac{2}{t}}\right)\right)\\
\end{array}
\end{array}
if t < 2.3e32Initial program 99.3%
*-commutative99.3%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 68.9%
if 2.3e32 < t Initial program 98.3%
*-commutative98.3%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 82.2%
*-commutative82.2%
Simplified82.2%
Taylor expanded in x around inf 39.9%
Taylor expanded in t around inf 39.9%
associate-*r*39.9%
*-commutative39.9%
Simplified39.9%
*-commutative39.9%
metadata-eval39.9%
div-inv39.9%
pow239.9%
associate-/l*39.9%
Applied egg-rr39.9%
Final simplification62.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= y -6.6e-110) (not (<= y 4.7e+157)))
(* t_1 (- y))
(* t_1 (* x 0.5)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((y <= -6.6e-110) || !(y <= 4.7e+157)) {
tmp = t_1 * -y;
} else {
tmp = t_1 * (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) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if ((y <= (-6.6d-110)) .or. (.not. (y <= 4.7d+157))) then
tmp = t_1 * -y
else
tmp = t_1 * (x * 0.5d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
double tmp;
if ((y <= -6.6e-110) || !(y <= 4.7e+157)) {
tmp = t_1 * -y;
} else {
tmp = t_1 * (x * 0.5);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (y <= -6.6e-110) or not (y <= 4.7e+157): tmp = t_1 * -y else: tmp = t_1 * (x * 0.5) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if ((y <= -6.6e-110) || !(y <= 4.7e+157)) tmp = Float64(t_1 * Float64(-y)); else tmp = Float64(t_1 * Float64(x * 0.5)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((y <= -6.6e-110) || ~((y <= 4.7e+157))) tmp = t_1 * -y; else tmp = t_1 * (x * 0.5); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[y, -6.6e-110], N[Not[LessEqual[y, 4.7e+157]], $MachinePrecision]], N[(t$95$1 * (-y)), $MachinePrecision], N[(t$95$1 * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;y \leq -6.6 \cdot 10^{-110} \lor \neg \left(y \leq 4.7 \cdot 10^{+157}\right):\\
\;\;\;\;t\_1 \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if y < -6.5999999999999998e-110 or 4.7000000000000003e157 < y Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 60.1%
Taylor expanded in x around 0 46.5%
mul-1-neg46.5%
*-commutative46.5%
distribute-rgt-neg-in46.5%
Simplified46.5%
distribute-rgt-neg-out46.5%
neg-sub046.5%
*-commutative46.5%
associate-*r*46.5%
sqrt-prod46.6%
Applied egg-rr46.6%
neg-sub046.6%
distribute-rgt-neg-in46.6%
*-commutative46.6%
*-commutative46.6%
Simplified46.6%
if -6.5999999999999998e-110 < y < 4.7000000000000003e157Initial program 98.3%
*-commutative98.3%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in x around inf 65.4%
Taylor expanded in t around 0 41.2%
Final simplification43.8%
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) (- (* x 0.5) y)))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * ((x * 0.5) - 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)) * ((x * 0.5d0) - y)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * ((x * 0.5) - y);
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * ((x * 0.5) - y)
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * ((x * 0.5) - y); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)
\end{array}
Initial program 99.0%
*-commutative99.0%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 56.7%
Final simplification56.7%
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) (- y)))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * -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
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * -y;
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * -y
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * Float64(-y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * -y; end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(-y\right)
\end{array}
Initial program 99.0%
*-commutative99.0%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 56.7%
Taylor expanded in x around 0 30.1%
mul-1-neg30.1%
*-commutative30.1%
distribute-rgt-neg-in30.1%
Simplified30.1%
distribute-rgt-neg-out30.1%
neg-sub030.1%
*-commutative30.1%
associate-*r*30.1%
sqrt-prod30.2%
Applied egg-rr30.2%
neg-sub030.2%
distribute-rgt-neg-in30.2%
*-commutative30.2%
*-commutative30.2%
Simplified30.2%
Final simplification30.2%
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) y))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * 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
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * y;
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * y
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * y) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * y; end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot y
\end{array}
Initial program 99.0%
*-commutative99.0%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 56.7%
Taylor expanded in x around 0 30.1%
mul-1-neg30.1%
*-commutative30.1%
distribute-rgt-neg-in30.1%
Simplified30.1%
expm1-log1p-u18.1%
expm1-udef10.0%
add-sqr-sqrt9.0%
sqrt-unprod13.7%
sqr-neg13.7%
sqrt-unprod1.1%
add-sqr-sqrt2.2%
*-commutative2.2%
associate-*r*2.2%
sqrt-prod2.2%
Applied egg-rr2.2%
expm1-def2.2%
expm1-log1p2.4%
*-commutative2.4%
*-commutative2.4%
Simplified2.4%
Final simplification2.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 2024027
(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))))