
(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
(let* ((t_1 (+ (* z z) t)))
(if (<= (* z z) 5e+228)
(+ (* x x) (* (* y 4.0) (* t_1 (/ (- t (* z z)) t_1))))
(- (* x x) (* z (* 4.0 (* z y)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * z) + t;
double tmp;
if ((z * z) <= 5e+228) {
tmp = (x * x) + ((y * 4.0) * (t_1 * ((t - (z * z)) / t_1)));
} else {
tmp = (x * x) - (z * (4.0 * (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 = (z * z) + t
if ((z * z) <= 5d+228) then
tmp = (x * x) + ((y * 4.0d0) * (t_1 * ((t - (z * z)) / t_1)))
else
tmp = (x * x) - (z * (4.0d0 * (z * y)))
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 ((z * z) <= 5e+228) {
tmp = (x * x) + ((y * 4.0) * (t_1 * ((t - (z * z)) / t_1)));
} else {
tmp = (x * x) - (z * (4.0 * (z * y)));
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * z) + t tmp = 0 if (z * z) <= 5e+228: tmp = (x * x) + ((y * 4.0) * (t_1 * ((t - (z * z)) / t_1))) else: tmp = (x * x) - (z * (4.0 * (z * y))) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * z) + t) tmp = 0.0 if (Float64(z * z) <= 5e+228) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t_1 * Float64(Float64(t - Float64(z * z)) / t_1)))); else tmp = Float64(Float64(x * x) - Float64(z * Float64(4.0 * Float64(z * y)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * z) + t; tmp = 0.0; if ((z * z) <= 5e+228) tmp = (x * x) + ((y * 4.0) * (t_1 * ((t - (z * z)) / t_1))); else tmp = (x * x) - (z * (4.0 * (z * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] + t), $MachinePrecision]}, If[LessEqual[N[(z * z), $MachinePrecision], 5e+228], N[(N[(x * x), $MachinePrecision] + N[(N[(y * 4.0), $MachinePrecision] * N[(t$95$1 * N[(N[(t - N[(z * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(4.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot z + t\\
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+228}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t\_1 \cdot \frac{t - z \cdot z}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(4 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5e228Initial program 98.8%
flip--N/A
difference-of-squaresN/A
associate-/l*N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f6498.8%
Applied egg-rr98.8%
if 5e228 < (*.f64 z z) Initial program 74.7%
Taylor expanded in z around inf
unpow2N/A
*-lowering-*.f6474.7%
Simplified74.7%
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6494.0%
Applied egg-rr94.0%
Final simplification97.4%
(FPCore (x y z t)
:precision binary64
(if (<= z 5.4e-180)
(* x x)
(if (<= z 5.2e-138)
(* y (* 4.0 t))
(if (<= z 1.45e+90) (* x x) (* z (* z (* y -4.0)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 5.4e-180) {
tmp = x * x;
} else if (z <= 5.2e-138) {
tmp = y * (4.0 * t);
} else if (z <= 1.45e+90) {
tmp = x * x;
} 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 <= 5.4d-180) then
tmp = x * x
else if (z <= 5.2d-138) then
tmp = y * (4.0d0 * t)
else if (z <= 1.45d+90) then
tmp = x * x
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 <= 5.4e-180) {
tmp = x * x;
} else if (z <= 5.2e-138) {
tmp = y * (4.0 * t);
} else if (z <= 1.45e+90) {
tmp = x * x;
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 5.4e-180: tmp = x * x elif z <= 5.2e-138: tmp = y * (4.0 * t) elif z <= 1.45e+90: tmp = x * x else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 5.4e-180) tmp = Float64(x * x); elseif (z <= 5.2e-138) tmp = Float64(y * Float64(4.0 * t)); elseif (z <= 1.45e+90) tmp = Float64(x * x); 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 <= 5.4e-180) tmp = x * x; elseif (z <= 5.2e-138) tmp = y * (4.0 * t); elseif (z <= 1.45e+90) tmp = x * x; else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 5.4e-180], N[(x * x), $MachinePrecision], If[LessEqual[z, 5.2e-138], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e+90], N[(x * x), $MachinePrecision], N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5.4 \cdot 10^{-180}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-138}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+90}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if z < 5.40000000000000028e-180 or 5.2e-138 < z < 1.4500000000000001e90Initial program 95.7%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6444.7%
Simplified44.7%
if 5.40000000000000028e-180 < z < 5.2e-138Initial program 100.0%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6463.7%
Simplified63.7%
if 1.4500000000000001e90 < z Initial program 69.6%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6464.9%
Simplified64.9%
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-*.f6481.8%
Applied egg-rr81.8%
Final simplification51.2%
(FPCore (x y z t)
:precision binary64
(if (<= z 1.02e-178)
(* x x)
(if (<= z 5.4e-138)
(* y (* 4.0 t))
(if (<= z 1.45e+90) (* x x) (* -4.0 (* (* z z) y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.02e-178) {
tmp = x * x;
} else if (z <= 5.4e-138) {
tmp = y * (4.0 * t);
} else if (z <= 1.45e+90) {
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) :: tmp
if (z <= 1.02d-178) then
tmp = x * x
else if (z <= 5.4d-138) then
tmp = y * (4.0d0 * t)
else if (z <= 1.45d+90) 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 tmp;
if (z <= 1.02e-178) {
tmp = x * x;
} else if (z <= 5.4e-138) {
tmp = y * (4.0 * t);
} else if (z <= 1.45e+90) {
tmp = x * x;
} else {
tmp = -4.0 * ((z * z) * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.02e-178: tmp = x * x elif z <= 5.4e-138: tmp = y * (4.0 * t) elif z <= 1.45e+90: tmp = x * x else: tmp = -4.0 * ((z * z) * y) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.02e-178) tmp = Float64(x * x); elseif (z <= 5.4e-138) tmp = Float64(y * Float64(4.0 * t)); elseif (z <= 1.45e+90) 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) tmp = 0.0; if (z <= 1.02e-178) tmp = x * x; elseif (z <= 5.4e-138) tmp = y * (4.0 * t); elseif (z <= 1.45e+90) tmp = x * x; else tmp = -4.0 * ((z * z) * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.02e-178], N[(x * x), $MachinePrecision], If[LessEqual[z, 5.4e-138], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e+90], N[(x * x), $MachinePrecision], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.02 \cdot 10^{-178}:\\
\;\;\;\;x \cdot x\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{-138}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+90}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\end{array}
\end{array}
if z < 1.02000000000000006e-178 or 5.40000000000000057e-138 < z < 1.4500000000000001e90Initial program 95.7%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6444.7%
Simplified44.7%
if 1.02000000000000006e-178 < z < 5.40000000000000057e-138Initial program 100.0%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6463.7%
Simplified63.7%
if 1.4500000000000001e90 < z Initial program 69.6%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6464.9%
Simplified64.9%
Final simplification48.5%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+228) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (- (* x x) (* z (* 4.0 (* z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+228) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) - (z * (4.0 * (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+228) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (x * x) - (z * (4.0d0 * (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+228) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) - (z * (4.0 * (z * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e+228: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (x * x) - (z * (4.0 * (z * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+228) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(x * x) - Float64(z * Float64(4.0 * Float64(z * y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e+228) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (x * x) - (z * (4.0 * (z * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+228], 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[(z * N[(4.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+228}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(4 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5e228Initial program 98.8%
if 5e228 < (*.f64 z z) Initial program 74.7%
Taylor expanded in z around inf
unpow2N/A
*-lowering-*.f6474.7%
Simplified74.7%
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6494.0%
Applied egg-rr94.0%
Final simplification97.4%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e-13) (- (* x x) (* -4.0 (* y t))) (- (* x x) (* z (* 4.0 (* z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-13) {
tmp = (x * x) - (-4.0 * (y * t));
} else {
tmp = (x * x) - (z * (4.0 * (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-13) then
tmp = (x * x) - ((-4.0d0) * (y * t))
else
tmp = (x * x) - (z * (4.0d0 * (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-13) {
tmp = (x * x) - (-4.0 * (y * t));
} else {
tmp = (x * x) - (z * (4.0 * (z * y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e-13: tmp = (x * x) - (-4.0 * (y * t)) else: tmp = (x * x) - (z * (4.0 * (z * y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e-13) tmp = Float64(Float64(x * x) - Float64(-4.0 * Float64(y * t))); else tmp = Float64(Float64(x * x) - Float64(z * Float64(4.0 * Float64(z * y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e-13) tmp = (x * x) - (-4.0 * (y * t)); else tmp = (x * x) - (z * (4.0 * (z * y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-13], N[(N[(x * x), $MachinePrecision] - N[(-4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(4.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-13}:\\
\;\;\;\;x \cdot x - -4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(4 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.9999999999999999e-13Initial program 100.0%
Taylor expanded in z around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6494.0%
Simplified94.0%
if 4.9999999999999999e-13 < (*.f64 z z) Initial program 83.2%
Taylor expanded in z around inf
unpow2N/A
*-lowering-*.f6478.3%
Simplified78.3%
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6489.8%
Applied egg-rr89.8%
Final simplification91.9%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+40) (- (* x x) (* -4.0 (* y t))) (* -4.0 (* z (* y (- z (/ t z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+40) {
tmp = (x * x) - (-4.0 * (y * t));
} else {
tmp = -4.0 * (z * (y * (z - (t / 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+40) then
tmp = (x * x) - ((-4.0d0) * (y * t))
else
tmp = (-4.0d0) * (z * (y * (z - (t / 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+40) {
tmp = (x * x) - (-4.0 * (y * t));
} else {
tmp = -4.0 * (z * (y * (z - (t / z))));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e+40: tmp = (x * x) - (-4.0 * (y * t)) else: tmp = -4.0 * (z * (y * (z - (t / z)))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+40) tmp = Float64(Float64(x * x) - Float64(-4.0 * Float64(y * t))); else tmp = Float64(-4.0 * Float64(z * Float64(y * Float64(z - Float64(t / z))))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e+40) tmp = (x * x) - (-4.0 * (y * t)); else tmp = -4.0 * (z * (y * (z - (t / z)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+40], N[(N[(x * x), $MachinePrecision] - N[(-4.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.0 * N[(z * N[(y * N[(z - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+40}:\\
\;\;\;\;x \cdot x - -4 \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;-4 \cdot \left(z \cdot \left(y \cdot \left(z - \frac{t}{z}\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000003e40Initial program 99.3%
Taylor expanded in z around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6492.5%
Simplified92.5%
if 5.00000000000000003e40 < (*.f64 z z) Initial program 82.2%
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.2%
Applied egg-rr82.2%
Taylor expanded in x around 0
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6472.0%
Simplified72.0%
Taylor expanded in z around inf
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
associate-/l*N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
unpow2N/A
*-lowering-*.f6482.3%
Simplified82.3%
Taylor expanded in z around 0
associate-*r*N/A
*-commutativeN/A
distribute-rgt-outN/A
associate-/l*N/A
+-commutativeN/A
*-lowering-*.f64N/A
neg-mul-1N/A
sub-negN/A
div-subN/A
unpow2N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
--lowering--.f64N/A
/-lowering-/.f6482.8%
Simplified82.8%
Final simplification88.2%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+180) (- (* 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 * z) <= 2e+180) {
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 * z) <= 2d+180) 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 * z) <= 2e+180) {
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 * z) <= 2e+180: 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 (Float64(z * z) <= 2e+180) 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 * z) <= 2e+180) 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[N[(z * z), $MachinePrecision], 2e+180], 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 \cdot z \leq 2 \cdot 10^{+180}:\\
\;\;\;\;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 (*.f64 z z) < 2e180Initial program 98.8%
Taylor expanded in z around 0
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6485.8%
Simplified85.8%
if 2e180 < (*.f64 z z) Initial program 77.7%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6475.5%
Simplified75.5%
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-*.f6489.1%
Applied egg-rr89.1%
Final simplification86.9%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 2e+201) (* -4.0 (* y (- (* z z) t))) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 2e+201) {
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) <= 2d+201) 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) <= 2e+201) {
tmp = -4.0 * (y * ((z * z) - t));
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 2e+201: 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) <= 2e+201) 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) <= 2e+201) 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], 2e+201], 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 \cdot 10^{+201}:\\
\;\;\;\;-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.00000000000000008e201Initial program 91.9%
Taylor expanded in x around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
unpow2N/A
*-lowering-*.f6474.8%
Simplified74.8%
if 2.00000000000000008e201 < (*.f64 x x) Initial program 91.2%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6484.7%
Simplified84.7%
(FPCore (x y z t) :precision binary64 (if (<= x 4.5e-77) (* y (* 4.0 t)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 4.5e-77) {
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 <= 4.5d-77) 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 <= 4.5e-77) {
tmp = y * (4.0 * t);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 4.5e-77: tmp = y * (4.0 * t) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 4.5e-77) 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 <= 4.5e-77) tmp = y * (4.0 * t); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 4.5e-77], N[(y * N[(4.0 * t), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.5 \cdot 10^{-77}:\\
\;\;\;\;y \cdot \left(4 \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 4.5000000000000001e-77Initial program 91.4%
Taylor expanded in t around inf
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6434.3%
Simplified34.3%
if 4.5000000000000001e-77 < x Initial program 92.4%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6465.5%
Simplified65.5%
Final simplification43.8%
(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.7%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6440.6%
Simplified40.6%
(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 2024161
(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))))