
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* z 2.0))) (exp (/ (* t t) 2.0))))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x * 0.5d0) - y) * sqrt((z * 2.0d0))) * exp(((t * t) / 2.0d0))
end function
public static double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * Math.sqrt((z * 2.0))) * Math.exp(((t * t) / 2.0));
}
def code(x, y, z, t): return (((x * 0.5) - y) * math.sqrt((z * 2.0))) * math.exp(((t * t) / 2.0))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * 2.0))) * exp(Float64(Float64(t * t) / 2.0))) end
function tmp = code(x, y, z, t) tmp = (((x * 0.5) - y) * sqrt((z * 2.0))) * exp(((t * t) / 2.0)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Exp[N[(N[(t * t), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot 2}\right) \cdot e^{\frac{t \cdot t}{2}}
\end{array}
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (* (sqrt (* z 2.0)) (* (fma x 0.5 (- y)) (pow (sqrt (exp t_m)) t_m))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return sqrt((z * 2.0)) * (fma(x, 0.5, -y) * pow(sqrt(exp(t_m)), t_m));
}
t_m = abs(t) function code(x, y, z, t_m) return Float64(sqrt(Float64(z * 2.0)) * Float64(fma(x, 0.5, Float64(-y)) * (sqrt(exp(t_m)) ^ t_m))) end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5 + (-y)), $MachinePrecision] * N[Power[N[Sqrt[N[Exp[t$95$m], $MachinePrecision]], $MachinePrecision], t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sqrt{z \cdot 2} \cdot \left(\mathsf{fma}\left(x, 0.5, -y\right) \cdot {\left(\sqrt{e^{t\_m}}\right)}^{t\_m}\right)
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.8%
fma-neg99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= t_m 11.6)
(* t_1 (- (* x 0.5) y))
(* t_1 (* (- y) (pow (+ 1.0 (* 0.5 t_m)) t_m))))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t_m <= 11.6) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * (-y * pow((1.0 + (0.5 * t_m)), t_m));
}
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 = sqrt((z * 2.0d0))
if (t_m <= 11.6d0) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = t_1 * (-y * ((1.0d0 + (0.5d0 * t_m)) ** t_m))
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 = Math.sqrt((z * 2.0));
double tmp;
if (t_m <= 11.6) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = t_1 * (-y * Math.pow((1.0 + (0.5 * t_m)), t_m));
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t_m <= 11.6: tmp = t_1 * ((x * 0.5) - y) else: tmp = t_1 * (-y * math.pow((1.0 + (0.5 * t_m)), t_m)) return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t_m <= 11.6) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(t_1 * Float64(Float64(-y) * (Float64(1.0 + Float64(0.5 * t_m)) ^ t_m))); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (t_m <= 11.6) tmp = t_1 * ((x * 0.5) - y); else tmp = t_1 * (-y * ((1.0 + (0.5 * t_m)) ^ t_m)); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$m, 11.6], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[((-y) * N[Power[N[(1.0 + N[(0.5 * t$95$m), $MachinePrecision]), $MachinePrecision], t$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t\_m \leq 11.6:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(\left(-y\right) \cdot {\left(1 + 0.5 \cdot t\_m\right)}^{t\_m}\right)\\
\end{array}
\end{array}
if t < 11.5999999999999996Initial program 99.2%
*-commutative99.2%
associate-*l*99.7%
fma-neg99.7%
associate-*l/99.7%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 71.7%
if 11.5999999999999996 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-neg100.0%
associate-*l/100.0%
exp-prod100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in x around 0 76.7%
Taylor expanded in t around 0 76.7%
Final simplification73.1%
t_m = (fabs.f64 t)
(FPCore (x y z t_m)
:precision binary64
(let* ((t_1 (sqrt (* z 2.0))))
(if (<= t_m 11.6)
(* t_1 (- (* x 0.5) y))
(* (* t_1 y) (- (pow (+ 1.0 (* 0.5 t_m)) t_m))))))t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double t_1 = sqrt((z * 2.0));
double tmp;
if (t_m <= 11.6) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = (t_1 * y) * -pow((1.0 + (0.5 * t_m)), t_m);
}
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 = sqrt((z * 2.0d0))
if (t_m <= 11.6d0) then
tmp = t_1 * ((x * 0.5d0) - y)
else
tmp = (t_1 * y) * -((1.0d0 + (0.5d0 * t_m)) ** t_m)
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 = Math.sqrt((z * 2.0));
double tmp;
if (t_m <= 11.6) {
tmp = t_1 * ((x * 0.5) - y);
} else {
tmp = (t_1 * y) * -Math.pow((1.0 + (0.5 * t_m)), t_m);
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): t_1 = math.sqrt((z * 2.0)) tmp = 0 if t_m <= 11.6: tmp = t_1 * ((x * 0.5) - y) else: tmp = (t_1 * y) * -math.pow((1.0 + (0.5 * t_m)), t_m) return tmp
t_m = abs(t) function code(x, y, z, t_m) t_1 = sqrt(Float64(z * 2.0)) tmp = 0.0 if (t_m <= 11.6) tmp = Float64(t_1 * Float64(Float64(x * 0.5) - y)); else tmp = Float64(Float64(t_1 * y) * Float64(-(Float64(1.0 + Float64(0.5 * t_m)) ^ t_m))); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) t_1 = sqrt((z * 2.0)); tmp = 0.0; if (t_m <= 11.6) tmp = t_1 * ((x * 0.5) - y); else tmp = (t_1 * y) * -((1.0 + (0.5 * t_m)) ^ t_m); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision]
code[x_, y_, z_, t$95$m_] := Block[{t$95$1 = N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$m, 11.6], N[(t$95$1 * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 * y), $MachinePrecision] * (-N[Power[N[(1.0 + N[(0.5 * t$95$m), $MachinePrecision]), $MachinePrecision], t$95$m], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \sqrt{z \cdot 2}\\
\mathbf{if}\;t\_m \leq 11.6:\\
\;\;\;\;t\_1 \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t\_1 \cdot y\right) \cdot \left(-{\left(1 + 0.5 \cdot t\_m\right)}^{t\_m}\right)\\
\end{array}
\end{array}
if t < 11.5999999999999996Initial program 99.2%
*-commutative99.2%
associate-*l*99.7%
fma-neg99.7%
associate-*l/99.7%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 71.7%
if 11.5999999999999996 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-neg100.0%
associate-*l/100.0%
exp-prod100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in x around 0 76.7%
Taylor expanded in t around 0 76.7%
Taylor expanded in t around -inf 76.7%
*-commutative76.7%
associate-*r*76.7%
associate-*r*76.7%
*-commutative76.7%
associate-*l*76.7%
sqrt-prod76.7%
*-commutative76.7%
*-commutative76.7%
sub-neg76.7%
distribute-lft-neg-in76.7%
metadata-eval76.7%
*-commutative76.7%
Applied egg-rr76.7%
Final simplification73.1%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (if (<= t_m 15.5) (* (sqrt (* z 2.0)) (- (* x 0.5) y)) (* x (* (* (sqrt 2.0) (sqrt z)) (- 0.5 (/ y x))))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 15.5) {
tmp = sqrt((z * 2.0)) * ((x * 0.5) - y);
} else {
tmp = x * ((sqrt(2.0) * sqrt(z)) * (0.5 - (y / x)));
}
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) :: tmp
if (t_m <= 15.5d0) then
tmp = sqrt((z * 2.0d0)) * ((x * 0.5d0) - y)
else
tmp = x * ((sqrt(2.0d0) * sqrt(z)) * (0.5d0 - (y / x)))
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 tmp;
if (t_m <= 15.5) {
tmp = Math.sqrt((z * 2.0)) * ((x * 0.5) - y);
} else {
tmp = x * ((Math.sqrt(2.0) * Math.sqrt(z)) * (0.5 - (y / x)));
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): tmp = 0 if t_m <= 15.5: tmp = math.sqrt((z * 2.0)) * ((x * 0.5) - y) else: tmp = x * ((math.sqrt(2.0) * math.sqrt(z)) * (0.5 - (y / x))) return tmp
t_m = abs(t) function code(x, y, z, t_m) tmp = 0.0 if (t_m <= 15.5) tmp = Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y)); else tmp = Float64(x * Float64(Float64(sqrt(2.0) * sqrt(z)) * Float64(0.5 - Float64(y / x)))); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) tmp = 0.0; if (t_m <= 15.5) tmp = sqrt((z * 2.0)) * ((x * 0.5) - y); else tmp = x * ((sqrt(2.0) * sqrt(z)) * (0.5 - (y / x))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := If[LessEqual[t$95$m, 15.5], N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[z], $MachinePrecision]), $MachinePrecision] * N[(0.5 - N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 15.5:\\
\;\;\;\;\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\left(\sqrt{2} \cdot \sqrt{z}\right) \cdot \left(0.5 - \frac{y}{x}\right)\right)\\
\end{array}
\end{array}
if t < 15.5Initial program 99.2%
*-commutative99.2%
associate-*l*99.7%
fma-neg99.7%
associate-*l/99.7%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 71.7%
if 15.5 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-neg100.0%
associate-*l/100.0%
exp-prod100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 10.9%
*-commutative10.9%
associate-*l*10.9%
Simplified10.9%
Taylor expanded in x around inf 26.4%
+-commutative26.4%
mul-1-neg26.4%
unsub-neg26.4%
*-commutative26.4%
associate-*l/22.4%
*-commutative22.4%
*-commutative22.4%
associate-*r*22.4%
associate-/l*26.4%
distribute-lft-out--26.4%
*-commutative26.4%
Simplified26.4%
Final simplification58.8%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (if (<= t_m 2800000000.0) (* (sqrt (* z 2.0)) (- (* x 0.5) y)) (* (sqrt z) (* x (* (sqrt 2.0) (/ y (- x)))))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 2800000000.0) {
tmp = sqrt((z * 2.0)) * ((x * 0.5) - y);
} else {
tmp = sqrt(z) * (x * (sqrt(2.0) * (y / -x)));
}
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) :: tmp
if (t_m <= 2800000000.0d0) then
tmp = sqrt((z * 2.0d0)) * ((x * 0.5d0) - y)
else
tmp = sqrt(z) * (x * (sqrt(2.0d0) * (y / -x)))
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 tmp;
if (t_m <= 2800000000.0) {
tmp = Math.sqrt((z * 2.0)) * ((x * 0.5) - y);
} else {
tmp = Math.sqrt(z) * (x * (Math.sqrt(2.0) * (y / -x)));
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): tmp = 0 if t_m <= 2800000000.0: tmp = math.sqrt((z * 2.0)) * ((x * 0.5) - y) else: tmp = math.sqrt(z) * (x * (math.sqrt(2.0) * (y / -x))) return tmp
t_m = abs(t) function code(x, y, z, t_m) tmp = 0.0 if (t_m <= 2800000000.0) tmp = Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y)); else tmp = Float64(sqrt(z) * Float64(x * Float64(sqrt(2.0) * Float64(y / Float64(-x))))); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) tmp = 0.0; if (t_m <= 2800000000.0) tmp = sqrt((z * 2.0)) * ((x * 0.5) - y); else tmp = sqrt(z) * (x * (sqrt(2.0) * (y / -x))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := If[LessEqual[t$95$m, 2800000000.0], N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[z], $MachinePrecision] * N[(x * N[(N[Sqrt[2.0], $MachinePrecision] * N[(y / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 2800000000:\\
\;\;\;\;\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{z} \cdot \left(x \cdot \left(\sqrt{2} \cdot \frac{y}{-x}\right)\right)\\
\end{array}
\end{array}
if t < 2.8e9Initial program 99.2%
*-commutative99.2%
associate-*l*99.7%
fma-neg99.7%
associate-*l/99.7%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 70.6%
if 2.8e9 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-neg100.0%
associate-*l/100.0%
exp-prod100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in t around 0 11.1%
Taylor expanded in x around inf 20.7%
+-commutative20.7%
mul-1-neg20.7%
unsub-neg20.7%
*-commutative20.7%
*-commutative20.7%
associate-/l*20.7%
distribute-lft-out--20.7%
Simplified20.7%
Taylor expanded in y around inf 16.9%
mul-1-neg16.9%
distribute-neg-frac216.9%
Simplified16.9%
Final simplification55.9%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (* (exp (/ (* t_m t_m) 2.0)) (* (sqrt (* z 2.0)) (- (* x 0.5) y))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return exp(((t_m * t_m) / 2.0)) * (sqrt((z * 2.0)) * ((x * 0.5) - y));
}
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)) * (sqrt((z * 2.0d0)) * ((x * 0.5d0) - y))
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)) * (Math.sqrt((z * 2.0)) * ((x * 0.5) - y));
}
t_m = math.fabs(t) def code(x, y, z, t_m): return math.exp(((t_m * t_m) / 2.0)) * (math.sqrt((z * 2.0)) * ((x * 0.5) - y))
t_m = abs(t) function code(x, y, z, t_m) return Float64(exp(Float64(Float64(t_m * t_m) / 2.0)) * Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y))) end
t_m = abs(t); function tmp = code(x, y, z, t_m) tmp = exp(((t_m * t_m) / 2.0)) * (sqrt((z * 2.0)) * ((x * 0.5) - y)); 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[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
e^{\frac{t\_m \cdot t\_m}{2}} \cdot \left(\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\right)
\end{array}
Initial program 99.4%
Final simplification99.4%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (if (<= t_m 9500000.0) (* (sqrt (* z 2.0)) (- (* x 0.5) y)) (sqrt (* (* z 2.0) (pow y 2.0)))))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
double tmp;
if (t_m <= 9500000.0) {
tmp = sqrt((z * 2.0)) * ((x * 0.5) - y);
} else {
tmp = sqrt(((z * 2.0) * pow(y, 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) :: tmp
if (t_m <= 9500000.0d0) then
tmp = sqrt((z * 2.0d0)) * ((x * 0.5d0) - y)
else
tmp = sqrt(((z * 2.0d0) * (y ** 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 tmp;
if (t_m <= 9500000.0) {
tmp = Math.sqrt((z * 2.0)) * ((x * 0.5) - y);
} else {
tmp = Math.sqrt(((z * 2.0) * Math.pow(y, 2.0)));
}
return tmp;
}
t_m = math.fabs(t) def code(x, y, z, t_m): tmp = 0 if t_m <= 9500000.0: tmp = math.sqrt((z * 2.0)) * ((x * 0.5) - y) else: tmp = math.sqrt(((z * 2.0) * math.pow(y, 2.0))) return tmp
t_m = abs(t) function code(x, y, z, t_m) tmp = 0.0 if (t_m <= 9500000.0) tmp = Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y)); else tmp = sqrt(Float64(Float64(z * 2.0) * (y ^ 2.0))); end return tmp end
t_m = abs(t); function tmp_2 = code(x, y, z, t_m) tmp = 0.0; if (t_m <= 9500000.0) tmp = sqrt((z * 2.0)) * ((x * 0.5) - y); else tmp = sqrt(((z * 2.0) * (y ^ 2.0))); end tmp_2 = tmp; end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := If[LessEqual[t$95$m, 9500000.0], N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(N[(z * 2.0), $MachinePrecision] * N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 9500000:\\
\;\;\;\;\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\left(z \cdot 2\right) \cdot {y}^{2}}\\
\end{array}
\end{array}
if t < 9.5e6Initial program 99.2%
*-commutative99.2%
associate-*l*99.7%
fma-neg99.7%
associate-*l/99.7%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in t around 0 70.9%
if 9.5e6 < t Initial program 100.0%
*-commutative100.0%
associate-*l*100.0%
fma-neg100.0%
associate-*l/100.0%
exp-prod100.0%
exp-sqrt100.0%
Simplified100.0%
Taylor expanded in x around 0 77.5%
Taylor expanded in t around 0 7.3%
add-sqr-sqrt4.2%
sqrt-unprod13.9%
swap-sqr19.3%
add-sqr-sqrt19.3%
mul-1-neg19.3%
mul-1-neg19.3%
sqr-neg19.3%
pow219.3%
Applied egg-rr19.3%
Final simplification56.6%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (* (sqrt (* z 2.0)) (- (* x 0.5) y)))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return sqrt((z * 2.0)) * ((x * 0.5) - y);
}
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 = sqrt((z * 2.0d0)) * ((x * 0.5d0) - y)
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
return Math.sqrt((z * 2.0)) * ((x * 0.5) - y);
}
t_m = math.fabs(t) def code(x, y, z, t_m): return math.sqrt((z * 2.0)) * ((x * 0.5) - y)
t_m = abs(t) function code(x, y, z, t_m) return Float64(sqrt(Float64(z * 2.0)) * Float64(Float64(x * 0.5) - y)) end
t_m = abs(t); function tmp = code(x, y, z, t_m) tmp = sqrt((z * 2.0)) * ((x * 0.5) - y); end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sqrt{z \cdot 2} \cdot \left(x \cdot 0.5 - y\right)
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.8%
fma-neg99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.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 (* (sqrt (* z 2.0)) (- y)))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return sqrt((z * 2.0)) * -y;
}
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 = sqrt((z * 2.0d0)) * -y
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
return Math.sqrt((z * 2.0)) * -y;
}
t_m = math.fabs(t) def code(x, y, z, t_m): return math.sqrt((z * 2.0)) * -y
t_m = abs(t) function code(x, y, z, t_m) return Float64(sqrt(Float64(z * 2.0)) * Float64(-y)) end
t_m = abs(t); function tmp = code(x, y, z, t_m) tmp = sqrt((z * 2.0)) * -y; end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sqrt{z \cdot 2} \cdot \left(-y\right)
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.8%
fma-neg99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in x around 0 66.8%
Taylor expanded in t around 0 32.4%
*-commutative32.4%
associate-*l*32.4%
add-sqr-sqrt16.5%
sqrt-unprod16.6%
sqr-neg16.6%
mul-1-neg16.6%
mul-1-neg16.6%
sqrt-unprod1.3%
add-sqr-sqrt2.7%
*-commutative2.7%
add-sqr-sqrt1.3%
sqrt-unprod16.6%
mul-1-neg16.6%
mul-1-neg16.6%
sqr-neg16.6%
sqrt-unprod16.5%
add-sqr-sqrt32.4%
Applied egg-rr32.4%
neg-mul-132.4%
*-commutative32.4%
distribute-rgt-neg-in32.4%
*-commutative32.4%
Simplified32.4%
Final simplification32.4%
t_m = (fabs.f64 t) (FPCore (x y z t_m) :precision binary64 (* (sqrt (* z 2.0)) y))
t_m = fabs(t);
double code(double x, double y, double z, double t_m) {
return sqrt((z * 2.0)) * y;
}
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 = sqrt((z * 2.0d0)) * y
end function
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m) {
return Math.sqrt((z * 2.0)) * y;
}
t_m = math.fabs(t) def code(x, y, z, t_m): return math.sqrt((z * 2.0)) * y
t_m = abs(t) function code(x, y, z, t_m) return Float64(sqrt(Float64(z * 2.0)) * y) end
t_m = abs(t); function tmp = code(x, y, z, t_m) tmp = sqrt((z * 2.0)) * y; end
t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_] := N[(N[Sqrt[N[(z * 2.0), $MachinePrecision]], $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
t_m = \left|t\right|
\\
\sqrt{z \cdot 2} \cdot y
\end{array}
Initial program 99.4%
*-commutative99.4%
associate-*l*99.8%
fma-neg99.8%
associate-*l/99.8%
exp-prod99.8%
exp-sqrt99.8%
Simplified99.8%
Taylor expanded in x around 0 66.8%
Taylor expanded in t around 0 32.4%
add-sqr-sqrt15.8%
sqrt-unprod18.5%
mul-1-neg18.5%
mul-1-neg18.5%
sqr-neg18.5%
sqrt-unprod1.5%
add-sqr-sqrt2.7%
Applied egg-rr2.7%
(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 2024096
(FPCore (x y z t)
:name "Data.Number.Erf:$cinvnormcdf from erf-2.0.0.0, A"
:precision binary64
:alt
(* (* (- (* 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))))