
(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 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (- (/ t (/ -2.0 t))))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(-(t / (-2.0 / 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 = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(-(t / ((-2.0d0) / t)))
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 / (-2.0 / t)));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(-(t / (-2.0 / t)))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(-Float64(t / Float64(-2.0 / t))))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(-(t / (-2.0 / t))); 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[(t / N[(-2.0 / t), $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{-\frac{t}{\frac{-2}{t}}}
\end{array}
Initial program 99.8%
frac-2neg99.8%
distribute-frac-neg99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-/l*99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (* t t) 200.0) (not (<= (* t t) 2e+230))) (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (+ 1.0 (* t (* 0.5 t)))) (* (exp (/ (* t t) 2.0)) (* x (sqrt (* 0.5 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (((t * t) <= 200.0) || !((t * t) <= 2e+230)) {
tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)));
} else {
tmp = exp(((t * t) / 2.0)) * (x * sqrt((0.5 * 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 * t) <= 200.0d0) .or. (.not. ((t * t) <= 2d+230))) then
tmp = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (1.0d0 + (t * (0.5d0 * t)))
else
tmp = exp(((t * t) / 2.0d0)) * (x * sqrt((0.5d0 * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((t * t) <= 200.0) || !((t * t) <= 2e+230)) {
tmp = (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)));
} else {
tmp = Math.exp(((t * t) / 2.0)) * (x * Math.sqrt((0.5 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((t * t) <= 200.0) or not ((t * t) <= 2e+230): tmp = (((x * 0.5) - y) * math.sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t))) else: tmp = math.exp(((t * t) / 2.0)) * (x * math.sqrt((0.5 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(t * t) <= 200.0) || !(Float64(t * t) <= 2e+230)) tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * Float64(1.0 + Float64(t * Float64(0.5 * t)))); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(x * sqrt(Float64(0.5 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((t * t) <= 200.0) || ~(((t * t) <= 2e+230))) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t))); else tmp = exp(((t * t) / 2.0)) * (x * sqrt((0.5 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(t * t), $MachinePrecision], 200.0], N[Not[LessEqual[N[(t * t), $MachinePrecision], 2e+230]], $MachinePrecision]], N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(t * N[(0.5 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 200 \lor \neg \left(t \cdot t \leq 2 \cdot 10^{+230}\right):\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(1 + t \cdot \left(0.5 \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(x \cdot \sqrt{0.5 \cdot z}\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 200 or 2.0000000000000002e230 < (*.f64 t t) Initial program 99.8%
Taylor expanded in t around 0 98.0%
unpow259.3%
associate-*r*59.3%
*-commutative59.3%
Simplified98.0%
if 200 < (*.f64 t t) < 2.0000000000000002e230Initial program 100.0%
add-sqr-sqrt44.0%
sqrt-unprod42.0%
*-commutative42.0%
*-commutative42.0%
swap-sqr42.0%
add-sqr-sqrt42.0%
pow242.0%
Applied egg-rr42.0%
Taylor expanded in x around inf 34.0%
associate-*r*34.0%
unpow234.0%
Simplified34.0%
sqrt-prod21.1%
*-commutative21.1%
Applied egg-rr36.0%
*-commutative21.1%
rem-sqrt-square9.8%
unpow19.8%
sqr-pow9.4%
fabs-sqr9.4%
sqr-pow14.9%
unpow114.9%
Simplified84.0%
Final simplification95.3%
(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}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (+ 1.0 (* t (* 0.5 t)))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (1.0d0 + (t * (0.5d0 * t)))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t)))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * Float64(1.0 + Float64(t * Float64(0.5 * t)))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (t * (0.5 * t))); 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[(1.0 + N[(t * N[(0.5 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(1 + t \cdot \left(0.5 \cdot t\right)\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 86.2%
unpow253.0%
associate-*r*53.0%
*-commutative53.0%
Simplified86.2%
Final simplification86.2%
(FPCore (x y z t) :precision binary64 (if (<= t 3.3e+17) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (* (+ 1.0 (* t (* 0.5 t))) (* x (sqrt (* 0.5 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.3e+17) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = (1.0 + (t * (0.5 * t))) * (x * sqrt((0.5 * 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 <= 3.3d+17) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = (1.0d0 + (t * (0.5d0 * t))) * (x * sqrt((0.5d0 * z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 3.3e+17) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = (1.0 + (t * (0.5 * t))) * (x * Math.sqrt((0.5 * z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 3.3e+17: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = (1.0 + (t * (0.5 * t))) * (x * math.sqrt((0.5 * z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 3.3e+17) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = Float64(Float64(1.0 + Float64(t * Float64(0.5 * t))) * Float64(x * sqrt(Float64(0.5 * z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 3.3e+17) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = (1.0 + (t * (0.5 * t))) * (x * sqrt((0.5 * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 3.3e+17], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(t * N[(0.5 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.3 \cdot 10^{+17}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + t \cdot \left(0.5 \cdot t\right)\right) \cdot \left(x \cdot \sqrt{0.5 \cdot z}\right)\\
\end{array}
\end{array}
if t < 3.3e17Initial program 99.7%
Taylor expanded in t around 0 71.1%
*-commutative71.1%
*-commutative71.1%
associate-*r*71.1%
sqrt-prod71.3%
sub-neg71.3%
distribute-lft-in70.2%
Applied egg-rr70.2%
distribute-lft-out71.3%
*-commutative71.3%
*-commutative71.3%
sub-neg71.3%
Simplified71.3%
if 3.3e17 < t Initial program 100.0%
add-sqr-sqrt48.7%
sqrt-unprod48.7%
*-commutative48.7%
*-commutative48.7%
swap-sqr48.7%
add-sqr-sqrt48.7%
pow248.7%
Applied egg-rr48.7%
Taylor expanded in x around inf 39.5%
associate-*r*39.5%
unpow239.5%
Simplified39.5%
sqrt-prod22.2%
*-commutative22.2%
Applied egg-rr43.4%
*-commutative22.2%
rem-sqrt-square8.6%
unpow18.6%
sqr-pow7.9%
fabs-sqr7.9%
sqr-pow14.6%
unpow114.6%
Simplified76.3%
Taylor expanded in t around 0 55.2%
unpow255.2%
associate-*r*55.2%
*-commutative55.2%
Simplified55.2%
Final simplification66.5%
(FPCore (x y z t) :precision binary64 (if (<= (* x 0.5) 2e+160) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (sqrt (* (* 0.5 z) (* x x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * 0.5) <= 2e+160) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt(((0.5 * z) * (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) :: tmp
if ((x * 0.5d0) <= 2d+160) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt(((0.5d0 * z) * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x * 0.5) <= 2e+160) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(((0.5 * z) * (x * x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * 0.5) <= 2e+160: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt(((0.5 * z) * (x * x))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * 0.5) <= 2e+160) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(Float64(0.5 * z) * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * 0.5) <= 2e+160) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = sqrt(((0.5 * z) * (x * x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * 0.5), $MachinePrecision], 2e+160], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(0.5 * z), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 0.5 \leq 2 \cdot 10^{+160}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(0.5 \cdot z\right) \cdot \left(x \cdot x\right)}\\
\end{array}
\end{array}
if (*.f64 x 1/2) < 2.00000000000000001e160Initial program 99.8%
Taylor expanded in t around 0 55.0%
*-commutative55.0%
*-commutative55.0%
associate-*r*55.1%
sqrt-prod55.2%
sub-neg55.2%
distribute-lft-in54.7%
Applied egg-rr54.7%
distribute-lft-out55.2%
*-commutative55.2%
*-commutative55.2%
sub-neg55.2%
Simplified55.2%
if 2.00000000000000001e160 < (*.f64 x 1/2) Initial program 99.8%
add-sqr-sqrt99.8%
sqrt-unprod80.2%
*-commutative80.2%
*-commutative80.2%
swap-sqr77.7%
add-sqr-sqrt77.7%
pow277.7%
Applied egg-rr77.7%
Taylor expanded in x around inf 77.7%
associate-*r*77.7%
unpow277.7%
Simplified77.7%
Taylor expanded in t around 0 77.7%
Final simplification58.5%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* z 2.0))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - 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 = ((x * 0.5d0) - y) * sqrt((z * 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));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((z * 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 56.6%
*-commutative56.6%
*-commutative56.6%
associate-*r*56.6%
sqrt-prod56.7%
sub-neg56.7%
distribute-lft-in55.9%
Applied egg-rr55.9%
distribute-lft-out56.7%
*-commutative56.7%
*-commutative56.7%
sub-neg56.7%
Simplified56.7%
Final simplification56.7%
(FPCore (x y z t) :precision binary64 (* x (sqrt (* 0.5 z))))
double code(double x, double y, double z, double t) {
return x * sqrt((0.5 * 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 = x * sqrt((0.5d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return x * Math.sqrt((0.5 * z));
}
def code(x, y, z, t): return x * math.sqrt((0.5 * z))
function code(x, y, z, t) return Float64(x * sqrt(Float64(0.5 * z))) end
function tmp = code(x, y, z, t) tmp = x * sqrt((0.5 * z)); end
code[x_, y_, z_, t_] := N[(x * N[Sqrt[N[(0.5 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \sqrt{0.5 \cdot z}
\end{array}
Initial program 99.8%
add-sqr-sqrt50.6%
sqrt-unprod41.1%
*-commutative41.1%
*-commutative41.1%
swap-sqr38.1%
add-sqr-sqrt38.1%
pow238.1%
Applied egg-rr38.1%
Taylor expanded in x around inf 27.1%
associate-*r*27.1%
unpow227.1%
Simplified27.1%
Taylor expanded in t around 0 19.1%
sqrt-prod21.6%
*-commutative21.6%
Applied egg-rr21.6%
*-commutative21.6%
rem-sqrt-square19.8%
unpow119.8%
sqr-pow18.5%
fabs-sqr18.5%
sqr-pow33.1%
unpow133.1%
Simplified33.1%
Final simplification33.1%
(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 2023200
(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))))