
(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 10 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 (* (exp (pow t 2.0)) (* z 2.0)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((exp(pow(t, 2.0)) * (z * 2.0)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * 0.5d0) - y) * sqrt((exp((t ** 2.0d0)) * (z * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((Math.exp(Math.pow(t, 2.0)) * (z * 2.0)));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((math.exp(math.pow(t, 2.0)) * (z * 2.0)))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(exp((t ^ 2.0)) * Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((exp((t ^ 2.0)) * (z * 2.0))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[Exp[N[Power[t, 2.0], $MachinePrecision]], $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{e^{{t}^{2}} \cdot \left(z \cdot 2\right)}
\end{array}
Initial program 99.8%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.9%
associate-*l*99.9%
pow-exp99.9%
pow299.9%
Applied egg-rr99.9%
unpow199.9%
associate-*r*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= (* t t) 0.0005)
(* t_1 (sqrt (+ (* z 2.0) (* (* t t) (+ (* z 2.0) (* z (* t t)))))))
(if (<= (* t t) 2e+138)
(* (exp (/ (* t t) 2.0)) (* x (* 0.5 (sqrt (* z 2.0)))))
(* t_1 (sqrt (+ (* z 2.0) (* z (pow t 4.0)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 0.0005) {
tmp = t_1 * sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (t * t))))));
} else if ((t * t) <= 2e+138) {
tmp = exp(((t * t) / 2.0)) * (x * (0.5 * sqrt((z * 2.0))));
} else {
tmp = t_1 * sqrt(((z * 2.0) + (z * pow(t, 4.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) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if ((t * t) <= 0.0005d0) then
tmp = t_1 * sqrt(((z * 2.0d0) + ((t * t) * ((z * 2.0d0) + (z * (t * t))))))
else if ((t * t) <= 2d+138) then
tmp = exp(((t * t) / 2.0d0)) * (x * (0.5d0 * sqrt((z * 2.0d0))))
else
tmp = t_1 * sqrt(((z * 2.0d0) + (z * (t ** 4.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if ((t * t) <= 0.0005) {
tmp = t_1 * Math.sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (t * t))))));
} else if ((t * t) <= 2e+138) {
tmp = Math.exp(((t * t) / 2.0)) * (x * (0.5 * Math.sqrt((z * 2.0))));
} else {
tmp = t_1 * Math.sqrt(((z * 2.0) + (z * Math.pow(t, 4.0))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if (t * t) <= 0.0005: tmp = t_1 * math.sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (t * t)))))) elif (t * t) <= 2e+138: tmp = math.exp(((t * t) / 2.0)) * (x * (0.5 * math.sqrt((z * 2.0)))) else: tmp = t_1 * math.sqrt(((z * 2.0) + (z * math.pow(t, 4.0)))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (Float64(t * t) <= 0.0005) tmp = Float64(t_1 * sqrt(Float64(Float64(z * 2.0) + Float64(Float64(t * t) * Float64(Float64(z * 2.0) + Float64(z * Float64(t * t))))))); elseif (Float64(t * t) <= 2e+138) tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(x * Float64(0.5 * sqrt(Float64(z * 2.0))))); else tmp = Float64(t_1 * sqrt(Float64(Float64(z * 2.0) + Float64(z * (t ^ 4.0))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if ((t * t) <= 0.0005) tmp = t_1 * sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (t * t)))))); elseif ((t * t) <= 2e+138) tmp = exp(((t * t) / 2.0)) * (x * (0.5 * sqrt((z * 2.0)))); else tmp = t_1 * sqrt(((z * 2.0) + (z * (t ^ 4.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[N[(t * t), $MachinePrecision], 0.0005], N[(t$95$1 * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] * N[(N[(z * 2.0), $MachinePrecision] + N[(z * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * t), $MachinePrecision], 2e+138], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(x * N[(0.5 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] + N[(z * N[Power[t, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \cdot t \leq 0.0005:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot 2 + \left(t \cdot t\right) \cdot \left(z \cdot 2 + z \cdot \left(t \cdot t\right)\right)}\\
\mathbf{elif}\;t \cdot t \leq 2 \cdot 10^{+138}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot 2 + z \cdot {t}^{4}}\\
\end{array}
\end{array}
if (*.f64 t t) < 5.0000000000000001e-4Initial program 99.7%
associate-*l*99.7%
remove-double-neg99.7%
remove-double-neg99.7%
exp-sqrt99.7%
exp-prod99.7%
Simplified99.7%
pow199.7%
sqrt-unprod99.7%
associate-*l*99.7%
pow-exp99.7%
pow299.7%
Applied egg-rr99.7%
unpow199.7%
associate-*r*99.7%
Simplified99.7%
Taylor expanded in t around 0 99.7%
unpow299.7%
Applied egg-rr99.7%
unpow299.7%
Applied egg-rr99.7%
if 5.0000000000000001e-4 < (*.f64 t t) < 2.0000000000000001e138Initial program 100.0%
Taylor expanded in x around inf 74.3%
*-commutative74.3%
*-commutative74.3%
*-commutative74.3%
associate-*r*74.3%
sqrt-prod74.3%
associate-*r*74.3%
*-commutative74.3%
pow174.3%
associate-*l*74.3%
Applied egg-rr74.3%
unpow174.3%
*-commutative74.3%
Simplified74.3%
if 2.0000000000000001e138 < (*.f64 t t) Initial program 100.0%
associate-*l*100.0%
remove-double-neg100.0%
remove-double-neg100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
pow1100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
unpow1100.0%
associate-*r*100.0%
Simplified100.0%
Taylor expanded in t around 0 96.7%
Taylor expanded in t around inf 97.8%
Final simplification95.6%
(FPCore (x y z t)
:precision binary64
(if (or (<= (* t t) 0.0005) (not (<= (* t t) 2e+138)))
(*
(- (* x 0.5) y)
(sqrt (+ (* z 2.0) (* (* t t) (+ (* z 2.0) (* z (* t t)))))))
(* (exp (/ (* t t) 2.0)) (* x (* 0.5 (sqrt (* z 2.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (((t * t) <= 0.0005) || !((t * t) <= 2e+138)) {
tmp = ((x * 0.5) - y) * sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (t * t))))));
} else {
tmp = exp(((t * t) / 2.0)) * (x * (0.5 * sqrt((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 * t) <= 0.0005d0) .or. (.not. ((t * t) <= 2d+138))) then
tmp = ((x * 0.5d0) - y) * sqrt(((z * 2.0d0) + ((t * t) * ((z * 2.0d0) + (z * (t * t))))))
else
tmp = exp(((t * t) / 2.0d0)) * (x * (0.5d0 * sqrt((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 * t) <= 0.0005) || !((t * t) <= 2e+138)) {
tmp = ((x * 0.5) - y) * Math.sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (t * t))))));
} else {
tmp = Math.exp(((t * t) / 2.0)) * (x * (0.5 * Math.sqrt((z * 2.0))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((t * t) <= 0.0005) or not ((t * t) <= 2e+138): tmp = ((x * 0.5) - y) * math.sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (t * t)))))) else: tmp = math.exp(((t * t) / 2.0)) * (x * (0.5 * math.sqrt((z * 2.0)))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(t * t) <= 0.0005) || !(Float64(t * t) <= 2e+138)) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(z * 2.0) + Float64(Float64(t * t) * Float64(Float64(z * 2.0) + Float64(z * Float64(t * t))))))); else tmp = Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(x * Float64(0.5 * sqrt(Float64(z * 2.0))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((t * t) <= 0.0005) || ~(((t * t) <= 2e+138))) tmp = ((x * 0.5) - y) * sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (t * t)))))); else tmp = exp(((t * t) / 2.0)) * (x * (0.5 * sqrt((z * 2.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(t * t), $MachinePrecision], 0.0005], N[Not[LessEqual[N[(t * t), $MachinePrecision], 2e+138]], $MachinePrecision]], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] * N[(N[(z * 2.0), $MachinePrecision] + N[(z * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(x * N[(0.5 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 0.0005 \lor \neg \left(t \cdot t \leq 2 \cdot 10^{+138}\right):\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2 + \left(t \cdot t\right) \cdot \left(z \cdot 2 + z \cdot \left(t \cdot t\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\frac{t \cdot t}{2}} \cdot \left(x \cdot \left(0.5 \cdot \sqrt{z \cdot 2}\right)\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 5.0000000000000001e-4 or 2.0000000000000001e138 < (*.f64 t t) Initial program 99.8%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow-exp99.8%
pow299.8%
Applied egg-rr99.8%
unpow199.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in t around 0 98.5%
unpow298.5%
Applied egg-rr98.5%
unpow298.5%
Applied egg-rr98.5%
if 5.0000000000000001e-4 < (*.f64 t t) < 2.0000000000000001e138Initial program 100.0%
Taylor expanded in x around inf 74.3%
*-commutative74.3%
*-commutative74.3%
*-commutative74.3%
associate-*r*74.3%
sqrt-prod74.3%
associate-*r*74.3%
*-commutative74.3%
pow174.3%
associate-*l*74.3%
Applied egg-rr74.3%
unpow174.3%
*-commutative74.3%
Simplified74.3%
Final simplification95.2%
(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%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (+ (* z 2.0) (* (* t t) (+ (* z 2.0) (* z (* t t))))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (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) + ((t * t) * ((z * 2.0d0) + (z * (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) + ((t * t) * ((z * 2.0) + (z * (t * t))))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (t * t))))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(z * 2.0) + Float64(Float64(t * t) * Float64(Float64(z * 2.0) + Float64(z * Float64(t * t))))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt(((z * 2.0) + ((t * t) * ((z * 2.0) + (z * (t * t)))))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] + N[(N[(t * t), $MachinePrecision] * N[(N[(z * 2.0), $MachinePrecision] + N[(z * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2 + \left(t \cdot t\right) \cdot \left(z \cdot 2 + z \cdot \left(t \cdot t\right)\right)}
\end{array}
Initial program 99.8%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.9%
associate-*l*99.9%
pow-exp99.9%
pow299.9%
Applied egg-rr99.9%
unpow199.9%
associate-*r*99.9%
Simplified99.9%
Taylor expanded in t around 0 89.5%
unpow289.5%
Applied egg-rr89.5%
unpow289.5%
Applied egg-rr89.5%
Final simplification89.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= x -7.2e-59) (not (<= x 12000.0)))
(* t_1 (* x 0.5))
(* y (- t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((x <= -7.2e-59) || !(x <= 12000.0)) {
tmp = t_1 * (x * 0.5);
} else {
tmp = y * -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((z * 2.0d0))
if ((x <= (-7.2d-59)) .or. (.not. (x <= 12000.0d0))) then
tmp = t_1 * (x * 0.5d0)
else
tmp = y * -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((z * 2.0));
double tmp;
if ((x <= -7.2e-59) || !(x <= 12000.0)) {
tmp = t_1 * (x * 0.5);
} else {
tmp = y * -t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (x <= -7.2e-59) or not (x <= 12000.0): tmp = t_1 * (x * 0.5) else: tmp = y * -t_1 return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if ((x <= -7.2e-59) || !(x <= 12000.0)) tmp = Float64(t_1 * Float64(x * 0.5)); else tmp = Float64(y * Float64(-t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((x <= -7.2e-59) || ~((x <= 12000.0))) tmp = t_1 * (x * 0.5); else tmp = y * -t_1; 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, -7.2e-59], N[Not[LessEqual[x, 12000.0]], $MachinePrecision]], N[(t$95$1 * N[(x * 0.5), $MachinePrecision]), $MachinePrecision], N[(y * (-t$95$1)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{-59} \lor \neg \left(x \leq 12000\right):\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-t\_1\right)\\
\end{array}
\end{array}
if x < -7.20000000000000001e-59 or 12000 < x Initial program 99.8%
Taylor expanded in t around 0 61.2%
Taylor expanded in x around inf 45.3%
if -7.20000000000000001e-59 < x < 12000Initial program 99.8%
Taylor expanded in t around 0 55.6%
Taylor expanded in x around 0 44.9%
mul-1-neg44.9%
Simplified44.9%
*-rgt-identity44.9%
distribute-lft-neg-out44.9%
neg-sub044.9%
*-commutative44.9%
Applied egg-rr44.9%
neg-sub044.9%
distribute-rgt-neg-in44.9%
*-commutative44.9%
Simplified44.9%
Final simplification45.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (sqrt (* z 2.0)))) (if (<= t 4.2e-9) (* (- (* x 0.5) y) t_1) (* 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 <= 4.2e-9) {
tmp = ((x * 0.5) - y) * t_1;
} 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 <= 4.2d-9) then
tmp = ((x * 0.5d0) - y) * t_1
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 <= 4.2e-9) {
tmp = ((x * 0.5) - y) * t_1;
} 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 <= 4.2e-9: tmp = ((x * 0.5) - y) * t_1 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 <= 4.2e-9) tmp = Float64(Float64(Float64(x * 0.5) - y) * t_1); 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 <= 4.2e-9) tmp = ((x * 0.5) - y) * t_1; 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, 4.2e-9], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * t$95$1), $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 4.2 \cdot 10^{-9}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(x \cdot \left(0.5 - \frac{y}{x}\right)\right)\\
\end{array}
\end{array}
if t < 4.20000000000000039e-9Initial program 99.8%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.8%
associate-*l*99.8%
pow-exp99.8%
pow299.8%
Applied egg-rr99.8%
unpow199.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in t around 0 73.4%
if 4.20000000000000039e-9 < t Initial program 100.0%
Taylor expanded in t around 0 21.5%
Taylor expanded in x around inf 32.1%
mul-1-neg32.1%
unsub-neg32.1%
Simplified32.1%
Final simplification61.8%
(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%
associate-*l*99.8%
remove-double-neg99.8%
remove-double-neg99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
pow199.8%
sqrt-unprod99.9%
associate-*l*99.9%
pow-exp99.9%
pow299.9%
Applied egg-rr99.9%
unpow199.9%
associate-*r*99.9%
Simplified99.9%
Taylor expanded in t around 0 58.8%
Final simplification58.8%
(FPCore (x y z t) :precision binary64 (* y (- (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
return 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 = y * -sqrt((z * 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return y * -Math.sqrt((z * 2.0));
}
def code(x, y, z, t): return y * -math.sqrt((z * 2.0))
function code(x, y, z, t) return Float64(y * Float64(-sqrt(Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = y * -sqrt((z * 2.0)); end
code[x_, y_, z_, t_] := N[(y * (-N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(-\sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 58.8%
Taylor expanded in x around 0 29.5%
mul-1-neg29.5%
Simplified29.5%
*-rgt-identity29.5%
distribute-lft-neg-out29.5%
neg-sub029.5%
*-commutative29.5%
Applied egg-rr29.5%
neg-sub029.5%
distribute-rgt-neg-in29.5%
*-commutative29.5%
Simplified29.5%
(FPCore (x y z t) :precision binary64 (* y (sqrt (* z 2.0))))
double code(double x, double y, double z, double t) {
return 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 = y * sqrt((z * 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return y * Math.sqrt((z * 2.0));
}
def code(x, y, z, t): return y * math.sqrt((z * 2.0))
function code(x, y, z, t) return Float64(y * sqrt(Float64(z * 2.0))) end
function tmp = code(x, y, z, t) tmp = y * sqrt((z * 2.0)); end
code[x_, y_, z_, t_] := N[(y * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \sqrt{z \cdot 2}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0 58.8%
Taylor expanded in x around 0 29.5%
mul-1-neg29.5%
Simplified29.5%
pow129.5%
*-rgt-identity29.5%
add-sqr-sqrt12.9%
sqrt-unprod14.8%
sqr-neg14.8%
sqrt-unprod1.4%
add-sqr-sqrt3.0%
*-commutative3.0%
Applied egg-rr3.0%
unpow13.0%
*-commutative3.0%
Simplified3.0%
(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 2024180
(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))))