
(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 8 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 (* (exp (pow t 2.0)) (* 2.0 z))) (- (* 0.5 x) y)))
double code(double x, double y, double z, double t) {
return sqrt((exp(pow(t, 2.0)) * (2.0 * z))) * ((0.5 * x) - 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((exp((t ** 2.0d0)) * (2.0d0 * z))) * ((0.5d0 * x) - y)
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((Math.exp(Math.pow(t, 2.0)) * (2.0 * z))) * ((0.5 * x) - y);
}
def code(x, y, z, t): return math.sqrt((math.exp(math.pow(t, 2.0)) * (2.0 * z))) * ((0.5 * x) - y)
function code(x, y, z, t) return Float64(sqrt(Float64(exp((t ^ 2.0)) * Float64(2.0 * z))) * Float64(Float64(0.5 * x) - y)) end
function tmp = code(x, y, z, t) tmp = sqrt((exp((t ^ 2.0)) * (2.0 * z))) * ((0.5 * x) - y); end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(N[Exp[N[Power[t, 2.0], $MachinePrecision]], $MachinePrecision] * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{e^{{t}^{2}} \cdot \left(2 \cdot z\right)} \cdot \left(0.5 \cdot x - y\right)
\end{array}
Initial program 98.6%
associate-*r*99.8%
*-commutative99.8%
sub-neg99.8%
distribute-lft-in79.5%
exp-sqrt79.5%
sqrt-unprod79.5%
associate-*l*79.5%
pow279.5%
Applied egg-rr79.5%
distribute-lft-out99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
sub-neg99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* 2.0 z))))
(if (or (<= (* t t) 5e+17) (not (<= (* t t) 1e+194)))
(* (- (* 0.5 x) y) (* t_1 (+ (* t (* t 0.5)) 1.0)))
(* (exp (/ (* t t) 2.0)) (* (* 0.5 x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((2.0 * z));
double tmp;
if (((t * t) <= 5e+17) || !((t * t) <= 1e+194)) {
tmp = ((0.5 * x) - y) * (t_1 * ((t * (t * 0.5)) + 1.0));
} else {
tmp = exp(((t * t) / 2.0)) * ((0.5 * x) * 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 = sqrt((2.0d0 * z))
if (((t * t) <= 5d+17) .or. (.not. ((t * t) <= 1d+194))) then
tmp = ((0.5d0 * x) - y) * (t_1 * ((t * (t * 0.5d0)) + 1.0d0))
else
tmp = exp(((t * t) / 2.0d0)) * ((0.5d0 * x) * t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.sqrt((2.0 * z));
double tmp;
if (((t * t) <= 5e+17) || !((t * t) <= 1e+194)) {
tmp = ((0.5 * x) - y) * (t_1 * ((t * (t * 0.5)) + 1.0));
} else {
tmp = Math.exp(((t * t) / 2.0)) * ((0.5 * x) * t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((2.0 * z)) tmp = 0 if ((t * t) <= 5e+17) or not ((t * t) <= 1e+194): tmp = ((0.5 * x) - y) * (t_1 * ((t * (t * 0.5)) + 1.0)) else: tmp = math.exp(((t * t) / 2.0)) * ((0.5 * x) * t_1) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(2.0 * z)) tmp = 0.0 if ((Float64(t * t) <= 5e+17) || !(Float64(t * t) <= 1e+194)) tmp = Float64(Float64(Float64(0.5 * x) - y) * Float64(t_1 * Float64(Float64(t * Float64(t * 0.5)) + 1.0))); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(Float64(0.5 * x) * t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((2.0 * z)); tmp = 0.0; if (((t * t) <= 5e+17) || ~(((t * t) <= 1e+194))) tmp = ((0.5 * x) - y) * (t_1 * ((t * (t * 0.5)) + 1.0)); else tmp = exp(((t * t) / 2.0)) * ((0.5 * x) * t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[N[(t * t), $MachinePrecision], 5e+17], N[Not[LessEqual[N[(t * t), $MachinePrecision], 1e+194]], $MachinePrecision]], N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[(t$95$1 * N[(N[(t * N[(t * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(0.5 * x), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{2 \cdot z}\\
\mathbf{if}\;t \cdot t \leq 5 \cdot 10^{+17} \lor \neg \left(t \cdot t \leq 10^{+194}\right):\\
\;\;\;\;\left(0.5 \cdot x - y\right) \cdot \left(t_1 \cdot \left(t \cdot \left(t \cdot 0.5\right) + 1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(\left(0.5 \cdot x\right) \cdot t_1\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 5e17 or 9.99999999999999945e193 < (*.f64 t t) Initial program 98.9%
sqr-neg98.9%
associate-/l*98.9%
distribute-frac-neg98.9%
exp-neg98.9%
associate-*r/98.9%
*-rgt-identity98.9%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 95.5%
+-commutative95.5%
Simplified95.5%
*-commutative95.5%
metadata-eval95.5%
div-inv95.5%
pow295.5%
associate-/l*95.5%
Applied egg-rr95.5%
associate-/r/95.5%
div-inv95.5%
metadata-eval95.5%
Applied egg-rr95.5%
if 5e17 < (*.f64 t t) < 9.99999999999999945e193Initial program 97.4%
add-cbrt-cube87.2%
pow387.2%
fma-neg87.2%
Applied egg-rr87.2%
rem-cbrt-cube97.4%
fma-neg97.4%
*-commutative97.4%
add-sqr-sqrt97.4%
associate-*l*97.4%
pow1/297.4%
sqrt-pow197.4%
*-commutative97.4%
metadata-eval97.4%
pow1/297.4%
sqrt-pow197.4%
*-commutative97.4%
metadata-eval97.4%
*-commutative97.4%
fma-neg97.4%
add-sqr-sqrt59.0%
sqrt-unprod74.4%
sqr-neg74.4%
sqrt-unprod17.9%
add-sqr-sqrt51.3%
Applied egg-rr51.3%
Taylor expanded in x around inf 82.1%
*-commutative82.1%
*-commutative82.1%
associate-*r*82.1%
*-commutative82.1%
Simplified82.1%
expm1-log1p-u59.0%
expm1-udef30.8%
associate-*r*30.8%
*-commutative30.8%
pow-prod-up30.8%
metadata-eval30.8%
pow1/230.8%
Applied egg-rr30.8%
expm1-def59.0%
expm1-log1p82.1%
*-commutative82.1%
Simplified82.1%
Final simplification93.4%
(FPCore (x y z t) :precision binary64 (* (* (- (* 0.5 x) y) (sqrt (* 2.0 z))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((0.5 * x) - y) * sqrt((2.0 * z))) * 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 = (((0.5d0 * x) - y) * sqrt((2.0d0 * z))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((0.5 * x) - y) * Math.sqrt((2.0 * z))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((0.5 * x) - y) * math.sqrt((2.0 * z))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(2.0 * z))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((0.5 * x) - y) * sqrt((2.0 * z))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(0.5 \cdot x - y\right) \cdot \sqrt{2 \cdot z}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Initial program 98.6%
Final simplification98.6%
(FPCore (x y z t) :precision binary64 (* (- (* 0.5 x) y) (* (sqrt (* 2.0 z)) (+ (* t (* t 0.5)) 1.0))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * (sqrt((2.0 * z)) * ((t * (t * 0.5)) + 1.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((2.0d0 * z)) * ((t * (t * 0.5d0)) + 1.0d0))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * (Math.sqrt((2.0 * z)) * ((t * (t * 0.5)) + 1.0));
}
def code(x, y, z, t): return ((0.5 * x) - y) * (math.sqrt((2.0 * z)) * ((t * (t * 0.5)) + 1.0))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * Float64(sqrt(Float64(2.0 * z)) * Float64(Float64(t * Float64(t * 0.5)) + 1.0))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * (sqrt((2.0 * z)) * ((t * (t * 0.5)) + 1.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * N[(N[(t * N[(t * 0.5), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot x - y\right) \cdot \left(\sqrt{2 \cdot z} \cdot \left(t \cdot \left(t \cdot 0.5\right) + 1\right)\right)
\end{array}
Initial program 98.6%
sqr-neg98.6%
associate-/l*98.6%
distribute-frac-neg98.6%
exp-neg98.6%
associate-*r/98.6%
*-rgt-identity98.6%
associate-*r/99.8%
*-rgt-identity99.8%
associate-*r/99.8%
exp-neg99.8%
distribute-frac-neg99.8%
associate-/l*99.8%
sqr-neg99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 85.4%
+-commutative85.4%
Simplified85.4%
*-commutative85.4%
metadata-eval85.4%
div-inv85.4%
pow285.4%
associate-/l*85.4%
Applied egg-rr85.4%
associate-/r/85.4%
div-inv85.4%
metadata-eval85.4%
Applied egg-rr85.4%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (<= t 1.65e+15) (* (- (* 0.5 x) y) (sqrt (* 2.0 z))) (pow (* z (* 2.0 (* y (+ x y)))) 0.5)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e+15) {
tmp = ((0.5 * x) - y) * sqrt((2.0 * z));
} else {
tmp = pow((z * (2.0 * (y * (x + y)))), 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) :: tmp
if (t <= 1.65d+15) then
tmp = ((0.5d0 * x) - y) * sqrt((2.0d0 * z))
else
tmp = (z * (2.0d0 * (y * (x + y)))) ** 0.5d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.65e+15) {
tmp = ((0.5 * x) - y) * Math.sqrt((2.0 * z));
} else {
tmp = Math.pow((z * (2.0 * (y * (x + y)))), 0.5);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.65e+15: tmp = ((0.5 * x) - y) * math.sqrt((2.0 * z)) else: tmp = math.pow((z * (2.0 * (y * (x + y)))), 0.5) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.65e+15) tmp = Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(2.0 * z))); else tmp = Float64(z * Float64(2.0 * Float64(y * Float64(x + y)))) ^ 0.5; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.65e+15) tmp = ((0.5 * x) - y) * sqrt((2.0 * z)); else tmp = (z * (2.0 * (y * (x + y)))) ^ 0.5; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.65e+15], N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[(z * N[(2.0 * N[(y * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.65 \cdot 10^{+15}:\\
\;\;\;\;\left(0.5 \cdot x - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;{\left(z \cdot \left(2 \cdot \left(y \cdot \left(x + y\right)\right)\right)\right)}^{0.5}\\
\end{array}
\end{array}
if t < 1.65e15Initial program 98.7%
associate-*r*99.7%
*-commutative99.7%
sub-neg99.7%
distribute-lft-in86.7%
exp-sqrt86.7%
sqrt-unprod86.7%
associate-*l*86.7%
pow286.7%
Applied egg-rr86.7%
distribute-lft-out99.7%
*-commutative99.7%
*-commutative99.7%
associate-*l*99.7%
*-commutative99.7%
sub-neg99.7%
Simplified99.7%
Taylor expanded in t around 0 72.7%
*-commutative72.7%
Simplified72.7%
if 1.65e15 < t Initial program 98.5%
Taylor expanded in t around 0 17.6%
add-sqr-sqrt12.8%
sqrt-unprod31.7%
*-commutative31.7%
*-commutative31.7%
swap-sqr31.7%
rem-square-sqrt31.7%
pow231.7%
*-commutative31.7%
fma-neg31.7%
add-sqr-sqrt25.2%
sqrt-unprod31.7%
sqr-neg31.7%
sqrt-unprod6.4%
add-sqr-sqrt31.7%
Applied egg-rr31.7%
Taylor expanded in x around 0 11.6%
+-commutative11.6%
unpow211.6%
distribute-rgt-out16.2%
Simplified16.2%
sqrt-unprod16.2%
pow1/219.3%
+-commutative19.3%
Applied egg-rr19.3%
Final simplification59.1%
(FPCore (x y z t) :precision binary64 (sqrt (* (* 2.0 z) (* y (+ x y)))))
double code(double x, double y, double z, double t) {
return sqrt(((2.0 * z) * (y * (x + 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(((2.0d0 * z) * (y * (x + y))))
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt(((2.0 * z) * (y * (x + y))));
}
def code(x, y, z, t): return math.sqrt(((2.0 * z) * (y * (x + y))))
function code(x, y, z, t) return sqrt(Float64(Float64(2.0 * z) * Float64(y * Float64(x + y)))) end
function tmp = code(x, y, z, t) tmp = sqrt(((2.0 * z) * (y * (x + y)))); end
code[x_, y_, z_, t_] := N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(y * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\left(2 \cdot z\right) \cdot \left(y \cdot \left(x + y\right)\right)}
\end{array}
Initial program 98.6%
Taylor expanded in t around 0 58.6%
add-sqr-sqrt27.6%
sqrt-unprod28.6%
*-commutative28.6%
*-commutative28.6%
swap-sqr28.5%
rem-square-sqrt28.6%
pow228.6%
*-commutative28.6%
fma-neg28.6%
add-sqr-sqrt22.1%
sqrt-unprod28.6%
sqr-neg28.6%
sqrt-unprod6.5%
add-sqr-sqrt28.1%
Applied egg-rr28.1%
Taylor expanded in x around 0 15.2%
+-commutative15.2%
unpow215.2%
distribute-rgt-out17.6%
Simplified17.6%
expm1-log1p-u17.3%
expm1-udef15.3%
sqrt-unprod15.2%
+-commutative15.2%
Applied egg-rr15.2%
expm1-def16.9%
expm1-log1p17.1%
associate-*r*17.1%
+-commutative17.1%
Simplified17.1%
Final simplification17.1%
(FPCore (x y z t) :precision binary64 (* (- (* 0.5 x) y) (sqrt (* 2.0 z))))
double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * sqrt((2.0 * z));
}
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((2.0d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return ((0.5 * x) - y) * Math.sqrt((2.0 * z));
}
def code(x, y, z, t): return ((0.5 * x) - y) * math.sqrt((2.0 * z))
function code(x, y, z, t) return Float64(Float64(Float64(0.5 * x) - y) * sqrt(Float64(2.0 * z))) end
function tmp = code(x, y, z, t) tmp = ((0.5 * x) - y) * sqrt((2.0 * z)); end
code[x_, y_, z_, t_] := N[(N[(N[(0.5 * x), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.5 \cdot x - y\right) \cdot \sqrt{2 \cdot z}
\end{array}
Initial program 98.6%
associate-*r*99.8%
*-commutative99.8%
sub-neg99.8%
distribute-lft-in79.5%
exp-sqrt79.5%
sqrt-unprod79.5%
associate-*l*79.5%
pow279.5%
Applied egg-rr79.5%
distribute-lft-out99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
*-commutative99.8%
sub-neg99.8%
Simplified99.8%
Taylor expanded in t around 0 58.7%
*-commutative58.7%
Simplified58.7%
Final simplification58.7%
(FPCore (x y z t) :precision binary64 (* y (sqrt (* 2.0 z))))
double code(double x, double y, double z, double t) {
return y * sqrt((2.0 * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = y * sqrt((2.0d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return y * Math.sqrt((2.0 * z));
}
def code(x, y, z, t): return y * math.sqrt((2.0 * z))
function code(x, y, z, t) return Float64(y * sqrt(Float64(2.0 * z))) end
function tmp = code(x, y, z, t) tmp = y * sqrt((2.0 * z)); end
code[x_, y_, z_, t_] := N[(y * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \sqrt{2 \cdot z}
\end{array}
Initial program 98.6%
Taylor expanded in t around 0 58.6%
*-commutative58.6%
*-commutative58.6%
fma-neg58.6%
associate-*l*58.5%
fma-neg58.5%
*-commutative58.5%
Simplified58.5%
Taylor expanded in x around 0 30.3%
mul-1-neg30.3%
distribute-lft-neg-out30.3%
*-commutative30.3%
Simplified30.3%
expm1-log1p-u20.9%
expm1-udef13.9%
associate-*r*13.9%
sqrt-prod13.9%
*-commutative13.9%
add-sqr-sqrt12.7%
sqrt-unprod15.7%
sqr-neg15.7%
sqrt-unprod1.7%
add-sqr-sqrt2.3%
Applied egg-rr2.3%
expm1-def2.2%
expm1-log1p2.5%
*-commutative2.5%
Simplified2.5%
Final simplification2.5%
(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 2023320
(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))))