
(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 (<= (* z z) 5e+190) (- (* x x) (fma (* z z) (* y 4.0) (* y (* -4.0 t)))) (+ (* x x) (/ (* z (* y 4.0)) (/ -1.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+190) {
tmp = (x * x) - fma((z * z), (y * 4.0), (y * (-4.0 * t)));
} else {
tmp = (x * x) + ((z * (y * 4.0)) / (-1.0 / z));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+190) tmp = Float64(Float64(x * x) - fma(Float64(z * z), Float64(y * 4.0), Float64(y * Float64(-4.0 * t)))); else tmp = Float64(Float64(x * x) + Float64(Float64(z * Float64(y * 4.0)) / Float64(-1.0 / z))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+190], N[(N[(x * x), $MachinePrecision] - N[(N[(z * z), $MachinePrecision] * N[(y * 4.0), $MachinePrecision] + N[(y * N[(-4.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+190}:\\
\;\;\;\;x \cdot x - \mathsf{fma}\left(z \cdot z, y \cdot 4, y \cdot \left(-4 \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + \frac{z \cdot \left(y \cdot 4\right)}{\frac{-1}{z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000036e190Initial program 95.3%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
fma-lowering-fma.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
neg-mul-1N/A
associate-*r*N/A
metadata-evalN/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-eval95.3%
Applied egg-rr95.3%
if 5.00000000000000036e190 < (*.f64 z z) Initial program 82.9%
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6482.9%
Applied egg-rr82.9%
Taylor expanded in z around inf
unpow2N/A
associate-/r*N/A
remove-double-negN/A
mul-1-negN/A
sub-negN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6482.9%
Simplified82.9%
associate-/r/N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6496.4%
Applied egg-rr96.4%
Taylor expanded in t around 0
/-lowering-/.f6496.4%
Simplified96.4%
Final simplification95.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (* 4.0 t))))
(if (<= x 7.8e-221)
t_1
(if (<= x 5.5e-50)
(* -4.0 (* (* z z) y))
(if (<= x 3.5e+21) t_1 (* x x))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (4.0 * t);
double tmp;
if (x <= 7.8e-221) {
tmp = t_1;
} else if (x <= 5.5e-50) {
tmp = -4.0 * ((z * z) * y);
} else if (x <= 3.5e+21) {
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 * (4.0d0 * t)
if (x <= 7.8d-221) then
tmp = t_1
else if (x <= 5.5d-50) then
tmp = (-4.0d0) * ((z * z) * y)
else if (x <= 3.5d+21) 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 * (4.0 * t);
double tmp;
if (x <= 7.8e-221) {
tmp = t_1;
} else if (x <= 5.5e-50) {
tmp = -4.0 * ((z * z) * y);
} else if (x <= 3.5e+21) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (4.0 * t) tmp = 0 if x <= 7.8e-221: tmp = t_1 elif x <= 5.5e-50: tmp = -4.0 * ((z * z) * y) elif x <= 3.5e+21: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(4.0 * t)) tmp = 0.0 if (x <= 7.8e-221) tmp = t_1; elseif (x <= 5.5e-50) tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); elseif (x <= 3.5e+21) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (4.0 * t); tmp = 0.0; if (x <= 7.8e-221) tmp = t_1; elseif (x <= 5.5e-50) tmp = -4.0 * ((z * z) * y); elseif (x <= 3.5e+21) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 7.8e-221], t$95$1, If[LessEqual[x, 5.5e-50], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e+21], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(4 \cdot t\right)\\
\mathbf{if}\;x \leq 7.8 \cdot 10^{-221}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-50}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 7.7999999999999997e-221 or 5.49999999999999975e-50 < x < 3.5e21Initial program 93.1%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6436.4%
Simplified36.4%
if 7.7999999999999997e-221 < x < 5.49999999999999975e-50Initial program 91.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6453.4%
Simplified53.4%
if 3.5e21 < x Initial program 86.8%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6472.5%
Simplified72.5%
Final simplification48.0%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+190) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (+ (* x x) (/ (* z (* y 4.0)) (/ -1.0 z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+190) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) + ((z * (y * 4.0)) / (-1.0 / 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) :: tmp
if ((z * z) <= 5d+190) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (x * x) + ((z * (y * 4.0d0)) / ((-1.0d0) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+190) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) + ((z * (y * 4.0)) / (-1.0 / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e+190: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (x * x) + ((z * (y * 4.0)) / (-1.0 / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+190) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(x * x) + Float64(Float64(z * Float64(y * 4.0)) / Float64(-1.0 / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e+190) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (x * x) + ((z * (y * 4.0)) / (-1.0 / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+190], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+190}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + \frac{z \cdot \left(y \cdot 4\right)}{\frac{-1}{z}}\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000036e190Initial program 95.3%
if 5.00000000000000036e190 < (*.f64 z z) Initial program 82.9%
flip--N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
clear-numN/A
flip--N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6482.9%
Applied egg-rr82.9%
Taylor expanded in z around inf
unpow2N/A
associate-/r*N/A
remove-double-negN/A
mul-1-negN/A
sub-negN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6482.9%
Simplified82.9%
associate-/r/N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6496.4%
Applied egg-rr96.4%
Taylor expanded in t around 0
/-lowering-/.f6496.4%
Simplified96.4%
Final simplification95.6%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 2.55e+296) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 2.55e+296) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} 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) <= 2.55d+296) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
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) <= 2.55e+296) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 2.55e+296: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 2.55e+296) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 2.55e+296) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 2.55e+296], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2.55 \cdot 10^{+296}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 2.5500000000000001e296Initial program 95.4%
if 2.5500000000000001e296 < (*.f64 x x) Initial program 80.8%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6491.8%
Simplified91.8%
Final simplification94.4%
(FPCore (x y z t) :precision binary64 (if (<= x 8.2e-221) (* y (* 4.0 t)) (if (<= x 2.6e+56) (* z (* z (* y -4.0))) (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 8.2e-221) {
tmp = y * (4.0 * t);
} else if (x <= 2.6e+56) {
tmp = z * (z * (y * -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 <= 8.2d-221) then
tmp = y * (4.0d0 * t)
else if (x <= 2.6d+56) then
tmp = z * (z * (y * (-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 <= 8.2e-221) {
tmp = y * (4.0 * t);
} else if (x <= 2.6e+56) {
tmp = z * (z * (y * -4.0));
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 8.2e-221: tmp = y * (4.0 * t) elif x <= 2.6e+56: tmp = z * (z * (y * -4.0)) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 8.2e-221) tmp = Float64(y * Float64(4.0 * t)); elseif (x <= 2.6e+56) tmp = Float64(z * Float64(z * Float64(y * -4.0))); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 8.2e-221) tmp = y * (4.0 * t); elseif (x <= 2.6e+56) tmp = z * (z * (y * -4.0)); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 8.2e-221], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e+56], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 8.2 \cdot 10^{-221}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+56}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 8.19999999999999962e-221Initial program 93.2%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6434.3%
Simplified34.3%
if 8.19999999999999962e-221 < x < 2.60000000000000011e56Initial program 93.1%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6444.4%
Simplified44.4%
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-lowering-*.f6451.2%
Applied egg-rr51.2%
if 2.60000000000000011e56 < x Initial program 84.5%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6479.4%
Simplified79.4%
Final simplification47.9%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 2.25e+113) (* -4.0 (* y (- (* z z) t))) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 2.25e+113) {
tmp = -4.0 * (y * ((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) <= 2.25d+113) then
tmp = (-4.0d0) * (y * ((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) <= 2.25e+113) {
tmp = -4.0 * (y * ((z * z) - t));
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 2.25e+113: tmp = -4.0 * (y * ((z * z) - t)) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 2.25e+113) tmp = Float64(-4.0 * Float64(y * 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) <= 2.25e+113) tmp = -4.0 * (y * ((z * z) - t)); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 2.25e+113], N[(-4.0 * N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2.25 \cdot 10^{+113}:\\
\;\;\;\;-4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 2.25e113Initial program 96.0%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6487.6%
Simplified87.6%
if 2.25e113 < (*.f64 x x) Initial program 85.4%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6480.6%
Simplified80.6%
(FPCore (x y z t) :precision binary64 (if (<= z 8.6e+94) (- (* x x) (* -4.0 (* y t))) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 8.6e+94) {
tmp = (x * x) - (-4.0 * (y * t));
} else {
tmp = z * (z * (y * -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) :: tmp
if (z <= 8.6d+94) then
tmp = (x * x) - ((-4.0d0) * (y * t))
else
tmp = z * (z * (y * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 8.6e+94) {
tmp = (x * x) - (-4.0 * (y * t));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 8.6e+94: tmp = (x * x) - (-4.0 * (y * t)) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 8.6e+94) tmp = Float64(Float64(x * x) - Float64(-4.0 * Float64(y * t))); else tmp = Float64(z * Float64(z * Float64(y * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 8.6e+94) tmp = (x * x) - (-4.0 * (y * t)); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 8.6e+94], N[(N[(x * x), $MachinePrecision] - N[(-4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.6 \cdot 10^{+94}:\\
\;\;\;\;x \cdot x - -4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if z < 8.6e94Initial program 92.4%
Taylor expanded in z around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6474.5%
Simplified74.5%
if 8.6e94 < z Initial program 84.3%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6484.4%
Simplified84.4%
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
metadata-evalN/A
*-lowering-*.f6491.9%
Applied egg-rr91.9%
Final simplification77.0%
(FPCore (x y z t) :precision binary64 (if (<= x 1.05e+22) (* y (* 4.0 t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.05e+22) {
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 <= 1.05d+22) 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 <= 1.05e+22) {
tmp = y * (4.0 * t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1.05e+22: tmp = y * (4.0 * t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1.05e+22) 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 <= 1.05e+22) tmp = y * (4.0 * t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.05e+22], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.05 \cdot 10^{+22}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 1.0499999999999999e22Initial program 92.8%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6436.6%
Simplified36.6%
if 1.0499999999999999e22 < x Initial program 86.8%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6472.5%
Simplified72.5%
Final simplification46.0%
(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.2%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6443.0%
Simplified43.0%
(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 2024150
(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))))