
(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 13 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(Float64(z * 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[(N[(z * 2.0), $MachinePrecision] * N[Exp[N[Power[t, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot e^{{t}^{2}}}
\end{array}
Initial program 98.7%
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%
(FPCore (x y z t)
:precision binary64
(if (<= t 0.00025)
(* (- (* x 0.5) y) (sqrt (* z 2.0)))
(if (<= t 2.65e+77)
(* (* x (- 0.5 (/ y x))) (exp (* 0.5 (log (* z 2.0)))))
(* (sqrt (* (* z 2.0) (fma t t 1.0))) (* x 0.5)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 0.00025) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else if (t <= 2.65e+77) {
tmp = (x * (0.5 - (y / x))) * exp((0.5 * log((z * 2.0))));
} else {
tmp = sqrt(((z * 2.0) * fma(t, t, 1.0))) * (x * 0.5);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 0.00025) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); elseif (t <= 2.65e+77) tmp = Float64(Float64(x * Float64(0.5 - Float64(y / x))) * exp(Float64(0.5 * log(Float64(z * 2.0))))); else tmp = Float64(sqrt(Float64(Float64(z * 2.0) * fma(t, t, 1.0))) * Float64(x * 0.5)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 0.00025], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.65e+77], N[(N[(x * N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Exp[N[(0.5 * N[Log[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 0.00025:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{elif}\;t \leq 2.65 \cdot 10^{+77}:\\
\;\;\;\;\left(x \cdot \left(0.5 - \frac{y}{x}\right)\right) \cdot e^{0.5 \cdot \log \left(z \cdot 2\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \mathsf{fma}\left(t, t, 1\right)} \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if t < 2.5000000000000001e-4Initial program 99.3%
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 74.2%
*-commutative74.2%
Simplified74.2%
if 2.5000000000000001e-4 < t < 2.65e77Initial program 91.7%
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 19.5%
*-commutative19.5%
Simplified19.5%
pow1/219.5%
pow-to-exp19.5%
Applied egg-rr19.5%
Taylor expanded in x around inf 19.5%
mul-1-neg19.5%
unsub-neg19.5%
Simplified19.5%
if 2.65e77 < t Initial program 98.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 78.7%
+-commutative78.7%
unpow278.7%
fma-define78.7%
Simplified78.7%
Taylor expanded in x around inf 63.8%
Final simplification69.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 31.0)
(* t_1 (sqrt (* z 2.0)))
(if (<= t 2.7e+100)
(sqrt (* z (* 2.0 (pow t_1 2.0))))
(* (sqrt (* (* z 2.0) (fma t t 1.0))) (- y))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 31.0) {
tmp = t_1 * sqrt((z * 2.0));
} else if (t <= 2.7e+100) {
tmp = sqrt((z * (2.0 * pow(t_1, 2.0))));
} else {
tmp = sqrt(((z * 2.0) * fma(t, t, 1.0))) * -y;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 31.0) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); elseif (t <= 2.7e+100) tmp = sqrt(Float64(z * Float64(2.0 * (t_1 ^ 2.0)))); else tmp = Float64(sqrt(Float64(Float64(z * 2.0) * fma(t, t, 1.0))) * Float64(-y)); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t, 31.0], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.7e+100], N[Sqrt[N[(z * N[(2.0 * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 31:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+100}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot {t\_1}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \mathsf{fma}\left(t, t, 1\right)} \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < 31Initial program 99.3%
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 74.2%
*-commutative74.2%
Simplified74.2%
if 31 < t < 2.69999999999999998e100Initial program 94.1%
Taylor expanded in t around 0 15.1%
*-rgt-identity15.1%
add-sqr-sqrt7.6%
sqrt-unprod19.0%
*-commutative19.0%
*-commutative19.0%
swap-sqr30.3%
add-sqr-sqrt30.3%
pow230.3%
fmm-def30.3%
Applied egg-rr30.3%
associate-*l*30.3%
fmm-undef30.3%
*-commutative30.3%
Simplified30.3%
if 2.69999999999999998e100 < t Initial program 97.7%
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 82.8%
+-commutative82.8%
unpow282.8%
fma-define82.8%
Simplified82.8%
Taylor expanded in x around 0 57.8%
mul-1-neg57.8%
Simplified57.8%
Final simplification68.4%
(FPCore (x y z t) :precision binary64 (if (<= t 1.75e+76) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (* (sqrt (* (* z 2.0) (fma t t 1.0))) (* x 0.5))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.75e+76) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = sqrt(((z * 2.0) * fma(t, t, 1.0))) * (x * 0.5);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 1.75e+76) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = Float64(sqrt(Float64(Float64(z * 2.0) * fma(t, t, 1.0))) * Float64(x * 0.5)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.75e+76], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.75 \cdot 10^{+76}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot \mathsf{fma}\left(t, t, 1\right)} \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if t < 1.75e76Initial program 98.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 71.0%
*-commutative71.0%
Simplified71.0%
if 1.75e76 < t Initial program 98.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 78.7%
+-commutative78.7%
unpow278.7%
fma-define78.7%
Simplified78.7%
Taylor expanded in x around inf 63.8%
Final simplification69.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t 280.0)
(* t_1 (sqrt (* z 2.0)))
(sqrt (* z (* 2.0 (pow t_1 2.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t <= 280.0) {
tmp = t_1 * sqrt((z * 2.0));
} else {
tmp = sqrt((z * (2.0 * pow(t_1, 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 <= 280.0d0) then
tmp = t_1 * sqrt((z * 2.0d0))
else
tmp = sqrt((z * (2.0d0 * (t_1 ** 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 <= 280.0) {
tmp = t_1 * Math.sqrt((z * 2.0));
} else {
tmp = Math.sqrt((z * (2.0 * Math.pow(t_1, 2.0))));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * 0.5) - y tmp = 0 if t <= 280.0: tmp = t_1 * math.sqrt((z * 2.0)) else: tmp = math.sqrt((z * (2.0 * math.pow(t_1, 2.0)))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t <= 280.0) tmp = Float64(t_1 * sqrt(Float64(z * 2.0))); else tmp = sqrt(Float64(z * Float64(2.0 * (t_1 ^ 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 <= 280.0) tmp = t_1 * sqrt((z * 2.0)); else tmp = sqrt((z * (2.0 * (t_1 ^ 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, 280.0], N[(t$95$1 * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(z * N[(2.0 * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t \leq 280:\\
\;\;\;\;t\_1 \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z \cdot \left(2 \cdot {t\_1}^{2}\right)}\\
\end{array}
\end{array}
if t < 280Initial program 99.3%
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 74.2%
*-commutative74.2%
Simplified74.2%
if 280 < t Initial program 96.7%
Taylor expanded in t around 0 10.2%
*-rgt-identity10.2%
add-sqr-sqrt3.4%
sqrt-unprod12.9%
*-commutative12.9%
*-commutative12.9%
swap-sqr20.7%
add-sqr-sqrt20.7%
pow220.7%
fmm-def20.7%
Applied egg-rr20.7%
associate-*l*20.7%
fmm-undef20.7%
*-commutative20.7%
Simplified20.7%
Final simplification61.4%
(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 98.7%
(FPCore (x y z t) :precision binary64 (if (<= t 8e+84) (* (- (* x 0.5) y) (sqrt (* z 2.0))) (* 0.5 (* x (pow (* (pow z 2.0) 4.0) 0.25)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8e+84) {
tmp = ((x * 0.5) - y) * sqrt((z * 2.0));
} else {
tmp = 0.5 * (x * pow((pow(z, 2.0) * 4.0), 0.25));
}
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 <= 8d+84) then
tmp = ((x * 0.5d0) - y) * sqrt((z * 2.0d0))
else
tmp = 0.5d0 * (x * (((z ** 2.0d0) * 4.0d0) ** 0.25d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 8e+84) {
tmp = ((x * 0.5) - y) * Math.sqrt((z * 2.0));
} else {
tmp = 0.5 * (x * Math.pow((Math.pow(z, 2.0) * 4.0), 0.25));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 8e+84: tmp = ((x * 0.5) - y) * math.sqrt((z * 2.0)) else: tmp = 0.5 * (x * math.pow((math.pow(z, 2.0) * 4.0), 0.25)) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 8e+84) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))); else tmp = Float64(0.5 * Float64(x * (Float64((z ^ 2.0) * 4.0) ^ 0.25))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 8e+84) tmp = ((x * 0.5) - y) * sqrt((z * 2.0)); else tmp = 0.5 * (x * (((z ^ 2.0) * 4.0) ^ 0.25)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 8e+84], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x * N[Power[N[(N[Power[z, 2.0], $MachinePrecision] * 4.0), $MachinePrecision], 0.25], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 8 \cdot 10^{+84}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x \cdot {\left({z}^{2} \cdot 4\right)}^{0.25}\right)\\
\end{array}
\end{array}
if t < 8.00000000000000046e84Initial program 98.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 70.4%
*-commutative70.4%
Simplified70.4%
if 8.00000000000000046e84 < t Initial program 97.9%
Taylor expanded in t around 0 8.1%
Taylor expanded in x around inf 6.9%
associate-*l*6.9%
Simplified6.9%
*-commutative6.9%
sqrt-prod6.9%
pow1/26.9%
metadata-eval6.9%
pow-prod-up6.9%
pow-prod-down14.6%
swap-sqr14.6%
pow214.6%
metadata-eval14.6%
Applied egg-rr14.6%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (* z 2.0) (fma t t 1.0)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt(((z * 2.0) * fma(t, t, 1.0)));
}
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(z * 2.0) * fma(t, t, 1.0)))) end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(z \cdot 2\right) \cdot \mathsf{fma}\left(t, t, 1\right)}
\end{array}
Initial program 98.7%
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 82.3%
+-commutative82.3%
unpow282.3%
fma-define82.3%
Simplified82.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (or (<= x -4.85e-32) (not (<= x 1.7e+110)))
(* 0.5 (* x t_1))
(* y (- t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = sqrt((z * 2.0));
double tmp;
if ((x <= -4.85e-32) || !(x <= 1.7e+110)) {
tmp = 0.5 * (x * t_1);
} 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 <= (-4.85d-32)) .or. (.not. (x <= 1.7d+110))) then
tmp = 0.5d0 * (x * t_1)
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 <= -4.85e-32) || !(x <= 1.7e+110)) {
tmp = 0.5 * (x * t_1);
} else {
tmp = y * -t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.sqrt((z * 2.0)) tmp = 0 if (x <= -4.85e-32) or not (x <= 1.7e+110): tmp = 0.5 * (x * t_1) 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 <= -4.85e-32) || !(x <= 1.7e+110)) tmp = Float64(0.5 * Float64(x * t_1)); 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 <= -4.85e-32) || ~((x <= 1.7e+110))) tmp = 0.5 * (x * t_1); 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, -4.85e-32], N[Not[LessEqual[x, 1.7e+110]], $MachinePrecision]], N[(0.5 * N[(x * t$95$1), $MachinePrecision]), $MachinePrecision], N[(y * (-t$95$1)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;x \leq -4.85 \cdot 10^{-32} \lor \neg \left(x \leq 1.7 \cdot 10^{+110}\right):\\
\;\;\;\;0.5 \cdot \left(x \cdot t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-t\_1\right)\\
\end{array}
\end{array}
if x < -4.85000000000000003e-32 or 1.7000000000000001e110 < x Initial program 99.8%
Taylor expanded in t around 0 65.4%
Taylor expanded in x around inf 51.2%
associate-*l*51.1%
Simplified51.1%
pow151.1%
sqrt-unprod51.3%
Applied egg-rr51.3%
unpow151.3%
*-commutative51.3%
Simplified51.3%
if -4.85000000000000003e-32 < x < 1.7000000000000001e110Initial program 97.8%
Taylor expanded in t around 0 54.0%
Taylor expanded in x around 0 42.1%
mul-1-neg42.1%
*-commutative42.1%
distribute-rgt-neg-in42.1%
*-commutative42.1%
distribute-rgt-neg-in42.1%
Simplified42.1%
associate-*r*42.0%
sqrt-prod42.2%
distribute-rgt-neg-out42.2%
Applied egg-rr42.2%
distribute-rgt-neg-in42.2%
*-commutative42.2%
Simplified42.2%
Final simplification46.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 98.7%
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 58.9%
*-commutative58.9%
Simplified58.9%
(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 98.7%
Taylor expanded in t around 0 58.9%
Taylor expanded in x around 0 30.6%
mul-1-neg30.6%
*-commutative30.6%
distribute-rgt-neg-in30.6%
*-commutative30.6%
distribute-rgt-neg-in30.6%
Simplified30.6%
associate-*r*30.6%
sqrt-prod30.7%
distribute-rgt-neg-out30.7%
Applied egg-rr30.7%
distribute-rgt-neg-in30.7%
*-commutative30.7%
Simplified30.7%
Final simplification30.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 * 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 98.7%
Taylor expanded in t around 0 58.9%
Taylor expanded in x around 0 30.6%
mul-1-neg30.6%
*-commutative30.6%
distribute-rgt-neg-in30.6%
*-commutative30.6%
distribute-rgt-neg-in30.6%
Simplified30.6%
pow130.6%
associate-*r*30.6%
sqrt-prod30.7%
add-sqr-sqrt16.2%
sqrt-unprod16.8%
sqr-neg16.8%
sqrt-unprod0.8%
add-sqr-sqrt2.6%
Applied egg-rr2.6%
unpow12.6%
*-commutative2.6%
*-commutative2.6%
Simplified2.6%
Final simplification2.6%
(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 98.7%
Taylor expanded in t around 0 58.9%
Taylor expanded in x around inf 30.4%
associate-*l*30.4%
Simplified30.4%
expm1-log1p-u14.7%
expm1-undefine10.0%
sqrt-unprod10.0%
Applied egg-rr10.0%
sub-neg10.0%
metadata-eval10.0%
+-commutative10.0%
log1p-undefine10.0%
rem-exp-log25.8%
+-commutative25.8%
fma-define25.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in x around 0 2.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 2024165
(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))))