
(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 9 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 (<= (* y 4.0) 5e-52) (fma (* (* y -4.0) z) z (fma -4.0 (- (* y t)) (* x x))) (fma x x (* y (* -4.0 (fma z z (- t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y * 4.0) <= 5e-52) {
tmp = fma(((y * -4.0) * z), z, fma(-4.0, -(y * t), (x * x)));
} else {
tmp = fma(x, x, (y * (-4.0 * fma(z, z, -t))));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(y * 4.0) <= 5e-52) tmp = fma(Float64(Float64(y * -4.0) * z), z, fma(-4.0, Float64(-Float64(y * t)), Float64(x * x))); else tmp = fma(x, x, Float64(y * Float64(-4.0 * fma(z, z, Float64(-t))))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(y * 4.0), $MachinePrecision], 5e-52], N[(N[(N[(y * -4.0), $MachinePrecision] * z), $MachinePrecision] * z + N[(-4.0 * (-N[(y * t), $MachinePrecision]) + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x + N[(y * N[(-4.0 * N[(z * z + (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot 4 \leq 5 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(\left(y \cdot -4\right) \cdot z, z, \mathsf{fma}\left(-4, -y \cdot t, x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, x, y \cdot \left(-4 \cdot \mathsf{fma}\left(z, z, -t\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 y #s(literal 4 binary64)) < 5e-52Initial program 89.1%
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
associate-*r*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
Applied egg-rr97.7%
if 5e-52 < (*.f64 y #s(literal 4 binary64)) Initial program 92.5%
sub-negN/A
accelerator-lowering-fma.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
metadata-eval97.5
Applied egg-rr97.5%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 5e+86)
(fma y (* 4.0 t) (* x x))
(if (<= (* z z) 2e+287)
(fma y (* -4.0 (* z z)) (* x x))
(* -4.0 (* z (* y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+86) {
tmp = fma(y, (4.0 * t), (x * x));
} else if ((z * z) <= 2e+287) {
tmp = fma(y, (-4.0 * (z * z)), (x * x));
} else {
tmp = -4.0 * (z * (y * z));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+86) tmp = fma(y, Float64(4.0 * t), Float64(x * x)); elseif (Float64(z * z) <= 2e+287) tmp = fma(y, Float64(-4.0 * Float64(z * z)), Float64(x * x)); else tmp = Float64(-4.0 * Float64(z * Float64(y * z))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+86], N[(y * N[(4.0 * t), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+287], N[(y * N[(-4.0 * N[(z * z), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(y, 4 \cdot t, x \cdot x\right)\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+287}:\\
\;\;\;\;\mathsf{fma}\left(y, -4 \cdot \left(z \cdot z\right), x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.9999999999999998e86Initial program 97.9%
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
unpow2N/A
*-lowering-*.f6493.5
Simplified93.5%
if 4.9999999999999998e86 < (*.f64 z z) < 2.0000000000000002e287Initial program 97.3%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6492.4
Simplified92.4%
if 2.0000000000000002e287 < (*.f64 z z) Initial program 70.4%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6474.6
Simplified74.6%
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6484.9
Applied egg-rr84.9%
Final simplification90.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z z) t)))
(if (<= t_1 -2e-107)
(* y (* 4.0 t))
(if (<= t_1 1e+143) (* x x) (* -4.0 (* z (* y z)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (t_1 <= -2e-107) {
tmp = y * (4.0 * t);
} else if (t_1 <= 1e+143) {
tmp = x * x;
} else {
tmp = -4.0 * (z * (y * z));
}
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) - t
if (t_1 <= (-2d-107)) then
tmp = y * (4.0d0 * t)
else if (t_1 <= 1d+143) then
tmp = x * x
else
tmp = (-4.0d0) * (z * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (t_1 <= -2e-107) {
tmp = y * (4.0 * t);
} else if (t_1 <= 1e+143) {
tmp = x * x;
} else {
tmp = -4.0 * (z * (y * z));
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * z) - t tmp = 0 if t_1 <= -2e-107: tmp = y * (4.0 * t) elif t_1 <= 1e+143: tmp = x * x else: tmp = -4.0 * (z * (y * z)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * z) - t) tmp = 0.0 if (t_1 <= -2e-107) tmp = Float64(y * Float64(4.0 * t)); elseif (t_1 <= 1e+143) tmp = Float64(x * x); else tmp = Float64(-4.0 * Float64(z * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * z) - t; tmp = 0.0; if (t_1 <= -2e-107) tmp = y * (4.0 * t); elseif (t_1 <= 1e+143) tmp = x * x; else tmp = -4.0 * (z * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-107], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+143], N[(x * x), $MachinePrecision], N[(-4.0 * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot z - t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-107}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+143}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < -2e-107Initial program 97.9%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6472.8
Simplified72.8%
if -2e-107 < (-.f64 (*.f64 z z) t) < 1e143Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6460.1
Simplified60.1%
if 1e143 < (-.f64 (*.f64 z z) t) Initial program 80.4%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6462.6
Simplified62.6%
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6468.5
Applied egg-rr68.5%
Final simplification66.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z z) t)))
(if (<= t_1 -2e-107)
(* y (* 4.0 t))
(if (<= t_1 1e+143) (* x x) (* y (* -4.0 (* z z)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (t_1 <= -2e-107) {
tmp = y * (4.0 * t);
} else if (t_1 <= 1e+143) {
tmp = x * x;
} else {
tmp = y * (-4.0 * (z * z));
}
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) - t
if (t_1 <= (-2d-107)) then
tmp = y * (4.0d0 * t)
else if (t_1 <= 1d+143) then
tmp = x * x
else
tmp = y * ((-4.0d0) * (z * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (t_1 <= -2e-107) {
tmp = y * (4.0 * t);
} else if (t_1 <= 1e+143) {
tmp = x * x;
} else {
tmp = y * (-4.0 * (z * z));
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * z) - t tmp = 0 if t_1 <= -2e-107: tmp = y * (4.0 * t) elif t_1 <= 1e+143: tmp = x * x else: tmp = y * (-4.0 * (z * z)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * z) - t) tmp = 0.0 if (t_1 <= -2e-107) tmp = Float64(y * Float64(4.0 * t)); elseif (t_1 <= 1e+143) tmp = Float64(x * x); else tmp = Float64(y * Float64(-4.0 * Float64(z * z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * z) - t; tmp = 0.0; if (t_1 <= -2e-107) tmp = y * (4.0 * t); elseif (t_1 <= 1e+143) tmp = x * x; else tmp = y * (-4.0 * (z * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-107], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+143], N[(x * x), $MachinePrecision], N[(y * N[(-4.0 * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot z - t\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-107}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+143}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-4 \cdot \left(z \cdot z\right)\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < -2e-107Initial program 97.9%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6472.8
Simplified72.8%
if -2e-107 < (-.f64 (*.f64 z z) t) < 1e143Initial program 99.9%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6460.1
Simplified60.1%
if 1e143 < (-.f64 (*.f64 z z) t) Initial program 80.4%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6462.6
Simplified62.6%
Final simplification63.6%
(FPCore (x y z t) :precision binary64 (if (<= z 3.6e+151) (fma x x (* y (* -4.0 (fma z z (- t))))) (* -4.0 (* z (* y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 3.6e+151) {
tmp = fma(x, x, (y * (-4.0 * fma(z, z, -t))));
} else {
tmp = -4.0 * (z * (y * z));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 3.6e+151) tmp = fma(x, x, Float64(y * Float64(-4.0 * fma(z, z, Float64(-t))))); else tmp = Float64(-4.0 * Float64(z * Float64(y * z))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 3.6e+151], N[(x * x + N[(y * N[(-4.0 * N[(z * z + (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.6 \cdot 10^{+151}:\\
\;\;\;\;\mathsf{fma}\left(x, x, y \cdot \left(-4 \cdot \mathsf{fma}\left(z, z, -t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < 3.6e151Initial program 94.3%
sub-negN/A
accelerator-lowering-fma.f64N/A
associate-*l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
sub-negN/A
accelerator-lowering-fma.f64N/A
neg-lowering-neg.f64N/A
metadata-eval95.2
Applied egg-rr95.2%
if 3.6e151 < z Initial program 61.1%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.4
Simplified67.4%
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6490.5
Applied egg-rr90.5%
Final simplification94.7%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+155) (fma y (* 4.0 t) (* x x)) (* -4.0 (* z (* y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+155) {
tmp = fma(y, (4.0 * t), (x * x));
} else {
tmp = -4.0 * (z * (y * z));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+155) tmp = fma(y, Float64(4.0 * t), Float64(x * x)); else tmp = Float64(-4.0 * Float64(z * Float64(y * z))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+155], N[(y * N[(4.0 * t), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+155}:\\
\;\;\;\;\mathsf{fma}\left(y, 4 \cdot t, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000001e155Initial program 98.1%
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
unpow2N/A
*-lowering-*.f6491.0
Simplified91.0%
if 1.00000000000000001e155 < (*.f64 z z) Initial program 77.5%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.8
Simplified75.8%
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6483.2
Applied egg-rr83.2%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (<= z 4.2e+77) (fma x x (* y (* 4.0 t))) (* -4.0 (* z (* y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 4.2e+77) {
tmp = fma(x, x, (y * (4.0 * t)));
} else {
tmp = -4.0 * (z * (y * z));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 4.2e+77) tmp = fma(x, x, Float64(y * Float64(4.0 * t))); else tmp = Float64(-4.0 * Float64(z * Float64(y * z))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 4.2e+77], N[(x * x + N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 4.2 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(x, x, y \cdot \left(4 \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < 4.1999999999999997e77Initial program 94.5%
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
unpow2N/A
*-lowering-*.f6477.8
Simplified77.8%
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
associate-*r*N/A
neg-mul-1N/A
distribute-rgt-neg-outN/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6475.9
Applied egg-rr75.9%
if 4.1999999999999997e77 < z Initial program 70.7%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6467.1
Simplified67.1%
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6483.2
Applied egg-rr83.2%
Final simplification77.2%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 5e+68) (* y (* 4.0 t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 5e+68) {
tmp = y * (4.0 * 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 * x) <= 5d+68) then
tmp = y * (4.0d0 * 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 * x) <= 5e+68) {
tmp = y * (4.0 * t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 5e+68: tmp = y * (4.0 * t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 5e+68) tmp = Float64(y * Float64(4.0 * t)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 5e+68) tmp = y * (4.0 * t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 5e+68], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5 \cdot 10^{+68}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 5.0000000000000004e68Initial program 94.0%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6450.3
Simplified50.3%
if 5.0000000000000004e68 < (*.f64 x x) Initial program 85.5%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6474.3
Simplified74.3%
Final simplification61.1%
(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.2%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6440.7
Simplified40.7%
(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 2024198
(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))))