
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* z (* 2.0 (exp (pow t 2.0)))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((z * (2.0 * exp(pow(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 ** 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(Math.pow(t, 2.0)))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((z * (2.0 * math.exp(math.pow(t, 2.0)))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * Float64(2.0 * exp((t ^ 2.0)))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((z * (2.0 * exp((t ^ 2.0))))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * N[(2.0 * N[Exp[N[Power[t, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot \left(2 \cdot e^{{t}^{2}}\right)}
\end{array}
Initial program 99.4%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
expm1-log1p-u98.6%
expm1-udef74.4%
sqrt-unprod74.4%
associate-*l*74.4%
pow-exp74.4%
pow274.4%
Applied egg-rr74.4%
expm1-def98.6%
expm1-log1p99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 65.0)
(* t_1 (sqrt (* z 2.0)))
(if (<= t 1.42e+79)
(sqrt (* (pow y 2.0) (* z 2.0)))
(* t_1 (* 2.0 (sqrt (/ (pow z 2.0) (* z 2.0)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 65.0) {
tmp = t_1 * sqrt((z * 2.0));
} else if (t <= 1.42e+79) {
tmp = sqrt((pow(y, 2.0) * (z * 2.0)));
} else {
tmp = t_1 * (2.0 * sqrt((pow(z, 2.0) / (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) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if (t <= 65.0d0) then
tmp = t_1 * sqrt((z * 2.0d0))
else if (t <= 1.42d+79) then
tmp = sqrt(((y ** 2.0d0) * (z * 2.0d0)))
else
tmp = t_1 * (2.0d0 * sqrt(((z ** 2.0d0) / (z * 2.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 <= 65.0) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else if (t <= 1.42e+79) {
tmp = Math.sqrt((Math.pow(y, 2.0) * (z * 2.0)));
} else {
tmp = t_1 * (2.0 * Math.sqrt((Math.pow(z, 2.0) / (z * 2.0))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 65.0: tmp = t_1 * math.sqrt((z * 2.0)) elif t <= 1.42e+79: tmp = math.sqrt((math.pow(y, 2.0) * (z * 2.0))) else: tmp = t_1 * (2.0 * math.sqrt((math.pow(z, 2.0) / (z * 2.0)))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 65.0) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); elseif (t <= 1.42e+79) tmp = sqrt(Float64((y ^ 2.0) * Float64(z * 2.0))); else tmp = Float64(t_1 * Float64(2.0 * sqrt(Float64((z ^ 2.0) / Float64(z * 2.0))))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * 0.5) - y; tmp = 0.0; if (t <= 65.0) tmp = t_1 * sqrt((z * 2.0)); elseif (t <= 1.42e+79) tmp = sqrt(((y ^ 2.0) * (z * 2.0))); else tmp = t_1 * (2.0 * sqrt(((z ^ 2.0) / (z * 2.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[t, 65.0], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.42e+79], N[Sqrt[N[(N[Power[y, 2.0], $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$1 * N[(2.0 * N[Sqrt[N[(N[Power[z, 2.0], $MachinePrecision] / N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 65:\\
\;\;\;\;t_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{elif}\;t \leq 1.42 \cdot 10^{+79}:\\
\;\;\;\;\sqrt{{y}^{2} \cdot \left(z \cdot 2\right)}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(2 \cdot \sqrt{\frac{{z}^{2}}{z \cdot 2}}\right)\\
\end{array}
\end{array}
if t < 65Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 69.5%
if 65 < t < 1.41999999999999998e79Initial program 94.1%
*-commutative94.1%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 15.5%
Taylor expanded in x around 0 8.7%
mul-1-neg8.7%
associate-*l*8.7%
distribute-rgt-neg-in8.7%
Simplified8.7%
expm1-log1p-u2.8%
expm1-udef2.8%
Applied egg-rr1.2%
expm1-def1.2%
expm1-log1p1.7%
Simplified1.7%
add-sqr-sqrt1.0%
sqrt-unprod31.0%
*-commutative31.0%
*-commutative31.0%
swap-sqr53.7%
add-sqr-sqrt53.7%
*-commutative53.7%
pow253.7%
Applied egg-rr53.7%
*-commutative53.7%
Simplified53.7%
if 1.41999999999999998e79 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
Taylor expanded in t around 0 8.4%
add-cbrt-cube18.3%
sqrt-prod18.3%
sqrt-prod18.3%
add-sqr-sqrt18.3%
pow118.3%
sqrt-prod18.3%
pow1/218.3%
pow-prod-up18.3%
metadata-eval18.3%
pow1/318.3%
Applied egg-rr18.3%
pow-pow8.4%
*-commutative8.4%
metadata-eval8.4%
metadata-eval8.4%
pow-div8.4%
pow18.4%
pow1/28.4%
*-un-lft-identity8.4%
times-frac8.4%
metadata-eval8.4%
*-commutative8.4%
Applied egg-rr8.4%
add-sqr-sqrt8.4%
sqrt-unprod8.4%
frac-times30.3%
pow230.3%
add-sqr-sqrt30.3%
*-commutative30.3%
Applied egg-rr30.3%
Final simplification61.2%
(FPCore (x y z t) :precision binary64 (* (exp (/ (* t t) 2.0)) (* (- (* x 0.5) y) (sqrt (* z 2.0)))))
double code(double x, double y, double z, double t) {
return exp(((t * t) / 2.0)) * (((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 = exp(((t * t) / 2.0d0)) * (((x * 0.5d0) - y) * sqrt((z * 2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return Math.exp(((t * t) / 2.0)) * (((x * 0.5) - y) * Math.sqrt((z * 2.0)));
}
def code(x, y, z, t): return math.exp(((t * t) / 2.0)) * (((x * 0.5) - y) * math.sqrt((z * 2.0)))
function code(x, y, z, t) return Float64(exp(Float64(Float64(t * t) / 2.0)) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0)))) end
function tmp = code(x, y, z, t) tmp = exp(((t * t) / 2.0)) * (((x * 0.5) - y) * sqrt((z * 2.0))); end
code[x_, y_, z_, t_] := N[(N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\frac{t \cdot t}{2}} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right)
\end{array}
Initial program 99.4%
Final simplification99.4%
(FPCore (x y z t)
:precision binary64
(if (<= t 20.0)
(* (- (* x 0.5) y) (sqrt (* z 2.0)))
(if (<= t 3.8e+79)
(sqrt (* (pow y 2.0) (* z 2.0)))
(if (<= t 2.85e+230)
(* (pow (pow (* z 2.0) 1.5) 0.3333333333333333) (- y))
(sqrt (* z (* 0.5 (pow x 2.0))))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 20.0) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else if (t <= 3.8e+79) {
tmp = sqrt((pow(y, 2.0) * (z * 2.0)));
} else if (t <= 2.85e+230) {
tmp = pow(pow((z * 2.0), 1.5), 0.3333333333333333) * -y;
} else {
tmp = sqrt((z * (0.5 * pow(x, 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 <= 20.0d0) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else if (t <= 3.8d+79) then
tmp = sqrt(((y ** 2.0d0) * (z * 2.0d0)))
else if (t <= 2.85d+230) then
tmp = (((z * 2.0d0) ** 1.5d0) ** 0.3333333333333333d0) * -y
else
tmp = sqrt((z * (0.5d0 * (x ** 2.0d0))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 20.0) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else if (t <= 3.8e+79) {
tmp = Math.sqrt((Math.pow(y, 2.0) * (z * 2.0)));
} else if (t <= 2.85e+230) {
tmp = Math.pow(Math.pow((z * 2.0), 1.5), 0.3333333333333333) * -y;
} else {
tmp = Math.sqrt((z * (0.5 * Math.pow(x, 2.0))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 20.0: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) elif t <= 3.8e+79: tmp = math.sqrt((math.pow(y, 2.0) * (z * 2.0))) elif t <= 2.85e+230: tmp = math.pow(math.pow((z * 2.0), 1.5), 0.3333333333333333) * -y else: tmp = math.sqrt((z * (0.5 * math.pow(x, 2.0)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 20.0) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); elseif (t <= 3.8e+79) tmp = sqrt(Float64((y ^ 2.0) * Float64(z * 2.0))); elseif (t <= 2.85e+230) tmp = Float64(((Float64(z * 2.0) ^ 1.5) ^ 0.3333333333333333) * Float64(-y)); else tmp = sqrt(Float64(z * Float64(0.5 * (x ^ 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 20.0) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); elseif (t <= 3.8e+79) tmp = sqrt(((y ^ 2.0) * (z * 2.0))); elseif (t <= 2.85e+230) tmp = (((z * 2.0) ^ 1.5) ^ 0.3333333333333333) * -y; else tmp = sqrt((z * (0.5 * (x ^ 2.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 20.0], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.8e+79], N[Sqrt[N[(N[Power[y, 2.0], $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t, 2.85e+230], N[(N[Power[N[Power[N[(z * 2.0), $MachinePrecision], 1.5], $MachinePrecision], 0.3333333333333333], $MachinePrecision] * (-y)), $MachinePrecision], N[Sqrt[N[(z * N[(0.5 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 20:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{+79}:\\
\;\;\;\;\sqrt{{y}^{2} \cdot \left(z \cdot 2\right)}\\
\mathbf{elif}\;t \leq 2.85 \cdot 10^{+230}:\\
\;\;\;\;{\left({\left(z \cdot 2\right)}^{1.5}\right)}^{0.3333333333333333} \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z \cdot \left(0.5 \cdot {x}^{2}\right)}\\
\end{array}
\end{array}
if t < 20Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 69.5%
if 20 < t < 3.8000000000000002e79Initial program 94.1%
*-commutative94.1%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 15.5%
Taylor expanded in x around 0 8.7%
mul-1-neg8.7%
associate-*l*8.7%
distribute-rgt-neg-in8.7%
Simplified8.7%
expm1-log1p-u2.8%
expm1-udef2.8%
Applied egg-rr1.2%
expm1-def1.2%
expm1-log1p1.7%
Simplified1.7%
add-sqr-sqrt1.0%
sqrt-unprod31.0%
*-commutative31.0%
*-commutative31.0%
swap-sqr53.7%
add-sqr-sqrt53.7%
*-commutative53.7%
pow253.7%
Applied egg-rr53.7%
*-commutative53.7%
Simplified53.7%
if 3.8000000000000002e79 < t < 2.8500000000000001e230Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 10.7%
Taylor expanded in x around 0 9.1%
mul-1-neg9.1%
associate-*l*9.1%
distribute-rgt-neg-in9.1%
Simplified9.1%
*-commutative9.1%
sqrt-prod9.1%
pow1/29.1%
metadata-eval9.1%
pow-pow15.1%
Applied egg-rr15.1%
if 2.8500000000000001e230 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 3.8%
Taylor expanded in x around inf 3.2%
add-sqr-sqrt0.9%
sqrt-unprod7.7%
*-commutative7.7%
*-commutative7.7%
swap-sqr7.7%
*-commutative7.7%
*-commutative7.7%
swap-sqr19.7%
add-sqr-sqrt19.7%
*-commutative19.7%
*-commutative19.7%
swap-sqr19.7%
rem-square-sqrt19.7%
pow219.7%
metadata-eval19.7%
Applied egg-rr19.7%
associate-*l*19.7%
*-commutative19.7%
associate-*l*19.7%
metadata-eval19.7%
Simplified19.7%
Final simplification58.7%
(FPCore (x y z t)
:precision binary64
(if (<= t 27.0)
(* (- (* x 0.5) y) (sqrt (* z 2.0)))
(if (<= t 6.3e+78)
(sqrt (* (pow y 2.0) (* z 2.0)))
(* (pow (pow (* z 2.0) 3.0) 0.16666666666666666) (- y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 27.0) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else if (t <= 6.3e+78) {
tmp = sqrt((pow(y, 2.0) * (z * 2.0)));
} else {
tmp = pow(pow((z * 2.0), 3.0), 0.16666666666666666) * -y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 27.0d0) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else if (t <= 6.3d+78) then
tmp = sqrt(((y ** 2.0d0) * (z * 2.0d0)))
else
tmp = (((z * 2.0d0) ** 3.0d0) ** 0.16666666666666666d0) * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 27.0) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else if (t <= 6.3e+78) {
tmp = Math.sqrt((Math.pow(y, 2.0) * (z * 2.0)));
} else {
tmp = Math.pow(Math.pow((z * 2.0), 3.0), 0.16666666666666666) * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 27.0: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) elif t <= 6.3e+78: tmp = math.sqrt((math.pow(y, 2.0) * (z * 2.0))) else: tmp = math.pow(math.pow((z * 2.0), 3.0), 0.16666666666666666) * -y return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 27.0) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); elseif (t <= 6.3e+78) tmp = sqrt(Float64((y ^ 2.0) * Float64(z * 2.0))); else tmp = Float64(((Float64(z * 2.0) ^ 3.0) ^ 0.16666666666666666) * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 27.0) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); elseif (t <= 6.3e+78) tmp = sqrt(((y ^ 2.0) * (z * 2.0))); else tmp = (((z * 2.0) ^ 3.0) ^ 0.16666666666666666) * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 27.0], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.3e+78], N[Sqrt[N[(N[Power[y, 2.0], $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Power[N[Power[N[(z * 2.0), $MachinePrecision], 3.0], $MachinePrecision], 0.16666666666666666], $MachinePrecision] * (-y)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 27:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{elif}\;t \leq 6.3 \cdot 10^{+78}:\\
\;\;\;\;\sqrt{{y}^{2} \cdot \left(z \cdot 2\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left({\left(z \cdot 2\right)}^{3}\right)}^{0.16666666666666666} \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < 27Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 69.5%
if 27 < t < 6.3000000000000002e78Initial program 94.1%
*-commutative94.1%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 15.5%
Taylor expanded in x around 0 8.7%
mul-1-neg8.7%
associate-*l*8.7%
distribute-rgt-neg-in8.7%
Simplified8.7%
expm1-log1p-u2.8%
expm1-udef2.8%
Applied egg-rr1.2%
expm1-def1.2%
expm1-log1p1.7%
Simplified1.7%
add-sqr-sqrt1.0%
sqrt-unprod31.0%
*-commutative31.0%
*-commutative31.0%
swap-sqr53.7%
add-sqr-sqrt53.7%
*-commutative53.7%
pow253.7%
Applied egg-rr53.7%
*-commutative53.7%
Simplified53.7%
if 6.3000000000000002e78 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 8.4%
Taylor expanded in x around 0 6.7%
mul-1-neg6.7%
associate-*l*6.7%
distribute-rgt-neg-in6.7%
Simplified6.7%
*-commutative6.7%
sqrt-prod6.7%
pow1/26.7%
metadata-eval6.7%
pow-pow12.7%
sqr-pow12.7%
pow-prod-down20.7%
*-commutative20.7%
*-commutative20.7%
pow-prod-up20.7%
*-commutative20.7%
metadata-eval20.7%
metadata-eval20.7%
Applied egg-rr20.7%
Final simplification59.5%
(FPCore (x y z t) :precision binary64 (if (<= t 1.85e+72) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (sqrt (* z (* 0.5 (pow x 2.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.85e+72) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt((z * (0.5 * pow(x, 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.85d+72) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt((z * (0.5d0 * (x ** 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.85e+72) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt((z * (0.5 * Math.pow(x, 2.0))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.85e+72: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt((z * (0.5 * math.pow(x, 2.0)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.85e+72) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(z * Float64(0.5 * (x ^ 2.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.85e+72) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = sqrt((z * (0.5 * (x ^ 2.0)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.85e+72], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(z * N[(0.5 * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.85 \cdot 10^{+72}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z \cdot \left(0.5 \cdot {x}^{2}\right)}\\
\end{array}
\end{array}
if t < 1.8500000000000001e72Initial program 99.3%
*-commutative99.3%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 65.7%
if 1.8500000000000001e72 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 8.2%
Taylor expanded in x around inf 4.9%
add-sqr-sqrt1.0%
sqrt-unprod11.4%
*-commutative11.4%
*-commutative11.4%
swap-sqr11.4%
*-commutative11.4%
*-commutative11.4%
swap-sqr17.3%
add-sqr-sqrt17.3%
*-commutative17.3%
*-commutative17.3%
swap-sqr17.3%
rem-square-sqrt17.3%
pow217.3%
metadata-eval17.3%
Applied egg-rr17.3%
associate-*l*17.3%
*-commutative17.3%
associate-*l*17.3%
metadata-eval17.3%
Simplified17.3%
Final simplification56.4%
(FPCore (x y z t) :precision binary64 (if (<= t 14.6) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (sqrt (* (pow y 2.0) (* z 2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 14.6) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt((pow(y, 2.0) * (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 <= 14.6d0) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = sqrt(((y ** 2.0d0) * (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 <= 14.6) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt((Math.pow(y, 2.0) * (z * 2.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 14.6: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = math.sqrt((math.pow(y, 2.0) * (z * 2.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 14.6) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64((y ^ 2.0) * Float64(z * 2.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 14.6) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = sqrt(((y ^ 2.0) * (z * 2.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 14.6], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[Power[y, 2.0], $MachinePrecision] * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 14.6:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{{y}^{2} \cdot \left(z \cdot 2\right)}\\
\end{array}
\end{array}
if t < 14.5999999999999996Initial program 99.7%
*-commutative99.7%
associate-*l*99.7%
exp-sqrt99.7%
Simplified99.7%
Taylor expanded in t around 0 69.5%
if 14.5999999999999996 < t Initial program 98.4%
*-commutative98.4%
associate-*l*100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 10.3%
Taylor expanded in x around 0 7.2%
mul-1-neg7.2%
associate-*l*7.2%
distribute-rgt-neg-in7.2%
Simplified7.2%
expm1-log1p-u3.6%
expm1-udef3.5%
Applied egg-rr1.0%
expm1-def1.0%
expm1-log1p1.3%
Simplified1.3%
add-sqr-sqrt0.7%
sqrt-unprod13.9%
*-commutative13.9%
*-commutative13.9%
swap-sqr19.9%
add-sqr-sqrt19.9%
*-commutative19.9%
pow219.9%
Applied egg-rr19.9%
*-commutative19.9%
Simplified19.9%
Final simplification57.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= y -3.8e+16) (not (<= y 1.85e-38)))
(* y (- t_1))
(* 0.5 (* x t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((y <= -3.8e+16) || !(y <= 1.85e-38)) {
tmp = y * -t_1;
} else {
tmp = 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((z * 2.0d0))
if ((y <= (-3.8d+16)) .or. (.not. (y <= 1.85d-38))) then
tmp = y * -t_1
else
tmp = 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((z * 2.0));
double tmp;
if ((y <= -3.8e+16) || !(y <= 1.85e-38)) {
tmp = y * -t_1;
} else {
tmp = 0.5 * (x * t_1);
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (y <= -3.8e+16) or not (y <= 1.85e-38): tmp = y * -t_1 else: tmp = 0.5 * (x * t_1) return tmp
function code(x, y, z, t) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if ((y <= -3.8e+16) || !(y <= 1.85e-38)) tmp = Float64(y * Float64(-t_1)); else tmp = Float64(0.5 * Float64(x * t_1)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = sqrt((z * 2.0)); tmp = 0.0; if ((y <= -3.8e+16) || ~((y <= 1.85e-38))) tmp = y * -t_1; else tmp = 0.5 * (x * 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[y, -3.8e+16], N[Not[LessEqual[y, 1.85e-38]], $MachinePrecision]], N[(y * (-t$95$1)), $MachinePrecision], N[(0.5 * N[(x * t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;y \leq -3.8 \cdot 10^{+16} \lor \neg \left(y \leq 1.85 \cdot 10^{-38}\right):\\
\;\;\;\;y \cdot \left(-t_1\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot t_1\right)\\
\end{array}
\end{array}
if y < -3.8e16 or 1.85e-38 < y Initial program 99.8%
*-commutative99.8%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 56.0%
Taylor expanded in x around 0 43.4%
mul-1-neg43.4%
associate-*l*43.5%
distribute-rgt-neg-in43.5%
Simplified43.5%
sqrt-prod43.6%
distribute-rgt-neg-out43.6%
neg-sub043.6%
*-commutative43.6%
Applied egg-rr43.6%
neg-sub043.6%
*-commutative43.6%
distribute-rgt-neg-in43.6%
Simplified43.6%
if -3.8e16 < y < 1.85e-38Initial program 99.0%
*-commutative99.0%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 53.2%
Taylor expanded in x around inf 44.5%
expm1-log1p-u29.6%
expm1-udef18.7%
*-commutative18.7%
*-commutative18.7%
associate-*r*18.7%
sqrt-prod18.7%
*-commutative18.7%
*-commutative18.7%
Applied egg-rr18.7%
expm1-def29.7%
expm1-log1p44.6%
Simplified44.6%
Final simplification44.1%
(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.4%
*-commutative99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 54.7%
Final simplification54.7%
(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.4%
*-commutative99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 54.7%
Taylor expanded in x around 0 28.1%
mul-1-neg28.1%
associate-*l*28.1%
distribute-rgt-neg-in28.1%
Simplified28.1%
sqrt-prod28.2%
distribute-rgt-neg-out28.2%
neg-sub028.2%
*-commutative28.2%
Applied egg-rr28.2%
neg-sub028.2%
*-commutative28.2%
distribute-rgt-neg-in28.2%
Simplified28.2%
Final simplification28.2%
(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.4%
*-commutative99.4%
associate-*l*99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 54.7%
Taylor expanded in x around 0 28.1%
mul-1-neg28.1%
associate-*l*28.1%
distribute-rgt-neg-in28.1%
Simplified28.1%
expm1-log1p-u16.5%
expm1-udef10.6%
Applied egg-rr2.4%
expm1-def2.5%
expm1-log1p2.8%
Simplified2.8%
Final simplification2.8%
(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 2023322
(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))))