
(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) 2e+280) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+280) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} 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 * z) <= 2d+280) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
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 * z) <= 2e+280) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 2e+280: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+280) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); 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 * z) <= 2e+280) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+280], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision]), $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 2 \cdot 10^{+280}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2.0000000000000001e280Initial program 95.7%
if 2.0000000000000001e280 < (*.f64 z z) Initial program 78.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6481.8%
Simplified81.8%
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-*.f6499.8%
Applied egg-rr99.8%
Final simplification96.8%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 1e-33)
(- (* x x) (* -4.0 (* y t)))
(if (<= (* z z) 4e+268)
(- (* x x) (* y (* z (* z 4.0))))
(* z (* z (* y -4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e-33) {
tmp = (x * x) - (-4.0 * (y * t));
} else if ((z * z) <= 4e+268) {
tmp = (x * x) - (y * (z * (z * 4.0)));
} 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 * z) <= 1d-33) then
tmp = (x * x) - ((-4.0d0) * (y * t))
else if ((z * z) <= 4d+268) then
tmp = (x * x) - (y * (z * (z * 4.0d0)))
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 * z) <= 1e-33) {
tmp = (x * x) - (-4.0 * (y * t));
} else if ((z * z) <= 4e+268) {
tmp = (x * x) - (y * (z * (z * 4.0)));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 1e-33: tmp = (x * x) - (-4.0 * (y * t)) elif (z * z) <= 4e+268: tmp = (x * x) - (y * (z * (z * 4.0))) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e-33) tmp = Float64(Float64(x * x) - Float64(-4.0 * Float64(y * t))); elseif (Float64(z * z) <= 4e+268) tmp = Float64(Float64(x * x) - Float64(y * Float64(z * Float64(z * 4.0)))); 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 * z) <= 1e-33) tmp = (x * x) - (-4.0 * (y * t)); elseif ((z * z) <= 4e+268) tmp = (x * x) - (y * (z * (z * 4.0))); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e-33], N[(N[(x * x), $MachinePrecision] - N[(-4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 4e+268], N[(N[(x * x), $MachinePrecision] - N[(y * N[(z * N[(z * 4.0), $MachinePrecision]), $MachinePrecision]), $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^{-33}:\\
\;\;\;\;x \cdot x - -4 \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;z \cdot z \leq 4 \cdot 10^{+268}:\\
\;\;\;\;x \cdot x - y \cdot \left(z \cdot \left(z \cdot 4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.0000000000000001e-33Initial program 95.1%
Taylor expanded in z around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6492.8%
Simplified92.8%
if 1.0000000000000001e-33 < (*.f64 z z) < 3.9999999999999999e268Initial program 96.8%
Taylor expanded in z around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6480.1%
Simplified80.1%
if 3.9999999999999999e268 < (*.f64 z z) Initial program 79.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6481.2%
Simplified81.2%
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-*.f6498.4%
Applied egg-rr98.4%
Final simplification91.2%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 2e-72)
(- (* x x) (* -4.0 (* y t)))
(if (<= (* z z) 2e+280)
(* -4.0 (* y (- (* z z) t)))
(* z (* z (* y -4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e-72) {
tmp = (x * x) - (-4.0 * (y * t));
} else if ((z * z) <= 2e+280) {
tmp = -4.0 * (y * ((z * z) - 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 * z) <= 2d-72) then
tmp = (x * x) - ((-4.0d0) * (y * t))
else if ((z * z) <= 2d+280) then
tmp = (-4.0d0) * (y * ((z * z) - 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 * z) <= 2e-72) {
tmp = (x * x) - (-4.0 * (y * t));
} else if ((z * z) <= 2e+280) {
tmp = -4.0 * (y * ((z * z) - t));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 2e-72: tmp = (x * x) - (-4.0 * (y * t)) elif (z * z) <= 2e+280: tmp = -4.0 * (y * ((z * z) - t)) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e-72) tmp = Float64(Float64(x * x) - Float64(-4.0 * Float64(y * t))); elseif (Float64(z * z) <= 2e+280) tmp = Float64(-4.0 * Float64(y * Float64(Float64(z * z) - 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 * z) <= 2e-72) tmp = (x * x) - (-4.0 * (y * t)); elseif ((z * z) <= 2e+280) tmp = -4.0 * (y * ((z * z) - t)); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e-72], N[(N[(x * x), $MachinePrecision] - N[(-4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+280], N[(-4.0 * N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $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 2 \cdot 10^{-72}:\\
\;\;\;\;x \cdot x - -4 \cdot \left(y \cdot t\right)\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+280}:\\
\;\;\;\;-4 \cdot \left(y \cdot \left(z \cdot z - t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999999e-72Initial program 94.9%
Taylor expanded in z around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6493.2%
Simplified93.2%
if 1.9999999999999999e-72 < (*.f64 z z) < 2.0000000000000001e280Initial program 97.2%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6476.3%
Simplified76.3%
if 2.0000000000000001e280 < (*.f64 z z) Initial program 78.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6481.8%
Simplified81.8%
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-*.f6499.8%
Applied egg-rr99.8%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e-110) (* x x) (if (<= (* z z) 1e-33) (/ 4.0 (/ (/ 1.0 t) y)) (* z (* z (* y -4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-110) {
tmp = x * x;
} else if ((z * z) <= 1e-33) {
tmp = 4.0 / ((1.0 / t) / y);
} 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 * z) <= 5d-110) then
tmp = x * x
else if ((z * z) <= 1d-33) then
tmp = 4.0d0 / ((1.0d0 / t) / y)
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 * z) <= 5e-110) {
tmp = x * x;
} else if ((z * z) <= 1e-33) {
tmp = 4.0 / ((1.0 / t) / y);
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e-110: tmp = x * x elif (z * z) <= 1e-33: tmp = 4.0 / ((1.0 / t) / y) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e-110) tmp = Float64(x * x); elseif (Float64(z * z) <= 1e-33) tmp = Float64(4.0 / Float64(Float64(1.0 / t) / y)); 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 * z) <= 5e-110) tmp = x * x; elseif ((z * z) <= 1e-33) tmp = 4.0 / ((1.0 / t) / y); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-110], N[(x * x), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e-33], N[(4.0 / N[(N[(1.0 / t), $MachinePrecision] / y), $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 5 \cdot 10^{-110}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \cdot z \leq 10^{-33}:\\
\;\;\;\;\frac{4}{\frac{\frac{1}{t}}{y}}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5e-110Initial program 94.4%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6460.5%
Simplified60.5%
if 5e-110 < (*.f64 z z) < 1.0000000000000001e-33Initial program 100.0%
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-*.f6499.9%
Applied egg-rr99.9%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f6486.5%
Simplified86.5%
*-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
remove-double-divN/A
associate-/l/N/A
un-div-invN/A
frac-2negN/A
metadata-evalN/A
/-lowering-/.f64N/A
div-invN/A
distribute-lft-neg-inN/A
div-invN/A
/-lowering-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6486.5%
Applied egg-rr86.5%
Taylor expanded in z around 0
/-lowering-/.f6474.3%
Simplified74.3%
if 1.0000000000000001e-33 < (*.f64 z z) Initial program 87.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6468.6%
Simplified68.6%
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-*.f6477.6%
Applied egg-rr77.6%
Final simplification70.2%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e-110) (* x x) (if (<= (* z z) 1e-33) (* y (* 4.0 t)) (* z (* z (* y -4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-110) {
tmp = x * x;
} else if ((z * z) <= 1e-33) {
tmp = y * (4.0 * 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 * z) <= 5d-110) then
tmp = x * x
else if ((z * z) <= 1d-33) then
tmp = y * (4.0d0 * 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 * z) <= 5e-110) {
tmp = x * x;
} else if ((z * z) <= 1e-33) {
tmp = y * (4.0 * t);
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e-110: tmp = x * x elif (z * z) <= 1e-33: tmp = y * (4.0 * t) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e-110) tmp = Float64(x * x); elseif (Float64(z * z) <= 1e-33) tmp = Float64(y * Float64(4.0 * 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 * z) <= 5e-110) tmp = x * x; elseif ((z * z) <= 1e-33) tmp = y * (4.0 * t); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-110], N[(x * x), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e-33], N[(y * N[(4.0 * t), $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 5 \cdot 10^{-110}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \cdot z \leq 10^{-33}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5e-110Initial program 94.4%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6460.5%
Simplified60.5%
if 5e-110 < (*.f64 z z) < 1.0000000000000001e-33Initial program 100.0%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6474.3%
Simplified74.3%
if 1.0000000000000001e-33 < (*.f64 z z) Initial program 87.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6468.6%
Simplified68.6%
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-*.f6477.6%
Applied egg-rr77.6%
Final simplification70.2%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e-107) (* x x) (if (<= (* z z) 1.48e-33) (* y (* 4.0 t)) (* -4.0 (* (* z z) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-107) {
tmp = x * x;
} else if ((z * z) <= 1.48e-33) {
tmp = y * (4.0 * t);
} 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) :: tmp
if ((z * z) <= 5d-107) then
tmp = x * x
else if ((z * z) <= 1.48d-33) then
tmp = y * (4.0d0 * t)
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 tmp;
if ((z * z) <= 5e-107) {
tmp = x * x;
} else if ((z * z) <= 1.48e-33) {
tmp = y * (4.0 * t);
} else {
tmp = -4.0 * ((z * z) * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e-107: tmp = x * x elif (z * z) <= 1.48e-33: tmp = y * (4.0 * t) else: tmp = -4.0 * ((z * z) * y) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e-107) tmp = Float64(x * x); elseif (Float64(z * z) <= 1.48e-33) tmp = Float64(y * Float64(4.0 * t)); else tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e-107) tmp = x * x; elseif ((z * z) <= 1.48e-33) tmp = y * (4.0 * t); else tmp = -4.0 * ((z * z) * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-107], N[(x * x), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1.48e-33], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-107}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \cdot z \leq 1.48 \cdot 10^{-33}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999971e-107Initial program 94.4%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6460.5%
Simplified60.5%
if 4.99999999999999971e-107 < (*.f64 z z) < 1.47999999999999995e-33Initial program 100.0%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6474.3%
Simplified74.3%
if 1.47999999999999995e-33 < (*.f64 z z) Initial program 87.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6468.6%
Simplified68.6%
Final simplification65.5%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 2.05e+211) (* -4.0 (* y (- (* z z) t))) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 2.05e+211) {
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.05d+211) 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.05e+211) {
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.05e+211: 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.05e+211) 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.05e+211) 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.05e+211], 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.05 \cdot 10^{+211}:\\
\;\;\;\;-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.0499999999999999e211Initial program 92.5%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6480.9%
Simplified80.9%
if 2.0499999999999999e211 < (*.f64 x x) Initial program 89.4%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6482.2%
Simplified82.2%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 2e+110) (* y (* 4.0 t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 2e+110) {
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) <= 2d+110) 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) <= 2e+110) {
tmp = y * (4.0 * t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 2e+110: tmp = y * (4.0 * t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 2e+110) 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) <= 2e+110) 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], 2e+110], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 2 \cdot 10^{+110}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 2e110Initial program 92.2%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6444.5%
Simplified44.5%
if 2e110 < (*.f64 x x) Initial program 90.2%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6474.6%
Simplified74.6%
Final simplification57.7%
(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
*-lowering-*.f6439.2%
Simplified39.2%
(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 2024158
(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))))