
(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}
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (pow (exp t_m) t_m) (* 2.0 z)))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return ((x * 0.5) - y) * sqrt((pow(exp(t_m), t_m) * (2.0 * z)));
}
t_m = abs(t)
real(8) function code(x, y, z, t_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
code = ((x * 0.5d0) - y) * sqrt(((exp(t_m) ** t_m) * (2.0d0 * z)))
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
return ((x * 0.5) - y) * Math.sqrt((Math.pow(Math.exp(t_m), t_m) * (2.0 * z)));
}
t_m = math.fabs(t) def code(x, y, z, t_m): return ((x * 0.5) - y) * math.sqrt((math.pow(math.exp(t_m), t_m) * (2.0 * z)))
t_m = abs(t) function code(x, y, z, t_m) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64((exp(t_m) ^ t_m) * Float64(2.0 * z)))) end
t_m = abs(t); function tmp = code(x, y, z, t_m) tmp = ((x * 0.5) - y) * sqrt(((exp(t_m) ^ t_m) * (2.0 * z))); end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[Power[N[Exp[t$95$m], $MachinePrecision], t$95$m], $MachinePrecision] * N[(2.0 * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{{\left(e^{t\_m}\right)}^{t\_m} \cdot \left(2 \cdot z\right)}
\end{array}
Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
expm1-log1p-u98.9%
expm1-udef74.9%
sqrt-unprod74.9%
associate-*l*74.9%
pow-exp74.9%
pow274.9%
Applied egg-rr74.9%
expm1-def98.9%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
unpow299.8%
exp-prod99.9%
Applied egg-rr99.9%
Final simplification99.9%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* 2.0 z))))
(if (<= t_m 6.5e-31)
(* t_1 t_2)
(if (<= t_m 1.05e+74)
(* t_1 (cbrt (pow (* 2.0 z) 1.5)))
(* t_1 (* t_m t_2))))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (x * 0.5) - y;
double t_2 = sqrt((2.0 * z));
double tmp;
if (t_m <= 6.5e-31) {
tmp = t_1 * t_2;
} else if (t_m <= 1.05e+74) {
tmp = t_1 * cbrt(pow((2.0 * z), 1.5));
} else {
tmp = t_1 * (t_m * t_2);
}
return tmp;
}
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = (x * 0.5) - y;
double t_2 = Math.sqrt((2.0 * z));
double tmp;
if (t_m <= 6.5e-31) {
tmp = t_1 * t_2;
} else if (t_m <= 1.05e+74) {
tmp = t_1 * Math.cbrt(Math.pow((2.0 * z), 1.5));
} else {
tmp = t_1 * (t_m * t_2);
}
return tmp;
}
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(x * 0.5) - y) t_2 = sqrt(Float64(2.0 * z)) tmp = 0.0 if (t_m <= 6.5e-31) tmp = Float64(t_1 * t_2); elseif (t_m <= 1.05e+74) tmp = Float64(t_1 * cbrt((Float64(2.0 * z) ^ 1.5))); else tmp = Float64(t_1 * Float64(t_m * t_2)); end return tmp end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$m, 6.5e-31], N[(t$95$1 * t$95$2), $MachinePrecision], If[LessEqual[t$95$m, 1.05e+74], N[(t$95$1 * N[Power[N[Power[N[(2.0 * z), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(t$95$m * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{2 \cdot z}\\
\mathbf{if}\;t\_m \leq 6.5 \cdot 10^{-31}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{elif}\;t\_m \leq 1.05 \cdot 10^{+74}:\\
\;\;\;\;t\_1 \cdot \sqrt[3]{{\left(2 \cdot z\right)}^{1.5}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_m \cdot t\_2\right)\\
\end{array}
\end{array}
if t < 6.49999999999999967e-31Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef65.6%
sqrt-unprod65.6%
associate-*l*65.6%
pow-exp65.6%
pow265.6%
Applied egg-rr65.6%
expm1-def98.5%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 69.5%
if 6.49999999999999967e-31 < t < 1.0499999999999999e74Initial program 99.8%
associate-*l*99.7%
exp-sqrt99.7%
exp-prod99.7%
Simplified99.7%
Taylor expanded in t around 0 25.1%
sqrt-prod25.1%
add-cbrt-cube42.8%
pow1/341.8%
add-sqr-sqrt41.8%
pow141.8%
pow1/241.8%
pow-prod-up41.8%
*-commutative41.8%
metadata-eval41.8%
Applied egg-rr41.8%
unpow1/342.8%
Simplified42.8%
if 1.0499999999999999e74 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in t around inf 69.2%
associate-*l*55.2%
*-commutative55.2%
Simplified55.2%
expm1-log1p-u27.0%
expm1-udef27.0%
*-commutative27.0%
associate-*r*27.0%
*-commutative27.0%
sqrt-prod27.0%
*-commutative27.0%
associate-*l*28.6%
fma-neg28.6%
Applied egg-rr28.6%
expm1-def28.6%
expm1-log1p56.9%
fma-neg56.9%
*-commutative56.9%
*-commutative56.9%
*-commutative56.9%
Simplified56.9%
Final simplification64.9%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t_m 1.0)
(* t_1 (sqrt (* 2.0 z)))
(* t_1 (sqrt (* (* 2.0 z) (pow t_m 2.0)))))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t_m <= 1.0) {
tmp = t_1 * sqrt((2.0 * z));
} else {
tmp = t_1 * sqrt(((2.0 * z) * pow(t_m, 2.0)));
}
return tmp;
}
t_m = abs(t)
real(8) function code(x, y, z, t_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if (t_m <= 1.0d0) then
tmp = t_1 * sqrt((2.0d0 * z))
else
tmp = t_1 * sqrt(((2.0d0 * z) * (t_m ** 2.0d0)))
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t_m <= 1.0) {
tmp = t_1 * Math.sqrt((2.0 * z));
} else {
tmp = t_1 * Math.sqrt(((2.0 * z) * Math.pow(t_m, 2.0)));
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = (x * 0.5) - y tmp = 0 if t_m <= 1.0: tmp = t_1 * math.sqrt((2.0 * z)) else: tmp = t_1 * math.sqrt(((2.0 * z) * math.pow(t_m, 2.0))) return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t_m <= 1.0) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); else tmp = Float64(t_1 * sqrt(Float64(Float64(2.0 * z) * (t_m ^ 2.0)))); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = (x * 0.5) - y; tmp = 0.0; if (t_m <= 1.0) tmp = t_1 * sqrt((2.0 * z)); else tmp = t_1 * sqrt(((2.0 * z) * (t_m ^ 2.0))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$m, 1.0], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t\_m \leq 1:\\
\;\;\;\;t\_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\left(2 \cdot z\right) \cdot {t\_m}^{2}}\\
\end{array}
\end{array}
if t < 1Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef65.3%
sqrt-unprod65.3%
associate-*l*65.3%
pow-exp65.2%
pow265.2%
Applied egg-rr65.2%
expm1-def98.5%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 69.8%
if 1 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 76.2%
+-commutative76.2%
Simplified76.2%
Taylor expanded in t around inf 76.2%
*-commutative76.2%
associate-*l*76.2%
*-commutative76.2%
Simplified76.2%
Final simplification71.6%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t_m 1.4e+24)
(* t_1 (* (hypot 1.0 t_m) (sqrt (* 2.0 z))))
(* t_1 (sqrt (* (* 2.0 z) (pow t_m 2.0)))))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t_m <= 1.4e+24) {
tmp = t_1 * (hypot(1.0, t_m) * sqrt((2.0 * z)));
} else {
tmp = t_1 * sqrt(((2.0 * z) * pow(t_m, 2.0)));
}
return tmp;
}
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t_m <= 1.4e+24) {
tmp = t_1 * (Math.hypot(1.0, t_m) * Math.sqrt((2.0 * z)));
} else {
tmp = t_1 * Math.sqrt(((2.0 * z) * Math.pow(t_m, 2.0)));
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = (x * 0.5) - y tmp = 0 if t_m <= 1.4e+24: tmp = t_1 * (math.hypot(1.0, t_m) * math.sqrt((2.0 * z))) else: tmp = t_1 * math.sqrt(((2.0 * z) * math.pow(t_m, 2.0))) return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t_m <= 1.4e+24) tmp = Float64(t_1 * Float64(hypot(1.0, t_m) * sqrt(Float64(2.0 * z)))); else tmp = Float64(t_1 * sqrt(Float64(Float64(2.0 * z) * (t_m ^ 2.0)))); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = (x * 0.5) - y; tmp = 0.0; if (t_m <= 1.4e+24) tmp = t_1 * (hypot(1.0, t_m) * sqrt((2.0 * z))); else tmp = t_1 * sqrt(((2.0 * z) * (t_m ^ 2.0))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$m, 1.4e+24], N[(t$95$1 * N[(N[Sqrt[1.0 ^ 2 + t$95$m ^ 2], $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[Power[t$95$m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t\_m \leq 1.4 \cdot 10^{+24}:\\
\;\;\;\;t\_1 \cdot \left(\mathsf{hypot}\left(1, t\_m\right) \cdot \sqrt{2 \cdot z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \sqrt{\left(2 \cdot z\right) \cdot {t\_m}^{2}}\\
\end{array}
\end{array}
if t < 1.4000000000000001e24Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef66.2%
sqrt-unprod66.2%
associate-*l*66.2%
pow-exp66.2%
pow266.2%
Applied egg-rr66.2%
expm1-def98.5%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 87.3%
+-commutative87.3%
Simplified87.3%
sqrt-prod86.8%
+-commutative86.8%
unpow286.8%
hypot-1-def82.9%
Applied egg-rr82.9%
if 1.4000000000000001e24 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 81.6%
+-commutative81.6%
Simplified81.6%
Taylor expanded in t around inf 81.6%
*-commutative81.6%
associate-*l*81.6%
*-commutative81.6%
Simplified81.6%
Final simplification82.5%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(if (<= t_m 1.0)
(* t_1 (sqrt (* 2.0 z)))
(* (* t_m (* t_1 (sqrt 2.0))) (sqrt z)))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t_m <= 1.0) {
tmp = t_1 * sqrt((2.0 * z));
} else {
tmp = (t_m * (t_1 * sqrt(2.0))) * sqrt(z);
}
return tmp;
}
t_m = abs(t)
real(8) function code(x, y, z, t_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: t_1
real(8) :: tmp
t_1 = (x * 0.5d0) - y
if (t_m <= 1.0d0) then
tmp = t_1 * sqrt((2.0d0 * z))
else
tmp = (t_m * (t_1 * sqrt(2.0d0))) * sqrt(z)
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = (x * 0.5) - y;
double tmp;
if (t_m <= 1.0) {
tmp = t_1 * Math.sqrt((2.0 * z));
} else {
tmp = (t_m * (t_1 * Math.sqrt(2.0))) * Math.sqrt(z);
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = (x * 0.5) - y tmp = 0 if t_m <= 1.0: tmp = t_1 * math.sqrt((2.0 * z)) else: tmp = (t_m * (t_1 * math.sqrt(2.0))) * math.sqrt(z) return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(x * 0.5) - y) tmp = 0.0 if (t_m <= 1.0) tmp = Float64(t_1 * sqrt(Float64(2.0 * z))); else tmp = Float64(Float64(t_m * Float64(t_1 * sqrt(2.0))) * sqrt(z)); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = (x * 0.5) - y; tmp = 0.0; if (t_m <= 1.0) tmp = t_1 * sqrt((2.0 * z)); else tmp = (t_m * (t_1 * sqrt(2.0))) * sqrt(z); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, If[LessEqual[t$95$m, 1.0], N[(t$95$1 * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$m * N[(t$95$1 * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\mathbf{if}\;t\_m \leq 1:\\
\;\;\;\;t\_1 \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\left(t\_m \cdot \left(t\_1 \cdot \sqrt{2}\right)\right) \cdot \sqrt{z}\\
\end{array}
\end{array}
if t < 1Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef65.3%
sqrt-unprod65.3%
associate-*l*65.3%
pow-exp65.2%
pow265.2%
Applied egg-rr65.2%
expm1-def98.5%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 69.8%
if 1 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 76.2%
+-commutative76.2%
Simplified76.2%
Taylor expanded in t around inf 62.3%
Final simplification67.8%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (* (exp (/ (* t_m t_m) 2.0)) (* (- (* x 0.5) y) (sqrt (* 2.0 z)))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return exp(((t_m * t_m) / 2.0)) * (((x * 0.5) - y) * sqrt((2.0 * z)));
}
t_m = abs(t)
real(8) function code(x, y, z, t_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
code = exp(((t_m * t_m) / 2.0d0)) * (((x * 0.5d0) - y) * sqrt((2.0d0 * z)))
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
return Math.exp(((t_m * t_m) / 2.0)) * (((x * 0.5) - y) * Math.sqrt((2.0 * z)));
}
t_m = math.fabs(t) def code(x, y, z, t_m): return math.exp(((t_m * t_m) / 2.0)) * (((x * 0.5) - y) * math.sqrt((2.0 * z)))
t_m = abs(t) function code(x, y, z, t_m) return Float64(exp(Float64(Float64(t_m * t_m) / 2.0)) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z)))) end
t_m = abs(t); function tmp = code(x, y, z, t_m) tmp = exp(((t_m * t_m) / 2.0)) * (((x * 0.5) - y) * sqrt((2.0 * z))); end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(N[Exp[N[(N[(t$95$m * t$95$m), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
e^{\frac{t\_m \cdot t\_m}{2}} \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\right)
\end{array}
Initial program 99.8%
Final simplification99.8%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (* (- (* x 0.5) y) (sqrt (* (* 2.0 z) (fma t_m t_m 1.0)))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return ((x * 0.5) - y) * sqrt(((2.0 * z) * fma(t_m, t_m, 1.0)));
}
t_m = abs(t) function code(x, y, z, t_m) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(Float64(2.0 * z) * fma(t_m, t_m, 1.0)))) end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(N[(2.0 * z), $MachinePrecision] * N[(t$95$m * t$95$m + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{\left(2 \cdot z\right) \cdot \mathsf{fma}\left(t\_m, t\_m, 1\right)}
\end{array}
Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
expm1-log1p-u98.9%
expm1-udef74.9%
sqrt-unprod74.9%
associate-*l*74.9%
pow-exp74.9%
pow274.9%
Applied egg-rr74.9%
expm1-def98.9%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 85.8%
+-commutative85.8%
unpow285.8%
fma-def85.8%
Simplified85.8%
Final simplification85.8%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (let* ((t_1 (* (- (* x 0.5) y) (sqrt (* 2.0 z))))) (if (<= t_m 1.0) t_1 (* t_m t_1))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = ((x * 0.5) - y) * sqrt((2.0 * z));
double tmp;
if (t_m <= 1.0) {
tmp = t_1;
} else {
tmp = t_m * t_1;
}
return tmp;
}
t_m = abs(t)
real(8) function code(x, y, z, t_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: t_1
real(8) :: tmp
t_1 = ((x * 0.5d0) - y) * sqrt((2.0d0 * z))
if (t_m <= 1.0d0) then
tmp = t_1
else
tmp = t_m * t_1
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = ((x * 0.5) - y) * Math.sqrt((2.0 * z));
double tmp;
if (t_m <= 1.0) {
tmp = t_1;
} else {
tmp = t_m * t_1;
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = ((x * 0.5) - y) * math.sqrt((2.0 * z)) tmp = 0 if t_m <= 1.0: tmp = t_1 else: tmp = t_m * t_1 return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))) tmp = 0.0 if (t_m <= 1.0) tmp = t_1; else tmp = Float64(t_m * t_1); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = ((x * 0.5) - y) * sqrt((2.0 * z)); tmp = 0.0; if (t_m <= 1.0) tmp = t_1; else tmp = t_m * t_1; end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$m, 1.0], t$95$1, N[(t$95$m * t$95$1), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{if}\;t\_m \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_m \cdot t\_1\\
\end{array}
\end{array}
if t < 1Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef65.3%
sqrt-unprod65.3%
associate-*l*65.3%
pow-exp65.2%
pow265.2%
Applied egg-rr65.2%
expm1-def98.5%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 69.8%
if 1 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 76.2%
+-commutative76.2%
Simplified76.2%
Taylor expanded in t around inf 62.3%
associate-*l*47.0%
*-commutative47.0%
Simplified47.0%
expm1-log1p-u23.1%
expm1-udef23.0%
*-commutative23.0%
associate-*r*23.0%
*-commutative23.0%
sqrt-prod23.0%
*-commutative23.0%
associate-*l*24.3%
fma-neg24.3%
Applied egg-rr24.3%
expm1-def24.4%
expm1-log1p48.4%
associate-*r*47.0%
*-commutative47.0%
fma-neg47.0%
*-commutative47.0%
*-commutative47.0%
Simplified47.0%
Final simplification63.5%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (let* ((t_1 (- (* x 0.5) y)) (t_2 (sqrt (* 2.0 z)))) (if (<= t_m 1.0) (* t_1 t_2) (* t_1 (* t_m t_2)))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = (x * 0.5) - y;
double t_2 = sqrt((2.0 * z));
double tmp;
if (t_m <= 1.0) {
tmp = t_1 * t_2;
} else {
tmp = t_1 * (t_m * t_2);
}
return tmp;
}
t_m = abs(t)
real(8) function code(x, y, z, t_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * 0.5d0) - y
t_2 = sqrt((2.0d0 * z))
if (t_m <= 1.0d0) then
tmp = t_1 * t_2
else
tmp = t_1 * (t_m * t_2)
end if
code = tmp
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
double t_1 = (x * 0.5) - y;
double t_2 = Math.sqrt((2.0 * z));
double tmp;
if (t_m <= 1.0) {
tmp = t_1 * t_2;
} else {
tmp = t_1 * (t_m * t_2);
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = (x * 0.5) - y t_2 = math.sqrt((2.0 * z)) tmp = 0 if t_m <= 1.0: tmp = t_1 * t_2 else: tmp = t_1 * (t_m * t_2) return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = Float64(Float64(x * 0.5) - y) t_2 = sqrt(Float64(2.0 * z)) tmp = 0.0 if (t_m <= 1.0) tmp = Float64(t_1 * t_2); else tmp = Float64(t_1 * Float64(t_m * t_2)); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = (x * 0.5) - y; t_2 = sqrt((2.0 * z)); tmp = 0.0; if (t_m <= 1.0) tmp = t_1 * t_2; else tmp = t_1 * (t_m * t_2); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$m, 1.0], N[(t$95$1 * t$95$2), $MachinePrecision], N[(t$95$1 * N[(t$95$m * t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
t_2 := \sqrt{2 \cdot z}\\
\mathbf{if}\;t\_m \leq 1:\\
\;\;\;\;t\_1 \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(t\_m \cdot t\_2\right)\\
\end{array}
\end{array}
if t < 1Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
expm1-log1p-u98.5%
expm1-udef65.3%
sqrt-unprod65.3%
associate-*l*65.3%
pow-exp65.2%
pow265.2%
Applied egg-rr65.2%
expm1-def98.5%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 69.8%
if 1 < t Initial program 100.0%
associate-*l*100.0%
exp-sqrt100.0%
exp-prod100.0%
Simplified100.0%
expm1-log1p-u100.0%
expm1-udef100.0%
sqrt-unprod100.0%
associate-*l*100.0%
pow-exp100.0%
pow2100.0%
Applied egg-rr100.0%
expm1-def100.0%
expm1-log1p100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in t around 0 76.2%
+-commutative76.2%
Simplified76.2%
Taylor expanded in t around inf 62.3%
associate-*l*47.0%
*-commutative47.0%
Simplified47.0%
expm1-log1p-u23.1%
expm1-udef23.0%
*-commutative23.0%
associate-*r*23.0%
*-commutative23.0%
sqrt-prod23.0%
*-commutative23.0%
associate-*l*24.3%
fma-neg24.3%
Applied egg-rr24.3%
expm1-def24.4%
expm1-log1p48.4%
fma-neg48.4%
*-commutative48.4%
*-commutative48.4%
*-commutative48.4%
Simplified48.4%
Final simplification63.9%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (* (- (* x 0.5) y) (sqrt (* 2.0 z))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return ((x * 0.5) - y) * sqrt((2.0 * z));
}
t_m = abs(t)
real(8) function code(x, y, z, t_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
code = ((x * 0.5d0) - y) * sqrt((2.0d0 * z))
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
return ((x * 0.5) - y) * Math.sqrt((2.0 * z));
}
t_m = math.fabs(t) def code(x, y, z, t_m): return ((x * 0.5) - y) * math.sqrt((2.0 * z))
t_m = abs(t) function code(x, y, z, t_m) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))) end
t_m = abs(t); function tmp = code(x, y, z, t_m) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}
\end{array}
Initial program 99.8%
associate-*l*99.8%
exp-sqrt99.8%
exp-prod99.8%
Simplified99.8%
expm1-log1p-u98.9%
expm1-udef74.9%
sqrt-unprod74.9%
associate-*l*74.9%
pow-exp74.9%
pow274.9%
Applied egg-rr74.9%
expm1-def98.9%
expm1-log1p99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 54.3%
Final simplification54.3%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (* 0.5 (* x (sqrt (* 2.0 z)))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return 0.5 * (x * sqrt((2.0 * z)));
}
t_m = abs(t)
real(8) function code(x, y, z, t_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
code = 0.5d0 * (x * sqrt((2.0d0 * z)))
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
return 0.5 * (x * Math.sqrt((2.0 * z)));
}
t_m = math.fabs(t) def code(x, y, z, t_m): return 0.5 * (x * math.sqrt((2.0 * z)))
t_m = abs(t) function code(x, y, z, t_m) return Float64(0.5 * Float64(x * sqrt(Float64(2.0 * z)))) end
t_m = abs(t); function tmp = code(x, y, z, t_m) tmp = 0.5 * (x * sqrt((2.0 * z))); end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(0.5 * N[(x * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
0.5 \cdot \left(x \cdot \sqrt{2 \cdot z}\right)
\end{array}
Initial program 99.8%
*-commutative99.8%
associate-*l*99.5%
exp-sqrt99.5%
Simplified99.5%
Taylor expanded in t around 0 54.2%
associate-*r*54.1%
*-commutative54.1%
*-commutative54.1%
fma-neg54.1%
associate-*l*54.1%
fma-neg54.1%
*-commutative54.1%
Simplified54.1%
Taylor expanded in x around inf 29.2%
expm1-log1p-u19.6%
expm1-udef14.1%
associate-*l*14.1%
sqrt-prod14.1%
Applied egg-rr14.1%
expm1-def19.7%
expm1-log1p29.2%
Simplified29.2%
Final simplification29.2%
(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 2024031
(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))))