
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
(FPCore (x y z t) :precision binary64 (* (* (- (* 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 (if (or (<= (* t t) 0.0126) (not (<= (* t t) 6e+283))) (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (+ 1.0 (* 0.5 (* t t)))) (* (exp (/ (* t t) 2.0)) (* y (- (sqrt (+ z z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (((t * t) <= 0.0126) || !((t * t) <= 6e+283)) {
tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (0.5 * (t * t)));
} else {
tmp = exp(((t * t) / 2.0)) * (y * -sqrt((z + 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) <= 0.0126d0) .or. (.not. ((t * t) <= 6d+283))) then
tmp = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (1.0d0 + (0.5d0 * (t * t)))
else
tmp = exp(((t * t) / 2.0d0)) * (y * -sqrt((z + z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((t * t) <= 0.0126) || !((t * t) <= 6e+283)) {
tmp = (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * (1.0 + (0.5 * (t * t)));
} else {
tmp = Math.exp(((t * t) / 2.0)) * (y * -Math.sqrt((z + z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((t * t) <= 0.0126) or not ((t * t) <= 6e+283): tmp = (((x * 0.5) - y) * math.sqrt((z * 2.0))) * (1.0 + (0.5 * (t * t))) else: tmp = math.exp(((t * t) / 2.0)) * (y * -math.sqrt((z + z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(t * t) <= 0.0126) || !(Float64(t * t) <= 6e+283)) tmp = Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * Float64(1.0 + Float64(0.5 * Float64(t * t)))); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(y * Float64(-sqrt(Float64(z + z))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((t * t) <= 0.0126) || ~(((t * t) <= 6e+283))) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (0.5 * (t * t))); else tmp = exp(((t * t) / 2.0)) * (y * -sqrt((z + z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(t * t), $MachinePrecision], 0.0126], N[Not[LessEqual[N[(t * t), $MachinePrecision], 6e+283]], $MachinePrecision]], N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(y * (-N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 0.0126 \lor \neg \left(t \cdot t \leq 6 \cdot 10^{+283}\right):\\
\;\;\;\;\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot \left(1 + 0.5 \cdot \left(t \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(y \cdot \left(-\sqrt{z + z}\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 0.0126 or 6.0000000000000001e283 < (*.f64 t t) Initial program 99.7%
Taylor expanded in t around 0 98.8%
unpow259.9%
Simplified98.8%
if 0.0126 < (*.f64 t t) < 6.0000000000000001e283Initial program 100.0%
Taylor expanded in x around 0 83.6%
mul-1-neg83.6%
associate-*l*83.6%
distribute-rgt-neg-in83.6%
distribute-rgt-neg-in83.6%
Simplified83.6%
expm1-log1p-u37.7%
expm1-udef1.6%
distribute-rgt-neg-out1.6%
sqrt-unprod1.6%
count-21.6%
Applied egg-rr1.6%
expm1-def37.7%
expm1-log1p83.6%
Simplified83.6%
Final simplification95.1%
(FPCore (x y z t) :precision binary64 (if (<= (* t t) 2.45e+131) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (* (* y (sqrt (+ z z))) (- -1.0 (* 0.5 (* t t))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t * t) <= 2.45e+131) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = (y * sqrt((z + z))) * (-1.0 - (0.5 * (t * 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 * t) <= 2.45d+131) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = (y * sqrt((z + z))) * ((-1.0d0) - (0.5d0 * (t * t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t * t) <= 2.45e+131) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = (y * Math.sqrt((z + z))) * (-1.0 - (0.5 * (t * t)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t * t) <= 2.45e+131: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = (y * math.sqrt((z + z))) * (-1.0 - (0.5 * (t * t))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(t * t) <= 2.45e+131) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = Float64(Float64(y * sqrt(Float64(z + z))) * Float64(-1.0 - Float64(0.5 * Float64(t * t)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t * t) <= 2.45e+131) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = (y * sqrt((z + z))) * (-1.0 - (0.5 * (t * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(t * t), $MachinePrecision], 2.45e+131], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(y * N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(0.5 * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 2.45 \cdot 10^{+131}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \sqrt{z + z}\right) \cdot \left(-1 - 0.5 \cdot \left(t \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 2.45000000000000016e131Initial program 99.6%
Taylor expanded in t around 0 84.3%
if 2.45000000000000016e131 < (*.f64 t t) Initial program 100.0%
Taylor expanded in x around 0 81.4%
mul-1-neg81.4%
associate-*l*81.4%
distribute-rgt-neg-in81.4%
distribute-rgt-neg-in81.4%
Simplified81.4%
expm1-log1p-u36.1%
expm1-udef5.2%
distribute-rgt-neg-out5.2%
sqrt-unprod5.2%
count-25.2%
Applied egg-rr5.2%
expm1-def36.1%
expm1-log1p81.4%
Simplified81.4%
Taylor expanded in t around 0 63.0%
unpow263.0%
Simplified63.0%
Final simplification76.3%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (+ 1.0 (* 0.5 (* t t)))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (0.5 * (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 = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * (1.0d0 + (0.5d0 * (t * 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 + (0.5 * (t * t)));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * (1.0 + (0.5 * (t * 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(0.5 * Float64(t * t)))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * (1.0 + (0.5 * (t * 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[(0.5 * N[(t * 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 + 0.5 \cdot \left(t \cdot t\right)\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 85.4%
unpow252.3%
Simplified85.4%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (<= t 1.9e+119) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (sqrt (* (* y y) (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.9e+119) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt(((y * y) * (z * 2.0)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 1.9d+119) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt(((y * y) * (z * 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.9e+119) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt(((y * y) * (z * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.9e+119: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt(((y * y) * (z * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.9e+119) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(Float64(y * y) * Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.9e+119) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = sqrt(((y * y) * (z * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.9e+119], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(y * y), $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.9 \cdot 10^{+119}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(y \cdot y\right) \cdot \left(z \cdot 2\right)}\\
\end{array}
\end{array}
if t < 1.89999999999999995e119Initial program 99.7%
Taylor expanded in t around 0 64.9%
if 1.89999999999999995e119 < t Initial program 100.0%
Taylor expanded in t around 0 12.5%
Taylor expanded in x around 0 8.6%
mul-1-neg8.6%
distribute-rgt-neg-in8.6%
Simplified8.6%
add-sqr-sqrt4.5%
sqrt-unprod15.8%
*-commutative15.8%
*-commutative15.8%
swap-sqr15.8%
add-sqr-sqrt15.8%
Applied egg-rr15.8%
*-commutative15.8%
associate-*l*15.8%
Simplified15.8%
add-sqr-sqrt0.0%
pow1/20.0%
sqrt-unprod15.5%
sqr-neg15.5%
add-sqr-sqrt15.5%
pow1/215.5%
pow-prod-down15.5%
Applied egg-rr15.5%
unpow1/215.5%
*-commutative15.5%
*-commutative15.5%
associate-*l*15.5%
Simplified15.5%
Final simplification58.1%
(FPCore (x y z t) :precision binary64 (if (<= t 6.6e+16) (* y (- (sqrt (+ z z)))) (sqrt (* y (* y (* z 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 6.6e+16) {
tmp = y * -sqrt((z + z));
} else {
tmp = sqrt((y * (y * (z * 2.0))));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 6.6d+16) then
tmp = y * -sqrt((z + z))
else
tmp = sqrt((y * (y * (z * 2.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 6.6e+16) {
tmp = y * -Math.sqrt((z + z));
} else {
tmp = Math.sqrt((y * (y * (z * 2.0))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 6.6e+16: tmp = y * -math.sqrt((z + z)) else: tmp = math.sqrt((y * (y * (z * 2.0)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 6.6e+16) tmp = Float64(y * Float64(-sqrt(Float64(z + z)))); else tmp = sqrt(Float64(y * Float64(y * Float64(z * 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 6.6e+16) tmp = y * -sqrt((z + z)); else tmp = sqrt((y * (y * (z * 2.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 6.6e+16], N[(y * (-N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[Sqrt[N[(y * N[(y * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 6.6 \cdot 10^{+16}:\\
\;\;\;\;y \cdot \left(-\sqrt{z + z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{y \cdot \left(y \cdot \left(z \cdot 2\right)\right)}\\
\end{array}
\end{array}
if t < 6.6e16Initial program 99.7%
Taylor expanded in x around 0 64.2%
mul-1-neg64.2%
associate-*l*64.2%
distribute-rgt-neg-in64.2%
distribute-rgt-neg-in64.2%
Simplified64.2%
expm1-log1p-u30.3%
expm1-udef6.0%
distribute-rgt-neg-out6.0%
sqrt-unprod6.0%
count-26.0%
Applied egg-rr6.0%
expm1-def30.3%
expm1-log1p64.2%
Simplified64.2%
Taylor expanded in t around 0 36.8%
if 6.6e16 < t Initial program 100.0%
Taylor expanded in t around 0 11.4%
Taylor expanded in x around 0 6.7%
mul-1-neg6.7%
distribute-rgt-neg-in6.7%
Simplified6.7%
add-sqr-sqrt3.5%
sqrt-unprod16.4%
*-commutative16.4%
*-commutative16.4%
swap-sqr16.4%
add-sqr-sqrt16.4%
Applied egg-rr16.4%
*-commutative16.4%
associate-*l*16.4%
Simplified16.4%
add-sqr-sqrt0.0%
pow1/20.0%
sqrt-unprod12.4%
sqr-neg12.4%
add-sqr-sqrt12.4%
pow1/212.4%
pow-prod-down15.9%
Applied egg-rr15.9%
unpow1/215.9%
associate-*r*15.9%
associate-*r*10.6%
*-commutative10.6%
*-commutative10.6%
*-commutative10.6%
Simplified10.6%
Final simplification31.3%
(FPCore (x y z t) :precision binary64 (if (<= t 1.7e+14) (* y (- (sqrt (+ z z)))) (sqrt (* (* y y) (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.7e+14) {
tmp = y * -sqrt((z + z));
} else {
tmp = sqrt(((y * y) * (z * 2.0)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 1.7d+14) then
tmp = y * -sqrt((z + z))
else
tmp = sqrt(((y * y) * (z * 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.7e+14) {
tmp = y * -Math.sqrt((z + z));
} else {
tmp = Math.sqrt(((y * y) * (z * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.7e+14: tmp = y * -math.sqrt((z + z)) else: tmp = math.sqrt(((y * y) * (z * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.7e+14) tmp = Float64(y * Float64(-sqrt(Float64(z + z)))); else tmp = sqrt(Float64(Float64(y * y) * Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.7e+14) tmp = y * -sqrt((z + z)); else tmp = sqrt(((y * y) * (z * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.7e+14], N[(y * (-N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[Sqrt[N[(N[(y * y), $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.7 \cdot 10^{+14}:\\
\;\;\;\;y \cdot \left(-\sqrt{z + z}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(y \cdot y\right) \cdot \left(z \cdot 2\right)}\\
\end{array}
\end{array}
if t < 1.7e14Initial program 99.7%
Taylor expanded in x around 0 64.2%
mul-1-neg64.2%
associate-*l*64.2%
distribute-rgt-neg-in64.2%
distribute-rgt-neg-in64.2%
Simplified64.2%
expm1-log1p-u30.3%
expm1-udef6.0%
distribute-rgt-neg-out6.0%
sqrt-unprod6.0%
count-26.0%
Applied egg-rr6.0%
expm1-def30.3%
expm1-log1p64.2%
Simplified64.2%
Taylor expanded in t around 0 36.8%
if 1.7e14 < t Initial program 100.0%
Taylor expanded in t around 0 11.4%
Taylor expanded in x around 0 6.7%
mul-1-neg6.7%
distribute-rgt-neg-in6.7%
Simplified6.7%
add-sqr-sqrt3.5%
sqrt-unprod16.4%
*-commutative16.4%
*-commutative16.4%
swap-sqr16.4%
add-sqr-sqrt16.4%
Applied egg-rr16.4%
*-commutative16.4%
associate-*l*16.4%
Simplified16.4%
add-sqr-sqrt0.0%
pow1/20.0%
sqrt-unprod12.4%
sqr-neg12.4%
add-sqr-sqrt12.4%
pow1/212.4%
pow-prod-down15.9%
Applied egg-rr15.9%
unpow1/215.9%
*-commutative15.9%
*-commutative15.9%
associate-*l*15.9%
Simplified15.9%
Final simplification32.4%
(FPCore (x y z t) :precision binary64 (* y (- (sqrt (+ z z)))))
double code(double x, double y, double z, double t) {
return y * -sqrt((z + 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((z + z))
end function
public static double code(double x, double y, double z, double t) {
return y * -Math.sqrt((z + z));
}
def code(x, y, z, t): return y * -math.sqrt((z + z))
function code(x, y, z, t) return Float64(y * Float64(-sqrt(Float64(z + z)))) end
function tmp = code(x, y, z, t) tmp = y * -sqrt((z + z)); end
code[x_, y_, z_, t_] := N[(y * (-N[Sqrt[N[(z + z), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(-\sqrt{z + z}\right)
\end{array}
Initial program 99.8%
Taylor expanded in x around 0 66.3%
mul-1-neg66.3%
associate-*l*66.3%
distribute-rgt-neg-in66.3%
distribute-rgt-neg-in66.3%
Simplified66.3%
expm1-log1p-u31.3%
expm1-udef4.7%
distribute-rgt-neg-out4.7%
sqrt-unprod4.7%
count-24.7%
Applied egg-rr4.7%
expm1-def31.3%
expm1-log1p66.3%
Simplified66.3%
Taylor expanded in t around 0 30.4%
Final simplification30.4%
(FPCore (x y z t) :precision binary64 0.0)
double code(double x, double y, double z, double t) {
return 0.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.0d0
end function
public static double code(double x, double y, double z, double t) {
return 0.0;
}
def code(x, y, z, t): return 0.0
function code(x, y, z, t) return 0.0 end
function tmp = code(x, y, z, t) tmp = 0.0; end
code[x_, y_, z_, t_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 99.8%
Taylor expanded in x around 0 66.3%
mul-1-neg66.3%
associate-*l*66.3%
distribute-rgt-neg-in66.3%
distribute-rgt-neg-in66.3%
Simplified66.3%
expm1-log1p-u31.3%
expm1-udef4.7%
distribute-rgt-neg-out4.7%
sqrt-unprod4.7%
count-24.7%
Applied egg-rr4.7%
expm1-def31.3%
expm1-log1p66.3%
Simplified66.3%
Taylor expanded in t around 0 30.4%
add-log-exp33.1%
exp-prod29.6%
add-sqr-sqrt1.6%
sqrt-unprod4.5%
sqr-neg4.5%
add-sqr-sqrt4.5%
pow1/24.5%
add-sqr-sqrt4.5%
sqr-neg4.5%
neg-mul-14.5%
associate-*l*4.5%
metadata-eval4.5%
add-sqr-sqrt1.6%
sqrt-unprod2.9%
sqr-neg2.9%
add-sqr-sqrt2.9%
add-sqr-sqrt2.6%
cancel-sign-sub-inv2.6%
*-un-lft-identity2.6%
+-inverses2.6%
Applied egg-rr2.6%
Final simplification2.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 2023283
(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))))