
(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 (let* ((t_1 (sqrt (* z 2.0)))) (* (- (* (* x 0.5) t_1) (* t_1 y)) (exp (/ (* t t) 2.0)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
return (((x * 0.5) * t_1) - (t_1 * y)) * 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
real(8) :: t_1
t_1 = sqrt((z * 2.0d0))
code = (((x * 0.5d0) * t_1) - (t_1 * y)) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((z * 2.0));
return (((x * 0.5) * t_1) - (t_1 * y)) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) return (((x * 0.5) * t_1) - (t_1 * y)) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) return Float64(Float64(Float64(Float64(x * 0.5) * t_1) - Float64(t_1 * y)) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = (((x * 0.5) * t_1) - (t_1 * y)) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(N[(N[(x * 0.5), $MachinePrecision] * t$95$1), $MachinePrecision] - N[(t$95$1 * y), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\left(\left(x \cdot 0.5\right) \cdot t\_1 - t\_1 \cdot y\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
\end{array}
Initial program 99.8%
*-commutative99.8%
sub-neg99.8%
distribute-rgt-in99.8%
Applied egg-rr99.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 4.2e+19)
(* t_1 t_2)
(if (<= t 8e+210)
(sqrt (* (* z 2.0) (pow t_2 2.0)))
(* t_1 (* x (- 0.5 (/ y x))))))))
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 <= 4.2e+19) {
tmp = t_1 * t_2;
} else if (t <= 8e+210) {
tmp = sqrt(((z * 2.0) * pow(t_2, 2.0)));
} else {
tmp = t_1 * (x * (0.5 - (y / x)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
t_2 = (x * 0.5d0) - y
if (t <= 4.2d+19) then
tmp = t_1 * t_2
else if (t <= 8d+210) then
tmp = sqrt(((z * 2.0d0) * (t_2 ** 2.0d0)))
else
tmp = t_1 * (x * (0.5d0 - (y / x)))
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 <= 4.2e+19) {
tmp = t_1 * t_2;
} else if (t <= 8e+210) {
tmp = Math.sqrt(((z * 2.0) * Math.pow(t_2, 2.0)));
} else {
tmp = t_1 * (x * (0.5 - (y / x)));
}
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 <= 4.2e+19: tmp = t_1 * t_2 elif t <= 8e+210: tmp = math.sqrt(((z * 2.0) * math.pow(t_2, 2.0))) else: tmp = t_1 * (x * (0.5 - (y / x))) 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 (t <= 4.2e+19) tmp = Float64(t_1 * t_2); elseif (t <= 8e+210) tmp = sqrt(Float64(Float64(z * 2.0) * (t_2 ^ 2.0))); else tmp = Float64(t_1 * Float64(x * Float64(0.5 - Float64(y / x)))); 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 <= 4.2e+19) tmp = t_1 * t_2; elseif (t <= 8e+210) tmp = sqrt(((z * 2.0) * (t_2 ^ 2.0))); else tmp = t_1 * (x * (0.5 - (y / x))); 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[t, 4.2e+19], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t, 8e+210], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$1 * N[(x * N[(0.5 - N[(y / x), $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 \leq 4.2 \cdot 10^{+19}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t \leq 8 \cdot 10^{+210}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot {t\_2}^{2}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)\\
\end{array}
\end{array}
if t < 4.2e19Initial program 99.7%
Taylor expanded in t around 0 69.9%
*-rgt-identity69.9%
*-commutative69.9%
sub-neg69.9%
sub-neg69.9%
add-sqr-sqrt38.8%
sqrt-unprod55.0%
sqr-neg55.0%
sqrt-unprod19.4%
add-sqr-sqrt42.0%
distribute-rgt-out--42.0%
*-commutative42.0%
cancel-sign-sub-inv42.0%
associate-*l*42.0%
add-sqr-sqrt19.4%
sqrt-unprod55.0%
sqr-neg55.0%
sqrt-unprod38.8%
add-sqr-sqrt70.0%
Applied egg-rr70.0%
fma-define70.0%
distribute-lft-neg-out70.0%
add-sqr-sqrt70.0%
sqr-neg70.0%
sqrt-unprod0.0%
add-sqr-sqrt42.0%
fma-neg42.0%
*-commutative42.0%
add-sqr-sqrt0.0%
sqrt-unprod70.0%
sqr-neg70.0%
add-sqr-sqrt70.0%
Applied egg-rr70.0%
associate-*r*70.0%
*-commutative70.0%
distribute-rgt-out--69.9%
Simplified69.9%
if 4.2e19 < t < 7.99999999999999942e210Initial program 100.0%
Taylor expanded in t around 0 15.1%
add-sqr-sqrt5.5%
sqrt-unprod34.4%
*-commutative34.4%
*-commutative34.4%
swap-sqr42.4%
add-sqr-sqrt42.4%
pow242.4%
Applied egg-rr42.4%
if 7.99999999999999942e210 < t Initial program 100.0%
Taylor expanded in t around 0 16.3%
Taylor expanded in x around inf 28.1%
mul-1-neg28.1%
unsub-neg28.1%
Simplified28.1%
Final simplification60.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= t 3e-13)
(- (* x (* 0.5 t_1)) (* t_1 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 <= 3e-13) {
tmp = (x * (0.5 * t_1)) - (t_1 * 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 <= 3d-13) then
tmp = (x * (0.5d0 * t_1)) - (t_1 * 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 <= 3e-13) {
tmp = (x * (0.5 * t_1)) - (t_1 * 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 <= 3e-13: tmp = (x * (0.5 * t_1)) - (t_1 * 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 (t <= 3e-13) tmp = Float64(Float64(x * Float64(0.5 * t_1)) - Float64(t_1 * 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 <= 3e-13) tmp = (x * (0.5 * t_1)) - (t_1 * 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[t, 3e-13], N[(N[(x * N[(0.5 * t$95$1), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * 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 \leq 3 \cdot 10^{-13}:\\
\;\;\;\;x \cdot \left(0.5 \cdot t\_1\right) - t\_1 \cdot y\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(t\_1 \cdot \left(-y\right)\right)\\
\end{array}
\end{array}
if t < 2.99999999999999984e-13Initial program 99.7%
Taylor expanded in t around 0 70.9%
*-rgt-identity70.9%
*-commutative70.9%
sub-neg70.9%
sub-neg70.9%
add-sqr-sqrt39.1%
sqrt-unprod55.7%
sqr-neg55.7%
sqrt-unprod19.8%
add-sqr-sqrt42.9%
distribute-rgt-out--42.9%
*-commutative42.9%
cancel-sign-sub-inv42.9%
associate-*l*42.9%
add-sqr-sqrt19.8%
sqrt-unprod55.7%
sqr-neg55.7%
sqrt-unprod39.1%
add-sqr-sqrt70.9%
Applied egg-rr70.9%
if 2.99999999999999984e-13 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 98.6%
associate-*r*98.6%
associate-*r*98.6%
distribute-rgt-out100.0%
mul-1-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 65.3%
mul-1-neg65.3%
rem-square-sqrt27.8%
fabs-sqr27.8%
rem-square-sqrt41.7%
rem-sqrt-square34.7%
associate-*l*34.7%
*-commutative34.7%
associate-*l*34.7%
*-commutative34.7%
swap-sqr31.9%
swap-sqr31.9%
rem-square-sqrt31.9%
rem-square-sqrt31.9%
rem-square-sqrt31.9%
swap-sqr34.7%
Simplified65.3%
Final simplification69.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= t 3e-13)
(* 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 <= 3e-13) {
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 <= 3d-13) 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 <= 3e-13) {
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 <= 3e-13: 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 (t <= 3e-13) 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 <= 3e-13) 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[t, 3e-13], 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 \leq 3 \cdot 10^{-13}:\\
\;\;\;\;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 t < 2.99999999999999984e-13Initial program 99.7%
Taylor expanded in t around 0 70.9%
*-rgt-identity70.9%
*-commutative70.9%
sub-neg70.9%
sub-neg70.9%
add-sqr-sqrt39.1%
sqrt-unprod55.7%
sqr-neg55.7%
sqrt-unprod19.8%
add-sqr-sqrt42.9%
distribute-rgt-out--42.9%
*-commutative42.9%
cancel-sign-sub-inv42.9%
associate-*l*42.9%
add-sqr-sqrt19.8%
sqrt-unprod55.7%
sqr-neg55.7%
sqrt-unprod39.1%
add-sqr-sqrt70.9%
Applied egg-rr70.9%
fma-define70.9%
distribute-lft-neg-out70.9%
add-sqr-sqrt70.9%
sqr-neg70.9%
sqrt-unprod0.0%
add-sqr-sqrt42.9%
fma-neg42.9%
*-commutative42.9%
add-sqr-sqrt0.0%
sqrt-unprod70.9%
sqr-neg70.9%
add-sqr-sqrt70.9%
Applied egg-rr70.9%
associate-*r*70.9%
*-commutative70.9%
distribute-rgt-out--70.9%
Simplified70.9%
if 2.99999999999999984e-13 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-rgt-in100.0%
Applied egg-rr100.0%
Taylor expanded in z around inf 98.6%
associate-*r*98.6%
associate-*r*98.6%
distribute-rgt-out100.0%
mul-1-neg100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 65.3%
mul-1-neg65.3%
rem-square-sqrt27.8%
fabs-sqr27.8%
rem-square-sqrt41.7%
rem-sqrt-square34.7%
associate-*l*34.7%
*-commutative34.7%
associate-*l*34.7%
*-commutative34.7%
swap-sqr31.9%
swap-sqr31.9%
rem-square-sqrt31.9%
rem-square-sqrt31.9%
rem-square-sqrt31.9%
swap-sqr34.7%
Simplified65.3%
Final simplification69.3%
(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.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0)))) (if (or (<= x -2.3) (not (<= x 4.8e-31))) (* (* x 0.5) t_1) (* t_1 (- y)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((x <= -2.3) || !(x <= 4.8e-31)) {
tmp = (x * 0.5) * t_1;
} else {
tmp = 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 ((x <= (-2.3d0)) .or. (.not. (x <= 4.8d-31))) then
tmp = (x * 0.5d0) * t_1
else
tmp = 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 ((x <= -2.3) || !(x <= 4.8e-31)) {
tmp = (x * 0.5) * t_1;
} else {
tmp = t_1 * -y;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (x <= -2.3) or not (x <= 4.8e-31): tmp = (x * 0.5) * t_1 else: tmp = t_1 * -y return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if ((x <= -2.3) || !(x <= 4.8e-31)) tmp = Float64(Float64(x * 0.5) * t_1); else tmp = 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 ((x <= -2.3) || ~((x <= 4.8e-31))) tmp = (x * 0.5) * t_1; else tmp = 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[Or[LessEqual[x, -2.3], N[Not[LessEqual[x, 4.8e-31]], $MachinePrecision]], N[(N[(x * 0.5), $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;x \leq -2.3 \lor \neg \left(x \leq 4.8 \cdot 10^{-31}\right):\\
\;\;\;\;\left(x \cdot 0.5\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(-y\right)\\
\end{array}
\end{array}
if x < -2.2999999999999998 or 4.8e-31 < x Initial program 99.8%
Taylor expanded in t around 0 60.6%
add-cbrt-cube50.1%
add-sqr-sqrt50.2%
pow150.2%
pow1/250.2%
pow-prod-up50.2%
metadata-eval50.2%
Applied egg-rr50.2%
Taylor expanded in x around inf 42.0%
*-rgt-identity42.0%
*-commutative42.0%
pow1/340.4%
pow-pow52.4%
metadata-eval52.4%
pow1/252.4%
pow152.4%
*-commutative52.4%
associate-*r*52.4%
Applied egg-rr52.4%
unpow152.4%
associate-*r*52.4%
*-commutative52.4%
Simplified52.4%
if -2.2999999999999998 < x < 4.8e-31Initial program 99.8%
Taylor expanded in t around 0 49.3%
Taylor expanded in x around 0 38.0%
mul-1-neg38.0%
Simplified38.0%
*-rgt-identity38.0%
distribute-lft-neg-out38.0%
Applied egg-rr38.0%
Final simplification45.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0)))) (if (<= t 0.025) (* t_1 (- (* x 0.5) y)) (* t_1 (* x (- 0.5 (/ y x)))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t <= 0.025) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * (x * (0.5 - (y / x)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if (t <= 0.025d0) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = t_1 * (x * (0.5d0 - (y / x)))
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 <= 0.025) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * (x * (0.5 - (y / x)));
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t <= 0.025: tmp = t_1 * ((x * 0.5) - y) else: tmp = t_1 * (x * (0.5 - (y / x))) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 0.025) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(t_1 * Float64(x * Float64(0.5 - Float64(y / x)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 0.025) tmp = t_1 * ((x * 0.5) - y); else tmp = t_1 * (x * (0.5 - (y / x))); 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, 0.025], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(x * N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 0.025:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)\\
\end{array}
\end{array}
if t < 0.025000000000000001Initial program 99.7%
Taylor expanded in t around 0 71.0%
*-rgt-identity71.0%
*-commutative71.0%
sub-neg71.0%
sub-neg71.0%
add-sqr-sqrt39.4%
sqrt-unprod55.9%
sqr-neg55.9%
sqrt-unprod19.7%
add-sqr-sqrt42.6%
distribute-rgt-out--42.6%
*-commutative42.6%
cancel-sign-sub-inv42.6%
associate-*l*42.6%
add-sqr-sqrt19.7%
sqrt-unprod55.9%
sqr-neg55.9%
sqrt-unprod39.4%
add-sqr-sqrt71.0%
Applied egg-rr71.0%
fma-define71.0%
distribute-lft-neg-out71.0%
add-sqr-sqrt71.0%
sqr-neg71.0%
sqrt-unprod0.0%
add-sqr-sqrt42.6%
fma-neg42.6%
*-commutative42.6%
add-sqr-sqrt0.0%
sqrt-unprod71.0%
sqr-neg71.0%
add-sqr-sqrt71.0%
Applied egg-rr71.0%
associate-*r*71.0%
*-commutative71.0%
distribute-rgt-out--71.0%
Simplified71.0%
if 0.025000000000000001 < t Initial program 100.0%
Taylor expanded in t around 0 15.2%
Taylor expanded in x around inf 27.2%
mul-1-neg27.2%
unsub-neg27.2%
Simplified27.2%
Final simplification58.9%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0)))) (if (<= t 1.45e+113) (* t_1 (- (* x 0.5) y)) (* t_1 (* (/ y x) (- x))))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t <= 1.45e+113) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * ((y / x) * -x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = sqrt((z * 2.0d0))
if (t <= 1.45d+113) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = t_1 * ((y / x) * -x)
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.45e+113) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * ((y / x) * -x);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t <= 1.45e+113: tmp = t_1 * ((x * 0.5) - y) else: tmp = t_1 * ((y / x) * -x) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t <= 1.45e+113) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(t_1 * Float64(Float64(y / x) * Float64(-x))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (t <= 1.45e+113) tmp = t_1 * ((x * 0.5) - y); else tmp = t_1 * ((y / x) * -x); 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, 1.45e+113], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(N[(y / x), $MachinePrecision] * (-x)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t \leq 1.45 \cdot 10^{+113}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\frac{y}{x} \cdot \left(-x\right)\right)\\
\end{array}
\end{array}
if t < 1.44999999999999992e113Initial program 99.7%
Taylor expanded in t around 0 65.7%
*-rgt-identity65.7%
*-commutative65.7%
sub-neg65.7%
sub-neg65.7%
add-sqr-sqrt36.4%
sqrt-unprod52.3%
sqr-neg52.3%
sqrt-unprod18.4%
add-sqr-sqrt39.8%
distribute-rgt-out--39.8%
*-commutative39.8%
cancel-sign-sub-inv39.8%
associate-*l*39.8%
add-sqr-sqrt18.4%
sqrt-unprod52.3%
sqr-neg52.3%
sqrt-unprod36.4%
add-sqr-sqrt65.7%
Applied egg-rr65.7%
fma-define65.7%
distribute-lft-neg-out65.7%
add-sqr-sqrt65.7%
sqr-neg65.7%
sqrt-unprod0.0%
add-sqr-sqrt39.8%
fma-neg39.8%
*-commutative39.8%
add-sqr-sqrt0.0%
sqrt-unprod65.7%
sqr-neg65.7%
add-sqr-sqrt65.7%
Applied egg-rr65.7%
associate-*r*65.7%
*-commutative65.7%
distribute-rgt-out--65.7%
Simplified65.7%
if 1.44999999999999992e113 < t Initial program 100.0%
Taylor expanded in t around 0 15.6%
Taylor expanded in x around inf 28.3%
mul-1-neg28.3%
unsub-neg28.3%
Simplified28.3%
Taylor expanded in y around inf 21.3%
neg-mul-121.3%
distribute-neg-frac221.3%
Simplified21.3%
Final simplification56.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%
Taylor expanded in t around 0 55.5%
*-rgt-identity55.5%
*-commutative55.5%
sub-neg55.5%
sub-neg55.5%
add-sqr-sqrt31.3%
sqrt-unprod46.1%
sqr-neg46.1%
sqrt-unprod15.3%
add-sqr-sqrt33.7%
distribute-rgt-out--33.4%
*-commutative33.4%
cancel-sign-sub-inv33.4%
associate-*l*33.4%
add-sqr-sqrt15.3%
sqrt-unprod46.1%
sqr-neg46.1%
sqrt-unprod31.3%
add-sqr-sqrt55.5%
Applied egg-rr55.5%
fma-define55.5%
distribute-lft-neg-out55.5%
add-sqr-sqrt55.5%
sqr-neg55.5%
sqrt-unprod0.0%
add-sqr-sqrt33.4%
fma-neg33.4%
*-commutative33.4%
add-sqr-sqrt0.0%
sqrt-unprod55.5%
sqr-neg55.5%
add-sqr-sqrt55.5%
Applied egg-rr55.5%
associate-*r*55.5%
*-commutative55.5%
distribute-rgt-out--55.5%
Simplified55.5%
Final simplification55.5%
(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%
Taylor expanded in t around 0 55.5%
Taylor expanded in x around 0 23.2%
mul-1-neg23.2%
Simplified23.2%
*-rgt-identity23.2%
distribute-lft-neg-out23.2%
Applied egg-rr23.2%
Final simplification23.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.8%
Taylor expanded in t around 0 55.5%
Taylor expanded in x around 0 23.2%
mul-1-neg23.2%
Simplified23.2%
*-rgt-identity23.2%
add-sqr-sqrt9.3%
sqrt-unprod15.2%
sqr-neg15.2%
sqrt-unprod1.4%
add-sqr-sqrt2.2%
pow12.2%
Applied egg-rr2.2%
unpow12.2%
Simplified2.2%
Final simplification2.2%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (pow (exp 1.0) (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * pow(exp(1.0), ((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (exp(1.0d0) ** ((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.pow(Math.exp(1.0), ((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.pow(math.exp(1.0), ((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * (exp(1.0) ^ Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (exp(1.0) ^ ((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[N[Exp[1.0], $MachinePrecision], N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot {\left(e^{1}\right)}^{\left(\frac{t \cdot t}{2}\right)}
\end{array}
herbie shell --seed 2024144
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:alt
(! :herbie-platform default (* (* (- (* x 1/2) y) (sqrt (* z 2))) (pow (exp 1) (/ (* t t) 2))))
(* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))