
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - 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 * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - 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 * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 5e+284) (- (* x x) (fma (* (* y 4.0) z) z (* (* y -4.0) t))) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 5e+284) {
tmp = (x * x) - fma(((y * 4.0) * z), z, ((y * -4.0) * t));
} else {
tmp = x * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 5e+284) tmp = Float64(Float64(x * x) - fma(Float64(Float64(y * 4.0) * z), z, Float64(Float64(y * -4.0) * t))); else tmp = Float64(x * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e+284], N[(N[(x * x), $MachinePrecision] - N[(N[(N[(y * 4.0), $MachinePrecision] * z), $MachinePrecision] * z + N[(N[(y * -4.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+284}:\\
\;\;\;\;x \cdot x - \mathsf{fma}\left(\left(y \cdot 4\right) \cdot z, z, \left(y \cdot -4\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 4.9999999999999999e284Initial program 93.1%
sub-negN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-eval97.8
Applied egg-rr97.8%
if 4.9999999999999999e284 < (*.f64 x x) Initial program 82.5%
Taylor expanded in x around inf
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6495.2
Simplified95.2%
+-rgt-identityN/A
*-lowering-*.f6495.2
Applied egg-rr95.2%
(FPCore (x y z t) :precision binary64 (if (<= z 2.5e+151) (- (* x x) (fma (* y -4.0) t (* 4.0 (* y (* z z))))) (fma -4.0 (fma (- 0.0 t) y (* z (* y z))) 0.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.5e+151) {
tmp = (x * x) - fma((y * -4.0), t, (4.0 * (y * (z * z))));
} else {
tmp = fma(-4.0, fma((0.0 - t), y, (z * (y * z))), 0.0);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 2.5e+151) tmp = Float64(Float64(x * x) - fma(Float64(y * -4.0), t, Float64(4.0 * Float64(y * Float64(z * z))))); else tmp = fma(-4.0, fma(Float64(0.0 - t), y, Float64(z * Float64(y * z))), 0.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 2.5e+151], N[(N[(x * x), $MachinePrecision] - N[(N[(y * -4.0), $MachinePrecision] * t + N[(4.0 * N[(y * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(0.0 - t), $MachinePrecision] * y + N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 0.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.5 \cdot 10^{+151}:\\
\;\;\;\;x \cdot x - \mathsf{fma}\left(y \cdot -4, t, 4 \cdot \left(y \cdot \left(z \cdot z\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \mathsf{fma}\left(0 - t, y, z \cdot \left(y \cdot z\right)\right), 0\right)\\
\end{array}
\end{array}
if z < 2.5000000000000001e151Initial program 94.2%
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
accelerator-lowering-fma.f64N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6494.2
Applied egg-rr94.2%
if 2.5000000000000001e151 < z Initial program 68.0%
Taylor expanded in x around 0
+-lft-identityN/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6476.4
Simplified76.4%
+-rgt-identityN/A
*-lowering-*.f6476.4
Applied egg-rr76.4%
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6476.4
Applied egg-rr76.4%
+-rgt-identityN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6494.4
Applied egg-rr94.4%
Final simplification94.2%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+301) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (fma -4.0 (fma (- 0.0 t) y (* z (* y z))) 0.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+301) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = fma(-4.0, fma((0.0 - t), y, (z * (y * z))), 0.0);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+301) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = fma(-4.0, fma(Float64(0.0 - t), y, Float64(z * Float64(y * z))), 0.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+301], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(0.0 - t), $MachinePrecision] * y + N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 0.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+301}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \mathsf{fma}\left(0 - t, y, z \cdot \left(y \cdot z\right)\right), 0\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000005e301Initial program 98.3%
if 1.00000000000000005e301 < (*.f64 z z) Initial program 69.7%
Taylor expanded in x around 0
+-lft-identityN/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6474.0
Simplified74.0%
+-rgt-identityN/A
*-lowering-*.f6474.0
Applied egg-rr74.0%
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6474.0
Applied egg-rr74.0%
+-rgt-identityN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6487.5
Applied egg-rr87.5%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1e+203) (fma -4.0 (fma (- 0.0 t) y (* z (* y z))) 0.0) (fma y (* 4.0 t) (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1e+203) {
tmp = fma(-4.0, fma((0.0 - t), y, (z * (y * z))), 0.0);
} else {
tmp = fma(y, (4.0 * t), (x * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1e+203) tmp = fma(-4.0, fma(Float64(0.0 - t), y, Float64(z * Float64(y * z))), 0.0); else tmp = fma(y, Float64(4.0 * t), Float64(x * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e+203], N[(-4.0 * N[(N[(0.0 - t), $MachinePrecision] * y + N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 0.0), $MachinePrecision], N[(y * N[(4.0 * t), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{+203}:\\
\;\;\;\;\mathsf{fma}\left(-4, \mathsf{fma}\left(0 - t, y, z \cdot \left(y \cdot z\right)\right), 0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 4 \cdot t, x \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 9.9999999999999999e202Initial program 92.2%
Taylor expanded in x around 0
+-lft-identityN/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6481.1
Simplified81.1%
+-rgt-identityN/A
*-lowering-*.f6481.1
Applied egg-rr81.1%
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
distribute-rgt-neg-outN/A
*-commutativeN/A
distribute-lft-neg-outN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-rgt-identityN/A
accelerator-lowering-fma.f6480.5
Applied egg-rr80.5%
+-rgt-identityN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6488.2
Applied egg-rr88.2%
if 9.9999999999999999e202 < (*.f64 x x) Initial program 87.0%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6491.9
Simplified91.9%
+-rgt-identityN/A
*-lowering-*.f6491.9
Applied egg-rr91.9%
Final simplification89.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (* z (* y -4.0)))))
(if (<= x 8.2e-224)
t_1
(if (<= x 7.5e-122) (* 4.0 (* y t)) (if (<= x 3e+101) t_1 (* x x))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (z * (y * -4.0));
double tmp;
if (x <= 8.2e-224) {
tmp = t_1;
} else if (x <= 7.5e-122) {
tmp = 4.0 * (y * t);
} else if (x <= 3e+101) {
tmp = t_1;
} else {
tmp = x * x;
}
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 = z * (z * (y * (-4.0d0)))
if (x <= 8.2d-224) then
tmp = t_1
else if (x <= 7.5d-122) then
tmp = 4.0d0 * (y * t)
else if (x <= 3d+101) then
tmp = t_1
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (z * (y * -4.0));
double tmp;
if (x <= 8.2e-224) {
tmp = t_1;
} else if (x <= 7.5e-122) {
tmp = 4.0 * (y * t);
} else if (x <= 3e+101) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (z * (y * -4.0)) tmp = 0 if x <= 8.2e-224: tmp = t_1 elif x <= 7.5e-122: tmp = 4.0 * (y * t) elif x <= 3e+101: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(z * Float64(y * -4.0))) tmp = 0.0 if (x <= 8.2e-224) tmp = t_1; elseif (x <= 7.5e-122) tmp = Float64(4.0 * Float64(y * t)); elseif (x <= 3e+101) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (z * (y * -4.0)); tmp = 0.0; if (x <= 8.2e-224) tmp = t_1; elseif (x <= 7.5e-122) tmp = 4.0 * (y * t); elseif (x <= 3e+101) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 8.2e-224], t$95$1, If[LessEqual[x, 7.5e-122], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3e+101], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\mathbf{if}\;x \leq 8.2 \cdot 10^{-224}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.5 \cdot 10^{-122}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 8.19999999999999972e-224 or 7.4999999999999998e-122 < x < 2.99999999999999993e101Initial program 88.9%
Taylor expanded in z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6444.8
Simplified44.8%
+-rgt-identityN/A
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
+-rgt-identityN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-lowering-*.f6451.0
Applied egg-rr51.0%
if 8.19999999999999972e-224 < x < 7.4999999999999998e-122Initial program 95.6%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6476.9
Simplified76.9%
Taylor expanded in y around inf
*-lowering-*.f64N/A
*-lowering-*.f6468.2
Simplified68.2%
if 2.99999999999999993e101 < x Initial program 94.1%
Taylor expanded in x around inf
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6490.4
Simplified90.4%
+-rgt-identityN/A
*-lowering-*.f6490.4
Applied egg-rr90.4%
Final simplification60.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* z (* z -4.0)))))
(if (<= x 2e-221)
t_1
(if (<= x 8.8e-104) (* 4.0 (* y t)) (if (<= x 4e+101) t_1 (* x x))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z * (z * -4.0));
double tmp;
if (x <= 2e-221) {
tmp = t_1;
} else if (x <= 8.8e-104) {
tmp = 4.0 * (y * t);
} else if (x <= 4e+101) {
tmp = t_1;
} else {
tmp = x * x;
}
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 = y * (z * (z * (-4.0d0)))
if (x <= 2d-221) then
tmp = t_1
else if (x <= 8.8d-104) then
tmp = 4.0d0 * (y * t)
else if (x <= 4d+101) then
tmp = t_1
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z * (z * -4.0));
double tmp;
if (x <= 2e-221) {
tmp = t_1;
} else if (x <= 8.8e-104) {
tmp = 4.0 * (y * t);
} else if (x <= 4e+101) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z * (z * -4.0)) tmp = 0 if x <= 2e-221: tmp = t_1 elif x <= 8.8e-104: tmp = 4.0 * (y * t) elif x <= 4e+101: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z * Float64(z * -4.0))) tmp = 0.0 if (x <= 2e-221) tmp = t_1; elseif (x <= 8.8e-104) tmp = Float64(4.0 * Float64(y * t)); elseif (x <= 4e+101) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z * (z * -4.0)); tmp = 0.0; if (x <= 2e-221) tmp = t_1; elseif (x <= 8.8e-104) tmp = 4.0 * (y * t); elseif (x <= 4e+101) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2e-221], t$95$1, If[LessEqual[x, 8.8e-104], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4e+101], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z \cdot \left(z \cdot -4\right)\right)\\
\mathbf{if}\;x \leq 2 \cdot 10^{-221}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-104}:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 2.00000000000000003e-221 or 8.80000000000000047e-104 < x < 3.9999999999999999e101Initial program 88.6%
Taylor expanded in z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6445.7
Simplified45.7%
+-rgt-identityN/A
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
+-rgt-identityN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-lowering-*.f6452.0
Applied egg-rr52.0%
associate-*l*N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6445.7
Applied egg-rr45.7%
if 2.00000000000000003e-221 < x < 8.80000000000000047e-104Initial program 96.3%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6480.6
Simplified80.6%
Taylor expanded in y around inf
*-lowering-*.f64N/A
*-lowering-*.f6469.6
Simplified69.6%
if 3.9999999999999999e101 < x Initial program 94.1%
Taylor expanded in x around inf
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6490.4
Simplified90.4%
+-rgt-identityN/A
*-lowering-*.f6490.4
Applied egg-rr90.4%
Final simplification57.0%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 4e-7) (* (* y 4.0) (fma z (- 0.0 z) t)) (fma y (* 4.0 t) (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 4e-7) {
tmp = (y * 4.0) * fma(z, (0.0 - z), t);
} else {
tmp = fma(y, (4.0 * t), (x * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 4e-7) tmp = Float64(Float64(y * 4.0) * fma(z, Float64(0.0 - z), t)); else tmp = fma(y, Float64(4.0 * t), Float64(x * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 4e-7], N[(N[(y * 4.0), $MachinePrecision] * N[(z * N[(0.0 - z), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(y * N[(4.0 * t), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4 \cdot 10^{-7}:\\
\;\;\;\;\left(y \cdot 4\right) \cdot \mathsf{fma}\left(z, 0 - z, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 4 \cdot t, x \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 3.9999999999999998e-7Initial program 94.3%
Taylor expanded in x around 0
+-lft-identityN/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6488.7
Simplified88.7%
+-rgt-identityN/A
*-lowering-*.f6488.7
Applied egg-rr88.7%
+-rgt-identityN/A
associate-*r*N/A
*-commutativeN/A
+-rgt-identityN/A
metadata-evalN/A
associate-/l*N/A
associate-/r/N/A
div-invN/A
clear-numN/A
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr88.7%
if 3.9999999999999998e-7 < (*.f64 x x) Initial program 86.2%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6480.8
Simplified80.8%
+-rgt-identityN/A
*-lowering-*.f6480.8
Applied egg-rr80.8%
Final simplification85.0%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+197) (fma y (* 4.0 t) (* x x)) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+197) {
tmp = fma(y, (4.0 * t), (x * x));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+197) tmp = fma(y, Float64(4.0 * t), Float64(x * x)); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+197], N[(y * N[(4.0 * t), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+197}:\\
\;\;\;\;\mathsf{fma}\left(y, 4 \cdot t, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.9999999999999995e196Initial program 98.0%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6485.3
Simplified85.3%
+-rgt-identityN/A
*-lowering-*.f6485.3
Applied egg-rr85.3%
if 9.9999999999999995e196 < (*.f64 z z) Initial program 77.9%
Taylor expanded in z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6473.0
Simplified73.0%
+-rgt-identityN/A
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
+-rgt-identityN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-lowering-*.f6482.8
Applied egg-rr82.8%
Final simplification84.3%
(FPCore (x y z t) :precision binary64 (if (<= x 95000.0) (* 4.0 (* y t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 95000.0) {
tmp = 4.0 * (y * t);
} else {
tmp = x * x;
}
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 (x <= 95000.0d0) then
tmp = 4.0d0 * (y * t)
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 95000.0) {
tmp = 4.0 * (y * t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 95000.0: tmp = 4.0 * (y * t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 95000.0) tmp = Float64(4.0 * Float64(y * t)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 95000.0) tmp = 4.0 * (y * t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 95000.0], N[(4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 95000:\\
\;\;\;\;4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 95000Initial program 90.6%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6462.2
Simplified62.2%
Taylor expanded in y around inf
*-lowering-*.f64N/A
*-lowering-*.f6440.9
Simplified40.9%
if 95000 < x Initial program 90.3%
Taylor expanded in x around inf
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6476.3
Simplified76.3%
+-rgt-identityN/A
*-lowering-*.f6476.3
Applied egg-rr76.3%
Final simplification50.6%
(FPCore (x y z t) :precision binary64 (* x x))
double code(double x, double y, double z, double t) {
return x * x;
}
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 * x
end function
public static double code(double x, double y, double z, double t) {
return x * x;
}
def code(x, y, z, t): return x * x
function code(x, y, z, t) return Float64(x * x) end
function tmp = code(x, y, z, t) tmp = x * x; end
code[x_, y_, z_, t_] := N[(x * x), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x
\end{array}
Initial program 90.5%
Taylor expanded in x around inf
+-rgt-identityN/A
unpow2N/A
accelerator-lowering-fma.f6440.3
Simplified40.3%
+-rgt-identityN/A
*-lowering-*.f6440.3
Applied egg-rr40.3%
(FPCore (x y z t) :precision binary64 (- (* x x) (* 4.0 (* y (- (* z z) t)))))
double code(double x, double y, double z, double t) {
return (x * x) - (4.0 * (y * ((z * z) - 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 * x) - (4.0d0 * (y * ((z * z) - t)))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - (4.0 * (y * ((z * z) - t)));
}
def code(x, y, z, t): return (x * x) - (4.0 * (y * ((z * z) - t)))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(4.0 * Float64(y * Float64(Float64(z * z) - t)))) end
function tmp = code(x, y, z, t) tmp = (x * x) - (4.0 * (y * ((z * z) - t))); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(4.0 * N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - 4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)
\end{array}
herbie shell --seed 2024195
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:alt
(! :herbie-platform default (- (* x x) (* 4 (* y (- (* z z) t)))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))