
(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 (* (- (* 0.5 x) y) (sqrt (* z (* 2.0 (exp (pow t 2.0)))))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * sqrt((z * (2.0 * 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 = ((0.5d0 * x) - y) * sqrt((z * (2.0d0 * exp((t ** 2.0d0)))))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt((z * (2.0 * Math.exp(Math.pow(t, 2.0)))));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt((z * (2.0 * math.exp(math.pow(t, 2.0)))))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * Float64(2.0 * exp((t ^ 2.0)))))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt((z * (2.0 * exp((t ^ 2.0))))); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * N[(2.0 * N[Exp[N[Power[t, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot \left(2 \cdot e^{{t}^{2}}\right)}
\end{array}
Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
exp-sqrt99.8%
associate-*r*99.8%
*-commutative99.8%
expm1-log1p-u53.6%
expm1-udef37.9%
Applied egg-rr37.9%
expm1-def53.6%
expm1-log1p99.8%
fma-neg99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* 0.5 x) y)))
(if (<= t 1.0)
(* t_1 (sqrt (* z 2.0)))
(if (or (<= t 9.5e+154) (not (<= t 9.5e+290)))
(* (* t (* t_1 (sqrt 2.0))) (sqrt z))
(* 0.5 (* x (sqrt (* z (* 2.0 (pow t 2.0))))))))))
double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double tmp;
if (t <= 1.0) {
tmp = t_1 * sqrt((z * 2.0));
} else if ((t <= 9.5e+154) || !(t <= 9.5e+290)) {
tmp = (t * (t_1 * sqrt(2.0))) * sqrt(z);
} else {
tmp = 0.5 * (x * sqrt((z * (2.0 * 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 = (0.5d0 * x) - y
if (t <= 1.0d0) then
tmp = t_1 * sqrt((z * 2.0d0))
else if ((t <= 9.5d+154) .or. (.not. (t <= 9.5d+290))) then
tmp = (t * (t_1 * sqrt(2.0d0))) * sqrt(z)
else
tmp = 0.5d0 * (x * sqrt((z * (2.0d0 * (t ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double tmp;
if (t <= 1.0) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else if ((t <= 9.5e+154) || !(t <= 9.5e+290)) {
tmp = (t * (t_1 * Math.sqrt(2.0))) * Math.sqrt(z);
} else {
tmp = 0.5 * (x * Math.sqrt((z * (2.0 * Math.pow(t, 2.0)))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (0.5 * x) - y tmp = 0 if t <= 1.0: tmp = t_1 * math.sqrt((z * 2.0)) elif (t <= 9.5e+154) or not (t <= 9.5e+290): tmp = (t * (t_1 * math.sqrt(2.0))) * math.sqrt(z) else: tmp = 0.5 * (x * math.sqrt((z * (2.0 * math.pow(t, 2.0))))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(0.5 * x) - y) tmp = 0.0 if (t <= 1.0) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); elseif ((t <= 9.5e+154) || !(t <= 9.5e+290)) tmp = Float64(Float64(t * Float64(t_1 * sqrt(2.0))) * sqrt(z)); else tmp = Float64(0.5 * Float64(x * sqrt(Float64(z * Float64(2.0 * (t ^ 2.0)))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (0.5 * x) - y; tmp = 0.0; if (t <= 1.0) tmp = t_1 * sqrt((z * 2.0)); elseif ((t <= 9.5e+154) || ~((t <= 9.5e+290))) tmp = (t * (t_1 * sqrt(2.0))) * sqrt(z); else tmp = 0.5 * (x * sqrt((z * (2.0 * (t ^ 2.0))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 1.0], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 9.5e+154], N[Not[LessEqual[t, 9.5e+290]], $MachinePrecision]], N[(N[(t * N[(t$95$1 * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[Sqrt[N[(z * N[(2.0 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot x - y\\
\mathbf{if}\;t \leq 1:\\
\;\;\;\;t_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+154} \lor \neg \left(t \leq 9.5 \cdot 10^{+290}\right):\\
\;\;\;\;\left(t \cdot \left(t_1 \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \sqrt{z \cdot \left(2 \cdot {t}^{2}\right)}\right)\\
\end{array}
\end{array}
if t < 1Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 73.5%
if 1 < t < 9.5000000000000001e154 or 9.4999999999999995e290 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
exp-sqrt100.0%
associate-*r*100.0%
*-commutative100.0%
expm1-log1p-u50.0%
expm1-udef50.0%
Applied egg-rr50.0%
expm1-def50.0%
expm1-log1p100.0%
fma-neg100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 66.9%
associate-*r*66.9%
distribute-rgt-out66.9%
Simplified66.9%
Taylor expanded in t around inf 55.0%
if 9.5000000000000001e154 < t < 9.4999999999999995e290Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
exp-sqrt100.0%
associate-*r*100.0%
*-commutative100.0%
expm1-log1p-u44.4%
expm1-udef44.4%
Applied egg-rr44.4%
expm1-def44.4%
expm1-log1p100.0%
fma-neg100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in x around inf 81.5%
Taylor expanded in t around inf 81.5%
associate-*r*81.5%
*-commutative81.5%
Simplified81.5%
Final simplification71.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* 0.5 x) y)))
(if (<= t 1.0)
(* t_1 (sqrt (* z 2.0)))
(if (<= t 1.85e+160)
(* (* t (* t_1 (sqrt 2.0))) (sqrt z))
(* y (- (sqrt (* z (+ 2.0 (* 2.0 (pow t 2.0)))))))))))
double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double tmp;
if (t <= 1.0) {
tmp = t_1 * sqrt((z * 2.0));
} else if (t <= 1.85e+160) {
tmp = (t * (t_1 * sqrt(2.0))) * sqrt(z);
} else {
tmp = y * -sqrt((z * (2.0 + (2.0 * 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 = (0.5d0 * x) - y
if (t <= 1.0d0) then
tmp = t_1 * sqrt((z * 2.0d0))
else if (t <= 1.85d+160) then
tmp = (t * (t_1 * sqrt(2.0d0))) * sqrt(z)
else
tmp = y * -sqrt((z * (2.0d0 + (2.0d0 * (t ** 2.0d0)))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (0.5 * x) - y;
double tmp;
if (t <= 1.0) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else if (t <= 1.85e+160) {
tmp = (t * (t_1 * Math.sqrt(2.0))) * Math.sqrt(z);
} else {
tmp = y * -Math.sqrt((z * (2.0 + (2.0 * Math.pow(t, 2.0)))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (0.5 * x) - y tmp = 0 if t <= 1.0: tmp = t_1 * math.sqrt((z * 2.0)) elif t <= 1.85e+160: tmp = (t * (t_1 * math.sqrt(2.0))) * math.sqrt(z) else: tmp = y * -math.sqrt((z * (2.0 + (2.0 * math.pow(t, 2.0))))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(0.5 * x) - y) tmp = 0.0 if (t <= 1.0) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); elseif (t <= 1.85e+160) tmp = Float64(Float64(t * Float64(t_1 * sqrt(2.0))) * sqrt(z)); else tmp = Float64(y * Float64(-sqrt(Float64(z * Float64(2.0 + Float64(2.0 * (t ^ 2.0))))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (0.5 * x) - y; tmp = 0.0; if (t <= 1.0) tmp = t_1 * sqrt((z * 2.0)); elseif (t <= 1.85e+160) tmp = (t * (t_1 * sqrt(2.0))) * sqrt(z); else tmp = y * -sqrt((z * (2.0 + (2.0 * (t ^ 2.0))))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 1.0], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.85e+160], N[(N[(t * N[(t$95$1 * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision], N[(y * (-N[Sqrt[N[(z * N[(2.0 + N[(2.0 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.5 \cdot x - y\\
\mathbf{if}\;t \leq 1:\\
\;\;\;\;t_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{elif}\;t \leq 1.85 \cdot 10^{+160}:\\
\;\;\;\;\left(t \cdot \left(t_1 \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-\sqrt{z \cdot \left(2 + 2 \cdot {t}^{2}\right)}\right)\\
\end{array}
\end{array}
if t < 1Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 73.5%
if 1 < t < 1.85000000000000008e160Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
exp-sqrt100.0%
associate-*r*100.0%
*-commutative100.0%
expm1-log1p-u47.4%
expm1-udef47.4%
Applied egg-rr47.4%
expm1-def47.4%
expm1-log1p100.0%
fma-neg100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 65.1%
associate-*r*65.1%
distribute-rgt-out65.1%
Simplified65.1%
Taylor expanded in t around inf 50.0%
if 1.85000000000000008e160 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
exp-sqrt100.0%
associate-*r*100.0%
*-commutative100.0%
expm1-log1p-u48.3%
expm1-udef48.3%
Applied egg-rr48.3%
expm1-def48.3%
expm1-log1p100.0%
fma-neg100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in x around 0 93.1%
Final simplification72.2%
(FPCore (x y z t)
:precision binary64
(if (<= t 9.2e+58)
(* (- (* 0.5 x) y) (sqrt (* z 2.0)))
(if (<= t 2e+292)
(* 0.5 (* x (sqrt (* z (* 2.0 (pow t 2.0))))))
(* (* (sqrt 2.0) (* y t)) (- (sqrt z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 9.2e+58) {
tmp = ((0.5 * x) - y) * sqrt((z * 2.0));
} else if (t <= 2e+292) {
tmp = 0.5 * (x * sqrt((z * (2.0 * pow(t, 2.0)))));
} else {
tmp = (sqrt(2.0) * (y * t)) * -sqrt(z);
}
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 <= 9.2d+58) then
tmp = ((0.5d0 * x) - y) * sqrt((z * 2.0d0))
else if (t <= 2d+292) then
tmp = 0.5d0 * (x * sqrt((z * (2.0d0 * (t ** 2.0d0)))))
else
tmp = (sqrt(2.0d0) * (y * t)) * -sqrt(z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 9.2e+58) {
tmp = ((0.5 * x) - y) * Math.sqrt((z * 2.0));
} else if (t <= 2e+292) {
tmp = 0.5 * (x * Math.sqrt((z * (2.0 * Math.pow(t, 2.0)))));
} else {
tmp = (Math.sqrt(2.0) * (y * t)) * -Math.sqrt(z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 9.2e+58: tmp = ((0.5 * x) - y) * math.sqrt((z * 2.0)) elif t <= 2e+292: tmp = 0.5 * (x * math.sqrt((z * (2.0 * math.pow(t, 2.0))))) else: tmp = (math.sqrt(2.0) * (y * t)) * -math.sqrt(z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 9.2e+58) tmp = Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * 2.0))); elseif (t <= 2e+292) tmp = Float64(0.5 * Float64(x * sqrt(Float64(z * Float64(2.0 * (t ^ 2.0)))))); else tmp = Float64(Float64(sqrt(2.0) * Float64(y * t)) * Float64(-sqrt(z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 9.2e+58) tmp = ((0.5 * x) - y) * sqrt((z * 2.0)); elseif (t <= 2e+292) tmp = 0.5 * (x * sqrt((z * (2.0 * (t ^ 2.0))))); else tmp = (sqrt(2.0) * (y * t)) * -sqrt(z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 9.2e+58], N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2e+292], N[(0.5 * N[(x * N[Sqrt[N[(z * N[(2.0 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[z], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 9.2 \cdot 10^{+58}:\\
\;\;\;\;\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+292}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \sqrt{z \cdot \left(2 \cdot {t}^{2}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{2} \cdot \left(y \cdot t\right)\right) \cdot \left(-\sqrt{z}\right)\\
\end{array}
\end{array}
if t < 9.2000000000000001e58Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 71.0%
if 9.2000000000000001e58 < t < 2e292Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
exp-sqrt100.0%
associate-*r*100.0%
*-commutative100.0%
expm1-log1p-u50.0%
expm1-udef50.0%
Applied egg-rr50.0%
expm1-def50.0%
expm1-log1p100.0%
fma-neg100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 88.1%
associate-*r*88.1%
distribute-rgt-out88.1%
Simplified88.1%
Taylor expanded in x around inf 69.3%
Taylor expanded in t around inf 69.3%
associate-*r*69.3%
*-commutative69.3%
Simplified69.3%
if 2e292 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
exp-sqrt100.0%
associate-*r*100.0%
*-commutative100.0%
expm1-log1p-u83.3%
expm1-udef83.3%
Applied egg-rr83.3%
expm1-def83.3%
expm1-log1p100.0%
fma-neg100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 100.0%
associate-*r*100.0%
distribute-rgt-out100.0%
Simplified100.0%
Taylor expanded in t around inf 68.7%
associate-*l*37.8%
*-commutative37.8%
associate-*r*37.8%
*-commutative37.8%
Simplified37.8%
Taylor expanded in x around 0 68.5%
mul-1-neg68.5%
*-commutative68.5%
associate-*r*68.5%
Simplified68.5%
Final simplification70.6%
(FPCore (x y z t) :precision binary64 (* (exp (/ (* t t) 2.0)) (* (- (* 0.5 x) y) (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
return exp(((t * t) / 2.0)) * (((0.5 * x) - 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 = exp(((t * t) / 2.0d0)) * (((0.5d0 * x) - y) * sqrt((z * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return Math.exp(((t * t) / 2.0)) * (((0.5 * x) - y) * Math.sqrt((z * 2.0)));
}
def code(x, y, z, t): return math.exp(((t * t) / 2.0)) * (((0.5 * x) - y) * math.sqrt((z * 2.0)))
function code(x, y, z, t) return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = exp(((t * t) / 2.0)) * (((0.5 * x) - y) * sqrt((z * 2.0))); end
code[x_, y_, z_, t_] := N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\frac{t \cdot t}{2}} \cdot \left(\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (- (* 0.5 x) y) (sqrt (* z (+ 2.0 (* 2.0 (pow t 2.0)))))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * sqrt((z * (2.0 + (2.0 * 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 = ((0.5d0 * x) - y) * sqrt((z * (2.0d0 + (2.0d0 * (t ** 2.0d0)))))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt((z * (2.0 + (2.0 * Math.pow(t, 2.0)))));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt((z * (2.0 + (2.0 * math.pow(t, 2.0)))))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * Float64(2.0 + Float64(2.0 * (t ^ 2.0)))))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt((z * (2.0 + (2.0 * (t ^ 2.0))))); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * N[(2.0 + N[(2.0 * N[Power[t, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot \left(2 + 2 \cdot {t}^{2}\right)}
\end{array}
Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
exp-sqrt99.8%
associate-*r*99.8%
*-commutative99.8%
expm1-log1p-u53.6%
expm1-udef37.9%
Applied egg-rr37.9%
expm1-def53.6%
expm1-log1p99.8%
fma-neg99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 87.9%
associate-*r*87.9%
distribute-rgt-out87.9%
Simplified87.9%
Final simplification87.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (- (* 0.5 x) y) (sqrt (* z 2.0))))) (if (<= t 1.0) t_1 (* t t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((0.5 * x) - y) * sqrt((z * 2.0));
double tmp;
if (t <= 1.0) {
tmp = t_1;
} else {
tmp = t * 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 = ((0.5d0 * x) - y) * sqrt((z * 2.0d0))
if (t <= 1.0d0) then
tmp = t_1
else
tmp = t * t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((0.5 * x) - y) * Math.sqrt((z * 2.0));
double tmp;
if (t <= 1.0) {
tmp = t_1;
} else {
tmp = t * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((0.5 * x) - y) * math.sqrt((z * 2.0)) tmp = 0 if t <= 1.0: tmp = t_1 else: tmp = t * t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * 2.0))) tmp = 0.0 if (t <= 1.0) tmp = t_1; else tmp = Float64(t * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((0.5 * x) - y) * sqrt((z * 2.0)); tmp = 0.0; if (t <= 1.0) tmp = t_1; else tmp = t * t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, 1.0], t$95$1, N[(t * t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 1:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t \cdot t_1\\
\end{array}
\end{array}
if t < 1Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 73.5%
if 1 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
exp-sqrt100.0%
associate-*r*100.0%
*-commutative100.0%
expm1-log1p-u47.8%
expm1-udef47.8%
Applied egg-rr47.8%
expm1-def47.8%
expm1-log1p100.0%
fma-neg100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 80.2%
associate-*r*80.2%
distribute-rgt-out80.2%
Simplified80.2%
Taylor expanded in t around inf 61.8%
associate-*l*52.2%
*-commutative52.2%
associate-*r*52.2%
*-commutative52.2%
Simplified52.2%
*-commutative11.8%
sqrt-prod11.8%
Applied egg-rr52.2%
Final simplification67.9%
(FPCore (x y z t) :precision binary64 (* (- (* 0.5 x) y) (sqrt (* z 2.0))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - 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 = ((0.5d0 * x) - y) * sqrt((z * 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt((z * 2.0));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt((z * 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(z * 2.0))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt((z * 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot x - y\right) \cdot \sqrt{z \cdot 2}
\end{array}
Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 60.6%
Final simplification60.6%
(FPCore (x y z t) :precision binary64 (* 0.5 (* x (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
return 0.5 * (x * 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 = 0.5d0 * (x * sqrt((z * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return 0.5 * (x * Math.sqrt((z * 2.0)));
}
def code(x, y, z, t): return 0.5 * (x * math.sqrt((z * 2.0)))
function code(x, y, z, t) return Float64(0.5 * Float64(x * sqrt(Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = 0.5 * (x * sqrt((z * 2.0))); end
code[x_, y_, z_, t_] := N[(0.5 * N[(x * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(x \cdot \sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 60.6%
Taylor expanded in x around inf 32.7%
associate-*l*32.8%
Simplified32.8%
*-commutative32.8%
sqrt-prod32.9%
Applied egg-rr32.9%
Final simplification32.9%
(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 2024020
(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))))