
(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 12 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 (* 2.0 (* z (exp (* t t)))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((2.0 * (z * exp((t * t)))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x * 0.5d0) - y) * sqrt((2.0d0 * (z * exp((t * t)))))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((2.0 * (z * Math.exp((t * t)))));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((2.0 * (z * math.exp((t * t)))))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * Float64(z * exp(Float64(t * t)))))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((2.0 * (z * exp((t * t))))); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(z * N[Exp[N[(t * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z \cdot e^{t \cdot t}\right)}
\end{array}
Initial program 99.8%
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* x 0.5) y)))
(*
(sqrt z)
(fma
(sqrt 2.0)
(* t_1 (fma 0.5 (* t t) 1.0))
(*
(* (sqrt 2.0) (* t_1 (fma t (* t 0.020833333333333332) 0.125)))
(* (* t t) (* t t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x * 0.5) - y;
return sqrt(z) * fma(sqrt(2.0), (t_1 * fma(0.5, (t * t), 1.0)), ((sqrt(2.0) * (t_1 * fma(t, (t * 0.020833333333333332), 0.125))) * ((t * t) * (t * t))));
}
function code(x, y, z, t) t_1 = Float64(Float64(x * 0.5) - y) return Float64(sqrt(z) * fma(sqrt(2.0), Float64(t_1 * fma(0.5, Float64(t * t), 1.0)), Float64(Float64(sqrt(2.0) * Float64(t_1 * fma(t, Float64(t * 0.020833333333333332), 0.125))) * Float64(Float64(t * t) * Float64(t * t))))) end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision]}, N[(N[Sqrt[z], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$1 * N[(0.5 * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$1 * N[(t * N[(t * 0.020833333333333332), $MachinePrecision] + 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * N[(t * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot 0.5 - y\\
\sqrt{z} \cdot \mathsf{fma}\left(\sqrt{2}, t\_1 \cdot \mathsf{fma}\left(0.5, t \cdot t, 1\right), \left(\sqrt{2} \cdot \left(t\_1 \cdot \mathsf{fma}\left(t, t \cdot 0.020833333333333332, 0.125\right)\right)\right) \cdot \left(\left(t \cdot t\right) \cdot \left(t \cdot t\right)\right)\right)
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
Simplified95.2%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr95.5%
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
rem-square-sqrtN/A
sqrt-lowering-sqrt.f64N/A
rem-square-sqrtN/A
associate-*l*N/A
Applied egg-rr95.9%
Final simplification95.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- (* x 0.5) y) (sqrt 2.0))))
(fma
t_1
(sqrt z)
(*
(sqrt z)
(*
(* t t)
(* (* t t) (* t_1 (fma (* t t) 0.020833333333333332 0.125))))))))
double code(double x, double y, double z, double t) {
double t_1 = ((x * 0.5) - y) * sqrt(2.0);
return fma(t_1, sqrt(z), (sqrt(z) * ((t * t) * ((t * t) * (t_1 * fma((t * t), 0.020833333333333332, 0.125))))));
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x * 0.5) - y) * sqrt(2.0)) return fma(t_1, sqrt(z), Float64(sqrt(z) * Float64(Float64(t * t) * Float64(Float64(t * t) * Float64(t_1 * fma(Float64(t * t), 0.020833333333333332, 0.125)))))) end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(t$95$1 * N[Sqrt[z], $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * N[(t$95$1 * N[(N[(t * t), $MachinePrecision] * 0.020833333333333332 + 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 0.5 - y\right) \cdot \sqrt{2}\\
\mathsf{fma}\left(t\_1, \sqrt{z}, \sqrt{z} \cdot \left(\left(t \cdot t\right) \cdot \left(\left(t \cdot t\right) \cdot \left(t\_1 \cdot \mathsf{fma}\left(t \cdot t, 0.020833333333333332, 0.125\right)\right)\right)\right)\right)
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
Simplified95.2%
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
Applied egg-rr95.5%
Taylor expanded in t around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
--lowering--.f64N/A
*-lowering-*.f6495.5
Simplified95.5%
Final simplification95.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- (* x 0.5) y) (sqrt 2.0))))
(fma
(* t t)
(* (sqrt z) (* (* t t) (* t_1 (fma (* t t) 0.020833333333333332 0.125))))
(* (sqrt z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((x * 0.5) - y) * sqrt(2.0);
return fma((t * t), (sqrt(z) * ((t * t) * (t_1 * fma((t * t), 0.020833333333333332, 0.125)))), (sqrt(z) * t_1));
}
function code(x, y, z, t) t_1 = Float64(Float64(Float64(x * 0.5) - y) * sqrt(2.0)) return fma(Float64(t * t), Float64(sqrt(z) * Float64(Float64(t * t) * Float64(t_1 * fma(Float64(t * t), 0.020833333333333332, 0.125)))), Float64(sqrt(z) * t_1)) end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]}, N[(N[(t * t), $MachinePrecision] * N[(N[Sqrt[z], $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * N[(t$95$1 * N[(N[(t * t), $MachinePrecision] * 0.020833333333333332 + 0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sqrt[z], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot 0.5 - y\right) \cdot \sqrt{2}\\
\mathsf{fma}\left(t \cdot t, \sqrt{z} \cdot \left(\left(t \cdot t\right) \cdot \left(t\_1 \cdot \mathsf{fma}\left(t \cdot t, 0.020833333333333332, 0.125\right)\right)\right), \sqrt{z} \cdot t\_1\right)
\end{array}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
Simplified95.2%
Taylor expanded in t around 0
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
--lowering--.f64N/A
*-lowering-*.f6495.1
Simplified95.1%
Final simplification95.1%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* 2.0 z))) (fma (* t t) (fma (* t t) (fma (* t t) 0.020833333333333332 0.125) 0.5) 1.0)))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((2.0 * z))) * fma((t * t), fma((t * t), fma((t * t), 0.020833333333333332, 0.125), 0.5), 1.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))) * fma(Float64(t * t), fma(Float64(t * t), fma(Float64(t * t), 0.020833333333333332, 0.125), 0.5), 1.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.020833333333333332 + 0.125), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\right) \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t \cdot t, 0.020833333333333332, 0.125\right), 0.5\right), 1\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6494.7
Simplified94.7%
Final simplification94.7%
(FPCore (x y z t) :precision binary64 (* (* (- (* x 0.5) y) (sqrt (* 2.0 z))) (fma (* t t) (fma t (* t 0.125) 0.5) 1.0)))
double code(double x, double y, double z, double t) {
return (((x * 0.5) - y) * sqrt((2.0 * z))) * fma((t * t), fma(t, (t * 0.125), 0.5), 1.0);
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))) * fma(Float64(t * t), fma(t, Float64(t * 0.125), 0.5), 1.0)) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * N[(t * N[(t * 0.125), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\right) \cdot \mathsf{fma}\left(t \cdot t, \mathsf{fma}\left(t, t \cdot 0.125, 0.5\right), 1\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6494.3
Simplified94.3%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* z (fma (fma t t 2.0) (* t t) 2.0)))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((z * fma(fma(t, t, 2.0), (t * t), 2.0)));
}
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(z * fma(fma(t, t, 2.0), Float64(t * t), 2.0)))) end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(z * N[(N[(t * t + 2.0), $MachinePrecision] * N[(t * t), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{z \cdot \mathsf{fma}\left(\mathsf{fma}\left(t, t, 2\right), t \cdot t, 2\right)}
\end{array}
Initial program 99.8%
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
distribute-rgt-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6493.2
Simplified93.2%
(FPCore (x y z t) :precision binary64 (if (<= (* t t) 5e+107) (* (- (* x 0.5) y) (sqrt (* 2.0 z))) (* (sqrt (* 2.0 (* z (fma t t 1.0)))) (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t * t) <= 5e+107) {
tmp = ((x * 0.5) - y) * sqrt((2.0 * z));
} else {
tmp = sqrt((2.0 * (z * fma(t, t, 1.0)))) * -y;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(t * t) <= 5e+107) tmp = Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))); else tmp = Float64(sqrt(Float64(2.0 * Float64(z * fma(t, t, 1.0)))) * Float64(-y)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(t * t), $MachinePrecision], 5e+107], N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(z * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot t \leq 5 \cdot 10^{+107}:\\
\;\;\;\;\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(z \cdot \mathsf{fma}\left(t, t, 1\right)\right)} \cdot \left(-y\right)\\
\end{array}
\end{array}
if (*.f64 t t) < 5.0000000000000002e107Initial program 99.7%
Taylor expanded in t around 0
Simplified88.8%
*-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
*-lowering-*.f6488.8
Applied egg-rr88.8%
if 5.0000000000000002e107 < (*.f64 t t) Initial program 100.0%
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f64100.0
Applied egg-rr100.0%
Taylor expanded in t around 0
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6479.5
Simplified79.5%
Taylor expanded in x around 0
mul-1-negN/A
neg-lowering-neg.f6460.4
Simplified60.4%
Final simplification76.9%
(FPCore (x y z t) :precision binary64 (* (fma 0.5 (* t t) 1.0) (* (- (* x 0.5) y) (sqrt (* 2.0 z)))))
double code(double x, double y, double z, double t) {
return fma(0.5, (t * t), 1.0) * (((x * 0.5) - y) * sqrt((2.0 * z)));
}
function code(x, y, z, t) return Float64(fma(0.5, Float64(t * t), 1.0) * Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z)))) end
code[x_, y_, z_, t_] := N[(N[(0.5 * N[(t * t), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(0.5, t \cdot t, 1\right) \cdot \left(\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6486.5
Simplified86.5%
Final simplification86.5%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* 2.0 (* z (fma t t 1.0))))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((2.0 * (z * fma(t, t, 1.0))));
}
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * Float64(z * fma(t, t, 1.0))))) end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * N[(z * N[(t * t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot \left(z \cdot \mathsf{fma}\left(t, t, 1\right)\right)}
\end{array}
Initial program 99.8%
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
exp-sqrtN/A
sqrt-unprodN/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
exp-lowering-exp.f64N/A
*-lowering-*.f6499.8
Applied egg-rr99.8%
Taylor expanded in t around 0
+-commutativeN/A
unpow2N/A
accelerator-lowering-fma.f6485.0
Simplified85.0%
(FPCore (x y z t) :precision binary64 (* (- (* x 0.5) y) (sqrt (* 2.0 z))))
double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * sqrt((2.0 * z));
}
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((2.0d0 * z))
end function
public static double code(double x, double y, double z, double t) {
return ((x * 0.5) - y) * Math.sqrt((2.0 * z));
}
def code(x, y, z, t): return ((x * 0.5) - y) * math.sqrt((2.0 * z))
function code(x, y, z, t) return Float64(Float64(Float64(x * 0.5) - y) * sqrt(Float64(2.0 * z))) end
function tmp = code(x, y, z, t) tmp = ((x * 0.5) - y) * sqrt((2.0 * z)); end
code[x_, y_, z_, t_] := N[(N[(N[(x * 0.5), $MachinePrecision] - y), $MachinePrecision] * N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 0.5 - y\right) \cdot \sqrt{2 \cdot z}
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
Simplified57.3%
*-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-commutativeN/A
*-lowering-*.f6457.3
Applied egg-rr57.3%
Final simplification57.3%
(FPCore (x y z t) :precision binary64 (* (sqrt (* 2.0 z)) (- y)))
double code(double x, double y, double z, double t) {
return sqrt((2.0 * z)) * -y;
}
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 = sqrt((2.0d0 * z)) * -y
end function
public static double code(double x, double y, double z, double t) {
return Math.sqrt((2.0 * z)) * -y;
}
def code(x, y, z, t): return math.sqrt((2.0 * z)) * -y
function code(x, y, z, t) return Float64(sqrt(Float64(2.0 * z)) * Float64(-y)) end
function tmp = code(x, y, z, t) tmp = sqrt((2.0 * z)) * -y; end
code[x_, y_, z_, t_] := N[(N[Sqrt[N[(2.0 * z), $MachinePrecision]], $MachinePrecision] * (-y)), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{2 \cdot z} \cdot \left(-y\right)
\end{array}
Initial program 99.8%
Taylor expanded in t around 0
Simplified57.3%
Taylor expanded in x around 0
mul-1-negN/A
neg-lowering-neg.f6430.4
Simplified30.4%
*-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
sqrt-lowering-sqrt.f64N/A
*-lowering-*.f64N/A
neg-lowering-neg.f6430.4
Applied egg-rr30.4%
Final simplification30.4%
(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 2024198
(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))))