
(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 11 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) (sqrt (pow (exp t) t)))))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * (((x * 0.5) - y) * sqrt(pow(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.pow(Math.exp(t), t)));
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * (((x * 0.5) - y) * math.sqrt(math.pow(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(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[Power[N[Exp[t], $MachinePrecision], t], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{{\left(e^{t}\right)}^{t}}\right)
\end{array}
Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
sqr-neg99.8%
exp-prod99.8%
Simplified99.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.8%
*-commutative99.8%
associate-*l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
sqr-neg99.8%
exp-prod99.8%
Simplified99.8%
add-cube-cbrt_binary6498.9%
Applied rewrite-once98.9%
pow298.9%
pow-plus98.9%
metadata-eval98.9%
Applied egg-rr98.9%
rem-cube-cbrt99.8%
*-commutative99.8%
associate-*r*99.8%
*-commutative99.8%
flip3--35.0%
clear-num35.0%
un-div-inv35.0%
sqrt-unprod35.0%
clear-num35.0%
flip3--99.7%
Applied egg-rr99.7%
associate-/r/99.8%
/-rgt-identity99.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)) (t_2 (sqrt (* z 2.0))) (t_3 (* t_2 y)))
(if (<= t 255000000000.0)
(/ t_1 (pow (* z 2.0) -0.5))
(if (<= t 1.16e+134)
(/ (* (* z 2.0) (* y (- y))) t_3)
(if (<= t 4e+147) (* t_2 t_1) (* t_3 (- -1.0 (* t (* 0.5 t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double t_2 = sqrt((z * 2.0));
double t_3 = t_2 * y;
double tmp;
if (t <= 255000000000.0) {
tmp = t_1 / pow((z * 2.0), -0.5);
} else if (t <= 1.16e+134) {
tmp = ((z * 2.0) * (y * -y)) / t_3;
} else if (t <= 4e+147) {
tmp = t_2 * t_1;
} else {
tmp = t_3 * (-1.0 - (t * (0.5 * 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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (x * 0.5d0) - y
t_2 = sqrt((z * 2.0d0))
t_3 = t_2 * y
if (t <= 255000000000.0d0) then
tmp = t_1 / ((z * 2.0d0) ** (-0.5d0))
else if (t <= 1.16d+134) then
tmp = ((z * 2.0d0) * (y * -y)) / t_3
else if (t <= 4d+147) then
tmp = t_2 * t_1
else
tmp = t_3 * ((-1.0d0) - (t * (0.5d0 * t)))
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 t_2 = Math.sqrt((z * 2.0));
double t_3 = t_2 * y;
double tmp;
if (t <= 255000000000.0) {
tmp = t_1 / Math.pow((z * 2.0), -0.5);
} else if (t <= 1.16e+134) {
tmp = ((z * 2.0) * (y * -y)) / t_3;
} else if (t <= 4e+147) {
tmp = t_2 * t_1;
} else {
tmp = t_3 * (-1.0 - (t * (0.5 * t)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y t_2 = math.sqrt((z * 2.0)) t_3 = t_2 * y tmp = 0 if t <= 255000000000.0: tmp = t_1 / math.pow((z * 2.0), -0.5) elif t <= 1.16e+134: tmp = ((z * 2.0) * (y * -y)) / t_3 elif t <= 4e+147: tmp = t_2 * t_1 else: tmp = t_3 * (-1.0 - (t * (0.5 * t))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) t_2 = sqrt(Float64(z * 2.0)) t_3 = Float64(t_2 * y) tmp = 0.0 if (t <= 255000000000.0) tmp = Float64(t_1 / (Float64(z * 2.0) ^ -0.5)); elseif (t <= 1.16e+134) tmp = Float64(Float64(Float64(z * 2.0) * Float64(y * Float64(-y))) / t_3); elseif (t <= 4e+147) tmp = Float64(t_2 * t_1); else tmp = Float64(t_3 * Float64(-1.0 - Float64(t * Float64(0.5 * t)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; t_2 = sqrt((z * 2.0)); t_3 = t_2 * y; tmp = 0.0; if (t <= 255000000000.0) tmp = t_1 / ((z * 2.0) ^ -0.5); elseif (t <= 1.16e+134) tmp = ((z * 2.0) * (y * -y)) / t_3; elseif (t <= 4e+147) tmp = t_2 * t_1; else tmp = t_3 * (-1.0 - (t * (0.5 * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * y), $MachinePrecision]}, If[LessEqual[t, 255000000000.0], N[(t$95$1 / N[Power[N[(z * 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.16e+134], N[(N[(N[(z * 2.0), $MachinePrecision] * N[(y * (-y)), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t, 4e+147], N[(t$95$2 * t$95$1), $MachinePrecision], N[(t$95$3 * N[(-1.0 - N[(t * N[(0.5 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{z \cdot 2}\\
t_3 := t_2 \cdot y\\
\mathbf{if}\;t \leq 255000000000:\\
\;\;\;\;\frac{t_1}{{\left(z \cdot 2\right)}^{-0.5}}\\
\mathbf{elif}\;t \leq 1.16 \cdot 10^{+134}:\\
\;\;\;\;\frac{\left(z \cdot 2\right) \cdot \left(y \cdot \left(-y\right)\right)}{t_3}\\
\mathbf{elif}\;t \leq 4 \cdot 10^{+147}:\\
\;\;\;\;t_2 \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \left(-1 - t \cdot \left(0.5 \cdot t\right)\right)\\
\end{array}
\end{array}
if t < 2.55e11Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
sqr-neg99.7%
exp-sqrt99.7%
sqr-neg99.7%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 70.9%
/-rgt-identity70.9%
*-commutative70.9%
clear-num70.8%
un-div-inv70.8%
*-commutative70.8%
pow1/270.8%
pow-flip70.9%
metadata-eval70.9%
Applied egg-rr70.9%
if 2.55e11 < t < 1.16e134Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
sqr-neg100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 4.9%
Taylor expanded in x around 0 3.1%
mul-1-neg3.1%
*-commutative3.1%
distribute-rgt-neg-out3.1%
Simplified3.1%
associate-*r*3.1%
sqrt-prod3.1%
distribute-rgt-neg-out3.1%
remove-double-div3.1%
div-inv3.1%
distribute-frac-neg3.1%
neg-sub03.1%
div-sub3.1%
div-inv3.1%
remove-double-div3.1%
*-commutative3.1%
Applied egg-rr3.1%
div03.1%
sub0-neg3.1%
distribute-lft-neg-in3.1%
*-commutative3.1%
Simplified3.1%
distribute-lft-neg-out3.1%
neg-sub03.1%
flip--20.8%
Applied egg-rr20.8%
Simplified29.9%
if 1.16e134 < t < 3.9999999999999999e147Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
sqr-neg100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 44.4%
if 3.9999999999999999e147 < t Initial program 100.0%
*-commutative100.0%
flip--84.8%
clear-num84.8%
un-div-inv84.8%
clear-num84.8%
flip--100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 78.8%
Taylor expanded in t around 0 76.0%
*-commutative76.0%
unpow276.0%
associate-*l*76.0%
Simplified76.0%
div-inv76.0%
frac-2neg76.0%
metadata-eval76.0%
remove-double-div76.0%
Applied egg-rr76.0%
Final simplification67.4%
(FPCore (x y z t) :precision binary64 (* (sqrt (* z 2.0)) (- (* 0.5 (+ x (* (- (* x 0.5) y) (* t t)))) y)))
double code(double x, double y, double z, double t) {
return sqrt((z * 2.0)) * ((0.5 * (x + (((x * 0.5) - y) * (t * t)))) - 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)) * ((0.5d0 * (x + (((x * 0.5d0) - y) * (t * t)))) - y)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((z * 2.0)) * ((0.5 * (x + (((x * 0.5) - y) * (t * t)))) - y);
}
def code(x, y, z, t): return math.sqrt((z * 2.0)) * ((0.5 * (x + (((x * 0.5) - y) * (t * t)))) - y)
function code(x, y, z, t) return Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(0.5 * Float64(x + Float64(Float64(Float64(x * 0.5) - y) * Float64(t * t)))) - y)) end
function tmp = code(x, y, z, t) tmp = sqrt((z * 2.0)) * ((0.5 * (x + (((x * 0.5) - y) * (t * t)))) - y); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * N[(x + N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{z \cdot 2} \cdot \left(0.5 \cdot \left(x + \left(x \cdot 0.5 - y\right) \cdot \left(t \cdot t\right)\right) - y\right)
\end{array}
Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
sqr-neg99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 91.0%
distribute-lft-out91.0%
*-commutative91.0%
unpow291.0%
Simplified91.0%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (* (+ 1.0 (* t (* 0.5 t))) (* (sqrt (* z 2.0)) (- (* x 0.5) y))))
double code(double x, double y, double z, double t) {
return (1.0 + (t * (0.5 * t))) * (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 = (1.0d0 + (t * (0.5d0 * t))) * (sqrt((z * 2.0d0)) * ((x * 0.5d0) - y))
end function
public static double code(double x, double y, double z, double t) {
return (1.0 + (t * (0.5 * t))) * (Math.sqrt((z * 2.0)) * ((x * 0.5) - y));
}
def code(x, y, z, t): return (1.0 + (t * (0.5 * t))) * (math.sqrt((z * 2.0)) * ((x * 0.5) - y))
function code(x, y, z, t) return Float64(Float64(1.0 + Float64(t * Float64(0.5 * t))) * Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y))) end
function tmp = code(x, y, z, t) tmp = (1.0 + (t * (0.5 * t))) * (sqrt((z * 2.0)) * ((x * 0.5) - y)); end
code[x_, y_, z_, t_] := N[(N[(1.0 + N[(t * N[(0.5 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + t \cdot \left(0.5 \cdot t\right)\right) \cdot \left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 88.5%
*-commutative52.5%
unpow252.5%
associate-*l*52.5%
Simplified88.5%
Final simplification88.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= t 1.7e+25) (and (not (<= t 1.7e+122)) (<= t 2.25e+171)))
(* t_1 (- (* x 0.5) y))
(/ t_1 (/ y (* y (- y)))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t <= 1.7e+25) || (!(t <= 1.7e+122) && (t <= 2.25e+171))) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 / (y / (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) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if ((t <= 1.7d+25) .or. (.not. (t <= 1.7d+122)) .and. (t <= 2.25d+171)) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = t_1 / (y / (y * -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 <= 1.7e+25) || (!(t <= 1.7e+122) && (t <= 2.25e+171))) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 / (y / (y * -y));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t <= 1.7e+25) or (not (t <= 1.7e+122) and (t <= 2.25e+171)): tmp = t_1 * ((x * 0.5) - y) else: tmp = t_1 / (y / (y * -y)) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if ((t <= 1.7e+25) || (!(t <= 1.7e+122) && (t <= 2.25e+171))) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(t_1 / Float64(y / Float64(y * 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 <= 1.7e+25) || (~((t <= 1.7e+122)) && (t <= 2.25e+171))) tmp = t_1 * ((x * 0.5) - y); else tmp = t_1 / (y / (y * -y)); 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[t, 1.7e+25], And[N[Not[LessEqual[t, 1.7e+122]], $MachinePrecision], LessEqual[t, 2.25e+171]]], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(y / N[(y * (-y)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 1.7 \cdot 10^{+25} \lor \neg \left(t \leq 1.7 \cdot 10^{+122}\right) \land t \leq 2.25 \cdot 10^{+171}:\\
\;\;\;\;t_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{\frac{y}{y \cdot \left(-y\right)}}\\
\end{array}
\end{array}
if t < 1.69999999999999992e25 or 1.7e122 < t < 2.24999999999999984e171Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
sqr-neg99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 68.3%
if 1.69999999999999992e25 < t < 1.7e122 or 2.24999999999999984e171 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
sqr-neg100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 14.4%
Taylor expanded in x around 0 5.3%
mul-1-neg5.3%
*-commutative5.3%
distribute-rgt-neg-out5.3%
Simplified5.3%
associate-*r*5.3%
sqrt-prod5.3%
remove-double-div5.3%
metadata-eval5.3%
frac-2neg5.3%
div-inv5.3%
frac-2neg5.3%
metadata-eval5.3%
associate-/r/5.3%
neg-sub05.3%
flip--28.3%
frac-times28.3%
metadata-eval28.3%
sub0-neg28.3%
+-lft-identity28.3%
remove-double-div28.3%
div-inv28.3%
remove-double-div28.3%
Applied egg-rr28.3%
associate-/l*28.3%
*-commutative28.3%
distribute-rgt-neg-in28.3%
Simplified28.3%
Final simplification60.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= t 9e+25) (and (not (<= t 5e+122)) (<= t 1.55e+158)))
(* t_1 (- (* x 0.5) y))
(/ (* t_1 (* y (- y))) y))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((t <= 9e+25) || (!(t <= 5e+122) && (t <= 1.55e+158))) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = (t_1 * (y * -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) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if ((t <= 9d+25) .or. (.not. (t <= 5d+122)) .and. (t <= 1.55d+158)) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = (t_1 * (y * -y)) / 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 <= 9e+25) || (!(t <= 5e+122) && (t <= 1.55e+158))) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = (t_1 * (y * -y)) / y;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (t <= 9e+25) or (not (t <= 5e+122) and (t <= 1.55e+158)): tmp = t_1 * ((x * 0.5) - y) else: tmp = (t_1 * (y * -y)) / y return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if ((t <= 9e+25) || (!(t <= 5e+122) && (t <= 1.55e+158))) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(Float64(t_1 * Float64(y * Float64(-y))) / y); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((t <= 9e+25) || (~((t <= 5e+122)) && (t <= 1.55e+158))) tmp = t_1 * ((x * 0.5) - y); else tmp = (t_1 * (y * -y)) / y; 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[t, 9e+25], And[N[Not[LessEqual[t, 5e+122]], $MachinePrecision], LessEqual[t, 1.55e+158]]], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * N[(y * (-y)), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 9 \cdot 10^{+25} \lor \neg \left(t \leq 5 \cdot 10^{+122}\right) \land t \leq 1.55 \cdot 10^{+158}:\\
\;\;\;\;t_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1 \cdot \left(y \cdot \left(-y\right)\right)}{y}\\
\end{array}
\end{array}
if t < 9.0000000000000006e25 or 4.99999999999999989e122 < t < 1.5500000000000001e158Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
sqr-neg99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 68.7%
if 9.0000000000000006e25 < t < 4.99999999999999989e122 or 1.5500000000000001e158 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
sqr-neg100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 14.2%
Taylor expanded in x around 0 5.2%
mul-1-neg5.2%
*-commutative5.2%
distribute-rgt-neg-out5.2%
Simplified5.2%
associate-*r*5.2%
sqrt-prod5.2%
remove-double-div5.2%
metadata-eval5.2%
frac-2neg5.2%
div-inv5.2%
frac-2neg5.2%
metadata-eval5.2%
associate-/r/5.2%
neg-sub05.2%
flip--27.7%
frac-times27.7%
metadata-eval27.7%
sub0-neg27.7%
+-lft-identity27.7%
remove-double-div27.7%
div-inv27.7%
remove-double-div27.7%
Applied egg-rr27.7%
Final simplification60.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* z 2.0))))
(if (<= t 2.6e+24)
(/ t_1 (pow (* z 2.0) -0.5))
(if (or (<= t 4.8e+122) (not (<= t 1.12e+163)))
(/ (* t_2 (* y (- y))) y)
(* t_2 t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double t_2 = sqrt((z * 2.0));
double tmp;
if (t <= 2.6e+24) {
tmp = t_1 / pow((z * 2.0), -0.5);
} else if ((t <= 4.8e+122) || !(t <= 1.12e+163)) {
tmp = (t_2 * (y * -y)) / y;
} else {
tmp = t_2 * t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 0.5d0) - y
t_2 = sqrt((z * 2.0d0))
if (t <= 2.6d+24) then
tmp = t_1 / ((z * 2.0d0) ** (-0.5d0))
else if ((t <= 4.8d+122) .or. (.not. (t <= 1.12d+163))) then
tmp = (t_2 * (y * -y)) / y
else
tmp = t_2 * t_1
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 t_2 = Math.sqrt((z * 2.0));
double tmp;
if (t <= 2.6e+24) {
tmp = t_1 / Math.pow((z * 2.0), -0.5);
} else if ((t <= 4.8e+122) || !(t <= 1.12e+163)) {
tmp = (t_2 * (y * -y)) / y;
} else {
tmp = t_2 * t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y t_2 = math.sqrt((z * 2.0)) tmp = 0 if t <= 2.6e+24: tmp = t_1 / math.pow((z * 2.0), -0.5) elif (t <= 4.8e+122) or not (t <= 1.12e+163): tmp = (t_2 * (y * -y)) / y else: tmp = t_2 * t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) t_2 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 2.6e+24) tmp = Float64(t_1 / (Float64(z * 2.0) ^ -0.5)); elseif ((t <= 4.8e+122) || !(t <= 1.12e+163)) tmp = Float64(Float64(t_2 * Float64(y * Float64(-y))) / y); else tmp = Float64(t_2 * t_1); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; t_2 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 2.6e+24) tmp = t_1 / ((z * 2.0) ^ -0.5); elseif ((t <= 4.8e+122) || ~((t <= 1.12e+163))) tmp = (t_2 * (y * -y)) / y; else tmp = t_2 * t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t, 2.6e+24], N[(t$95$1 / N[Power[N[(z * 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 4.8e+122], N[Not[LessEqual[t, 1.12e+163]], $MachinePrecision]], N[(N[(t$95$2 * N[(y * (-y)), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], N[(t$95$2 * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 2.6 \cdot 10^{+24}:\\
\;\;\;\;\frac{t_1}{{\left(z \cdot 2\right)}^{-0.5}}\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{+122} \lor \neg \left(t \leq 1.12 \cdot 10^{+163}\right):\\
\;\;\;\;\frac{t_2 \cdot \left(y \cdot \left(-y\right)\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot t_1\\
\end{array}
\end{array}
if t < 2.5999999999999998e24Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
sqr-neg99.7%
exp-sqrt99.7%
sqr-neg99.7%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 70.2%
/-rgt-identity70.2%
*-commutative70.2%
clear-num70.1%
un-div-inv70.1%
*-commutative70.1%
pow1/270.1%
pow-flip70.2%
metadata-eval70.2%
Applied egg-rr70.2%
if 2.5999999999999998e24 < t < 4.8000000000000004e122 or 1.11999999999999996e163 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
sqr-neg100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 14.2%
Taylor expanded in x around 0 5.2%
mul-1-neg5.2%
*-commutative5.2%
distribute-rgt-neg-out5.2%
Simplified5.2%
associate-*r*5.2%
sqrt-prod5.2%
remove-double-div5.2%
metadata-eval5.2%
frac-2neg5.2%
div-inv5.2%
frac-2neg5.2%
metadata-eval5.2%
associate-/r/5.2%
neg-sub05.2%
flip--27.7%
frac-times27.7%
metadata-eval27.7%
sub0-neg27.7%
+-lft-identity27.7%
remove-double-div27.7%
div-inv27.7%
remove-double-div27.7%
Applied egg-rr27.7%
if 4.8000000000000004e122 < t < 1.11999999999999996e163Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
sqr-neg100.0%
exp-sqrt100.0%
sqr-neg100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 35.1%
Final simplification60.7%
(FPCore (x y z t) :precision binary64 (if (<= t 8.8e+60) (/ (- (* x 0.5) y) (pow (* z 2.0) -0.5)) (* (* (sqrt (* z 2.0)) y) (- -1.0 (* t (* 0.5 t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8.8e+60) {
tmp = ((x * 0.5) - y) / pow((z * 2.0), -0.5);
} else {
tmp = (sqrt((z * 2.0)) * y) * (-1.0 - (t * (0.5 * 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) :: tmp
if (t <= 8.8d+60) then
tmp = ((x * 0.5d0) - y) / ((z * 2.0d0) ** (-0.5d0))
else
tmp = (sqrt((z * 2.0d0)) * y) * ((-1.0d0) - (t * (0.5d0 * t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8.8e+60) {
tmp = ((x * 0.5) - y) / Math.pow((z * 2.0), -0.5);
} else {
tmp = (Math.sqrt((z * 2.0)) * y) * (-1.0 - (t * (0.5 * t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 8.8e+60: tmp = ((x * 0.5) - y) / math.pow((z * 2.0), -0.5) else: tmp = (math.sqrt((z * 2.0)) * y) * (-1.0 - (t * (0.5 * t))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 8.8e+60) tmp = Float64(Float64(Float64(x * 0.5) - y) / (Float64(z * 2.0) ^ -0.5)); else tmp = Float64(Float64(sqrt(Float64(z * 2.0)) * y) * Float64(-1.0 - Float64(t * Float64(0.5 * t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 8.8e+60) tmp = ((x * 0.5) - y) / ((z * 2.0) ^ -0.5); else tmp = (sqrt((z * 2.0)) * y) * (-1.0 - (t * (0.5 * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 8.8e+60], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] / N[Power[N[(z * 2.0), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision] * N[(-1.0 - N[(t * N[(0.5 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8.8 \cdot 10^{+60}:\\
\;\;\;\;\frac{x \cdot 0.5 - y}{{\left(z \cdot 2\right)}^{-0.5}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{z \cdot 2} \cdot y\right) \cdot \left(-1 - t \cdot \left(0.5 \cdot t\right)\right)\\
\end{array}
\end{array}
if t < 8.79999999999999984e60Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
sqr-neg99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 68.3%
/-rgt-identity68.3%
*-commutative68.3%
clear-num68.2%
un-div-inv68.2%
*-commutative68.2%
pow1/268.2%
pow-flip68.3%
metadata-eval68.3%
Applied egg-rr68.3%
if 8.79999999999999984e60 < t Initial program 100.0%
*-commutative100.0%
flip--88.7%
clear-num88.7%
un-div-inv88.7%
clear-num88.7%
flip--100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 67.9%
Taylor expanded in t around 0 55.6%
*-commutative55.6%
unpow255.6%
associate-*l*55.6%
Simplified55.6%
div-inv55.6%
frac-2neg55.6%
metadata-eval55.6%
remove-double-div55.6%
Applied egg-rr55.6%
Final simplification65.7%
(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.8%
*-commutative99.8%
associate-*l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
sqr-neg99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 58.0%
Final simplification58.0%
(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.8%
*-commutative99.8%
associate-*l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
sqr-neg99.8%
exp-prod99.8%
Simplified99.8%
Taylor expanded in t around 0 57.5%
Taylor expanded in x around 0 28.1%
mul-1-neg28.1%
*-commutative28.1%
distribute-rgt-neg-out28.1%
Simplified28.1%
associate-*r*28.5%
sqrt-prod28.6%
distribute-rgt-neg-out28.6%
remove-double-div28.5%
div-inv28.5%
distribute-frac-neg28.5%
neg-sub028.5%
div-sub28.5%
div-inv28.5%
remove-double-div28.6%
*-commutative28.6%
Applied egg-rr28.6%
div028.6%
sub0-neg28.6%
distribute-lft-neg-in28.6%
*-commutative28.6%
Simplified28.6%
Final simplification28.6%
(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 2023297
(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))))