
(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 (<= (* z z) 5e+289) (fma (fma z z (- t)) (* y -4.0) (* x x)) (fma (/ z (/ -0.25 y)) z (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+289) {
tmp = fma(fma(z, z, -t), (y * -4.0), (x * x));
} else {
tmp = fma((z / (-0.25 / y)), z, (x * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+289) tmp = fma(fma(z, z, Float64(-t)), Float64(y * -4.0), Float64(x * x)); else tmp = fma(Float64(z / Float64(-0.25 / y)), z, Float64(x * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+289], N[(N[(z * z + (-t)), $MachinePrecision] * N[(y * -4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(z / N[(-0.25 / y), $MachinePrecision]), $MachinePrecision] * z + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+289}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, z, -t\right), y \cdot -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\frac{-0.25}{y}}, z, x \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000031e289Initial program 98.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
if 5.00000000000000031e289 < (*.f64 z z) Initial program 70.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied egg-rr85.4%
Taylor expanded in y around 0
unpow2N/A
lower-*.f6495.6
Simplified95.6%
metadata-evalN/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
/-rgt-identityN/A
distribute-neg-frac2N/A
metadata-evalN/A
clear-numN/A
lower-/.f64N/A
lower-/.f6495.6
Applied egg-rr95.6%
lift-*.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/l*N/A
metadata-evalN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
metadata-evalN/A
associate-/l*N/A
lift-*.f64N/A
clear-numN/A
lift-/.f64N/A
un-div-invN/A
lower-/.f6495.6
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
lower-/.f64N/A
metadata-eval95.6
Applied egg-rr95.6%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1.6e+34) (* y (fma (* z -4.0) z (* t 4.0))) (if (<= (* x x) 1.45e+272) (fma -4.0 (* (* z z) y) (* x x)) (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1.6e+34) {
tmp = y * fma((z * -4.0), z, (t * 4.0));
} else if ((x * x) <= 1.45e+272) {
tmp = fma(-4.0, ((z * z) * y), (x * x));
} else {
tmp = x * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1.6e+34) tmp = Float64(y * fma(Float64(z * -4.0), z, Float64(t * 4.0))); elseif (Float64(x * x) <= 1.45e+272) tmp = fma(-4.0, Float64(Float64(z * z) * y), Float64(x * x)); else tmp = Float64(x * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.6e+34], N[(y * N[(N[(z * -4.0), $MachinePrecision] * z + N[(t * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 1.45e+272], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.6 \cdot 10^{+34}:\\
\;\;\;\;y \cdot \mathsf{fma}\left(z \cdot -4, z, t \cdot 4\right)\\
\mathbf{elif}\;x \cdot x \leq 1.45 \cdot 10^{+272}:\\
\;\;\;\;\mathsf{fma}\left(-4, \left(z \cdot z\right) \cdot y, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.5999999999999999e34Initial program 94.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied egg-rr96.4%
Taylor expanded in y around inf
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
lower-*.f6487.0
Simplified87.0%
associate-*l*N/A
associate-*l*N/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.4
Applied egg-rr85.4%
if 1.5999999999999999e34 < (*.f64 x x) < 1.45e272Initial program 92.5%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6479.6
Simplified79.6%
if 1.45e272 < (*.f64 x x) Initial program 82.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6493.7
Simplified93.7%
Final simplification86.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* t 4.0))))
(if (<= z 9.5e-231)
t_1
(if (<= z 1.9e-169)
(* x x)
(if (<= z 2.8e-114)
t_1
(if (<= z 1.18e-5) (* x x) (* (* z y) (* z -4.0))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t * 4.0);
double tmp;
if (z <= 9.5e-231) {
tmp = t_1;
} else if (z <= 1.9e-169) {
tmp = x * x;
} else if (z <= 2.8e-114) {
tmp = t_1;
} else if (z <= 1.18e-5) {
tmp = x * x;
} else {
tmp = (z * y) * (z * -4.0);
}
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 * (t * 4.0d0)
if (z <= 9.5d-231) then
tmp = t_1
else if (z <= 1.9d-169) then
tmp = x * x
else if (z <= 2.8d-114) then
tmp = t_1
else if (z <= 1.18d-5) then
tmp = x * x
else
tmp = (z * y) * (z * (-4.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t * 4.0);
double tmp;
if (z <= 9.5e-231) {
tmp = t_1;
} else if (z <= 1.9e-169) {
tmp = x * x;
} else if (z <= 2.8e-114) {
tmp = t_1;
} else if (z <= 1.18e-5) {
tmp = x * x;
} else {
tmp = (z * y) * (z * -4.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t * 4.0) tmp = 0 if z <= 9.5e-231: tmp = t_1 elif z <= 1.9e-169: tmp = x * x elif z <= 2.8e-114: tmp = t_1 elif z <= 1.18e-5: tmp = x * x else: tmp = (z * y) * (z * -4.0) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t * 4.0)) tmp = 0.0 if (z <= 9.5e-231) tmp = t_1; elseif (z <= 1.9e-169) tmp = Float64(x * x); elseif (z <= 2.8e-114) tmp = t_1; elseif (z <= 1.18e-5) tmp = Float64(x * x); else tmp = Float64(Float64(z * y) * Float64(z * -4.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t * 4.0); tmp = 0.0; if (z <= 9.5e-231) tmp = t_1; elseif (z <= 1.9e-169) tmp = x * x; elseif (z <= 2.8e-114) tmp = t_1; elseif (z <= 1.18e-5) tmp = x * x; else tmp = (z * y) * (z * -4.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 9.5e-231], t$95$1, If[LessEqual[z, 1.9e-169], N[(x * x), $MachinePrecision], If[LessEqual[z, 2.8e-114], t$95$1, If[LessEqual[z, 1.18e-5], N[(x * x), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t \cdot 4\right)\\
\mathbf{if}\;z \leq 9.5 \cdot 10^{-231}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-169}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{-5}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(z \cdot -4\right)\\
\end{array}
\end{array}
if z < 9.4999999999999995e-231 or 1.9e-169 < z < 2.8000000000000001e-114Initial program 91.2%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6439.7
Simplified39.7%
if 9.4999999999999995e-231 < z < 1.9e-169 or 2.8000000000000001e-114 < z < 1.18000000000000005e-5Initial program 100.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6466.8
Simplified66.8%
if 1.18000000000000005e-5 < z Initial program 85.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.2
Simplified67.2%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6470.8
Applied egg-rr70.8%
Final simplification48.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* t 4.0))))
(if (<= z 9.5e-231)
t_1
(if (<= z 1.9e-169)
(* x x)
(if (<= z 2.8e-114)
t_1
(if (<= z 1.18e-5) (* x x) (* -4.0 (* (* z z) y))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (t * 4.0);
double tmp;
if (z <= 9.5e-231) {
tmp = t_1;
} else if (z <= 1.9e-169) {
tmp = x * x;
} else if (z <= 2.8e-114) {
tmp = t_1;
} else if (z <= 1.18e-5) {
tmp = x * x;
} else {
tmp = -4.0 * ((z * z) * y);
}
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 * (t * 4.0d0)
if (z <= 9.5d-231) then
tmp = t_1
else if (z <= 1.9d-169) then
tmp = x * x
else if (z <= 2.8d-114) then
tmp = t_1
else if (z <= 1.18d-5) then
tmp = x * x
else
tmp = (-4.0d0) * ((z * z) * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (t * 4.0);
double tmp;
if (z <= 9.5e-231) {
tmp = t_1;
} else if (z <= 1.9e-169) {
tmp = x * x;
} else if (z <= 2.8e-114) {
tmp = t_1;
} else if (z <= 1.18e-5) {
tmp = x * x;
} else {
tmp = -4.0 * ((z * z) * y);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (t * 4.0) tmp = 0 if z <= 9.5e-231: tmp = t_1 elif z <= 1.9e-169: tmp = x * x elif z <= 2.8e-114: tmp = t_1 elif z <= 1.18e-5: tmp = x * x else: tmp = -4.0 * ((z * z) * y) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(t * 4.0)) tmp = 0.0 if (z <= 9.5e-231) tmp = t_1; elseif (z <= 1.9e-169) tmp = Float64(x * x); elseif (z <= 2.8e-114) tmp = t_1; elseif (z <= 1.18e-5) tmp = Float64(x * x); else tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (t * 4.0); tmp = 0.0; if (z <= 9.5e-231) tmp = t_1; elseif (z <= 1.9e-169) tmp = x * x; elseif (z <= 2.8e-114) tmp = t_1; elseif (z <= 1.18e-5) tmp = x * x; else tmp = -4.0 * ((z * z) * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 9.5e-231], t$95$1, If[LessEqual[z, 1.9e-169], N[(x * x), $MachinePrecision], If[LessEqual[z, 2.8e-114], t$95$1, If[LessEqual[z, 1.18e-5], N[(x * x), $MachinePrecision], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(t \cdot 4\right)\\
\mathbf{if}\;z \leq 9.5 \cdot 10^{-231}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-169}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.18 \cdot 10^{-5}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\end{array}
\end{array}
if z < 9.4999999999999995e-231 or 1.9e-169 < z < 2.8000000000000001e-114Initial program 91.2%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6439.7
Simplified39.7%
if 9.4999999999999995e-231 < z < 1.9e-169 or 2.8000000000000001e-114 < z < 1.18000000000000005e-5Initial program 100.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6466.8
Simplified66.8%
if 1.18000000000000005e-5 < z Initial program 85.8%
Taylor expanded in z around inf
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.2
Simplified67.2%
Final simplification48.1%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+280) (fma (fma z z (- t)) (* y -4.0) (* x x)) (fma (* z (* y -4.0)) z (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+280) {
tmp = fma(fma(z, z, -t), (y * -4.0), (x * x));
} else {
tmp = fma((z * (y * -4.0)), z, (x * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+280) tmp = fma(fma(z, z, Float64(-t)), Float64(y * -4.0), Float64(x * x)); else tmp = fma(Float64(z * Float64(y * -4.0)), z, Float64(x * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+280], N[(N[(z * z + (-t)), $MachinePrecision] * N[(y * -4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision] * z + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+280}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, z, -t\right), y \cdot -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(y \cdot -4\right), z, x \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1e280Initial program 98.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
metadata-eval100.0
Applied egg-rr100.0%
if 1e280 < (*.f64 z z) Initial program 71.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied egg-rr86.0%
Taylor expanded in y around 0
unpow2N/A
lower-*.f6495.8
Simplified95.8%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1.6e+34) (* y (fma (* z -4.0) z (* t 4.0))) (fma (* z (* y -4.0)) z (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1.6e+34) {
tmp = y * fma((z * -4.0), z, (t * 4.0));
} else {
tmp = fma((z * (y * -4.0)), z, (x * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1.6e+34) tmp = Float64(y * fma(Float64(z * -4.0), z, Float64(t * 4.0))); else tmp = fma(Float64(z * Float64(y * -4.0)), z, Float64(x * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.6e+34], N[(y * N[(N[(z * -4.0), $MachinePrecision] * z + N[(t * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision] * z + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.6 \cdot 10^{+34}:\\
\;\;\;\;y \cdot \mathsf{fma}\left(z \cdot -4, z, t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(y \cdot -4\right), z, x \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 1.5999999999999999e34Initial program 94.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied egg-rr96.4%
Taylor expanded in y around inf
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
lower-*.f6487.0
Simplified87.0%
associate-*l*N/A
associate-*l*N/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.4
Applied egg-rr85.4%
if 1.5999999999999999e34 < (*.f64 x x) Initial program 86.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied egg-rr90.2%
Taylor expanded in y around 0
unpow2N/A
lower-*.f6489.8
Simplified89.8%
Final simplification87.3%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 7.8e+230) (* y (fma (* z -4.0) z (* t 4.0))) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 7.8e+230) {
tmp = y * fma((z * -4.0), z, (t * 4.0));
} else {
tmp = x * x;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 7.8e+230) tmp = Float64(y * fma(Float64(z * -4.0), z, Float64(t * 4.0))); else tmp = Float64(x * x); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 7.8e+230], N[(y * N[(N[(z * -4.0), $MachinePrecision] * z + N[(t * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 7.8 \cdot 10^{+230}:\\
\;\;\;\;y \cdot \mathsf{fma}\left(z \cdot -4, z, t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 7.7999999999999996e230Initial program 94.0%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
Applied egg-rr95.2%
Taylor expanded in y around inf
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-outN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
lower-*.f6478.0
Simplified78.0%
associate-*l*N/A
associate-*l*N/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6477.4
Applied egg-rr77.4%
if 7.7999999999999996e230 < (*.f64 x x) Initial program 83.3%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6491.3
Simplified91.3%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 7.8e+230) (* (* y -4.0) (- (* z z) t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 7.8e+230) {
tmp = (y * -4.0) * ((z * z) - 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) <= 7.8d+230) then
tmp = (y * (-4.0d0)) * ((z * z) - 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) <= 7.8e+230) {
tmp = (y * -4.0) * ((z * z) - t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 7.8e+230: tmp = (y * -4.0) * ((z * z) - t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 7.8e+230) tmp = Float64(Float64(y * -4.0) * Float64(Float64(z * z) - t)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 7.8e+230) tmp = (y * -4.0) * ((z * z) - t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 7.8e+230], N[(N[(y * -4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 7.8 \cdot 10^{+230}:\\
\;\;\;\;\left(y \cdot -4\right) \cdot \left(z \cdot z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 7.7999999999999996e230Initial program 94.0%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6477.4
Simplified77.4%
if 7.7999999999999996e230 < (*.f64 x x) Initial program 83.3%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6491.3
Simplified91.3%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1.6e+34) (* y (* t 4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1.6e+34) {
tmp = y * (t * 4.0);
} 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) <= 1.6d+34) then
tmp = y * (t * 4.0d0)
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) <= 1.6e+34) {
tmp = y * (t * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 1.6e+34: tmp = y * (t * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1.6e+34) tmp = Float64(y * Float64(t * 4.0)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 1.6e+34) tmp = y * (t * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.6e+34], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.6 \cdot 10^{+34}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.5999999999999999e34Initial program 94.8%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6450.1
Simplified50.1%
if 1.5999999999999999e34 < (*.f64 x x) Initial program 86.8%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6470.9
Simplified70.9%
(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 91.3%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6439.7
Simplified39.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 2024207
(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))))