
(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+303) (fma x x (* (- (* z z) t) (* y -4.0))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+303) {
tmp = fma(x, x, (((z * z) - t) * (y * -4.0)));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+303) tmp = fma(x, x, Float64(Float64(Float64(z * z) - t) * Float64(y * -4.0))); else tmp = Float64(Float64(x * x) - Float64(z * Float64(z * Float64(y * 4.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+303], N[(x * x + N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+303}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2e303Initial program 98.2%
fma-neg98.2%
*-commutative98.2%
distribute-rgt-neg-in98.2%
distribute-rgt-neg-in98.2%
metadata-eval98.2%
Simplified98.2%
if 2e303 < (*.f64 z z) Initial program 64.4%
Taylor expanded in z around inf 64.4%
unpow264.4%
associate-*r*64.4%
*-commutative64.4%
associate-*r*88.7%
*-commutative88.7%
Simplified88.7%
Final simplification95.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* -4.0 (* (* z z) y))) (t_2 (* t (* y 4.0))))
(if (<= (* x x) 9.2e-242)
t_2
(if (<= (* x x) 3.8e-209)
t_1
(if (<= (* x x) 1.5e-149) t_2 (if (<= (* x x) 3.5e+78) t_1 (* x x)))))))
double code(double x, double y, double z, double t) {
double t_1 = -4.0 * ((z * z) * y);
double t_2 = t * (y * 4.0);
double tmp;
if ((x * x) <= 9.2e-242) {
tmp = t_2;
} else if ((x * x) <= 3.8e-209) {
tmp = t_1;
} else if ((x * x) <= 1.5e-149) {
tmp = t_2;
} else if ((x * x) <= 3.5e+78) {
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) :: t_2
real(8) :: tmp
t_1 = (-4.0d0) * ((z * z) * y)
t_2 = t * (y * 4.0d0)
if ((x * x) <= 9.2d-242) then
tmp = t_2
else if ((x * x) <= 3.8d-209) then
tmp = t_1
else if ((x * x) <= 1.5d-149) then
tmp = t_2
else if ((x * x) <= 3.5d+78) 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 = -4.0 * ((z * z) * y);
double t_2 = t * (y * 4.0);
double tmp;
if ((x * x) <= 9.2e-242) {
tmp = t_2;
} else if ((x * x) <= 3.8e-209) {
tmp = t_1;
} else if ((x * x) <= 1.5e-149) {
tmp = t_2;
} else if ((x * x) <= 3.5e+78) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = -4.0 * ((z * z) * y) t_2 = t * (y * 4.0) tmp = 0 if (x * x) <= 9.2e-242: tmp = t_2 elif (x * x) <= 3.8e-209: tmp = t_1 elif (x * x) <= 1.5e-149: tmp = t_2 elif (x * x) <= 3.5e+78: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(-4.0 * Float64(Float64(z * z) * y)) t_2 = Float64(t * Float64(y * 4.0)) tmp = 0.0 if (Float64(x * x) <= 9.2e-242) tmp = t_2; elseif (Float64(x * x) <= 3.8e-209) tmp = t_1; elseif (Float64(x * x) <= 1.5e-149) tmp = t_2; elseif (Float64(x * x) <= 3.5e+78) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = -4.0 * ((z * z) * y); t_2 = t * (y * 4.0); tmp = 0.0; if ((x * x) <= 9.2e-242) tmp = t_2; elseif ((x * x) <= 3.8e-209) tmp = t_1; elseif ((x * x) <= 1.5e-149) tmp = t_2; elseif ((x * x) <= 3.5e+78) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 9.2e-242], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 3.8e-209], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 1.5e-149], t$95$2, If[LessEqual[N[(x * x), $MachinePrecision], 3.5e+78], t$95$1, N[(x * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
t_2 := t \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;x \cdot x \leq 9.2 \cdot 10^{-242}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot x \leq 3.8 \cdot 10^{-209}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 1.5 \cdot 10^{-149}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot x \leq 3.5 \cdot 10^{+78}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 9.19999999999999939e-242 or 3.7999999999999999e-209 < (*.f64 x x) < 1.5000000000000001e-149Initial program 88.4%
Taylor expanded in t around inf 57.4%
associate-*r*57.4%
Simplified57.4%
if 9.19999999999999939e-242 < (*.f64 x x) < 3.7999999999999999e-209 or 1.5000000000000001e-149 < (*.f64 x x) < 3.5000000000000001e78Initial program 93.7%
Taylor expanded in z around inf 59.0%
unpow259.0%
Simplified59.0%
if 3.5000000000000001e78 < (*.f64 x x) Initial program 83.5%
Taylor expanded in x around inf 81.1%
unpow281.1%
Simplified81.1%
Final simplification67.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (* z (* y -4.0)))))
(if (<= (* x x) 2.25e-215)
t_1
(if (<= (* x x) 5.5e-150)
(* t (* y 4.0))
(if (<= (* x x) 1.06e+77) t_1 (* x x))))))
double code(double x, double y, double z, double t) {
double t_1 = z * (z * (y * -4.0));
double tmp;
if ((x * x) <= 2.25e-215) {
tmp = t_1;
} else if ((x * x) <= 5.5e-150) {
tmp = t * (y * 4.0);
} else if ((x * x) <= 1.06e+77) {
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 = z * (z * (y * (-4.0d0)))
if ((x * x) <= 2.25d-215) then
tmp = t_1
else if ((x * x) <= 5.5d-150) then
tmp = t * (y * 4.0d0)
else if ((x * x) <= 1.06d+77) 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 = z * (z * (y * -4.0));
double tmp;
if ((x * x) <= 2.25e-215) {
tmp = t_1;
} else if ((x * x) <= 5.5e-150) {
tmp = t * (y * 4.0);
} else if ((x * x) <= 1.06e+77) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (z * (y * -4.0)) tmp = 0 if (x * x) <= 2.25e-215: tmp = t_1 elif (x * x) <= 5.5e-150: tmp = t * (y * 4.0) elif (x * x) <= 1.06e+77: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(z * Float64(y * -4.0))) tmp = 0.0 if (Float64(x * x) <= 2.25e-215) tmp = t_1; elseif (Float64(x * x) <= 5.5e-150) tmp = Float64(t * Float64(y * 4.0)); elseif (Float64(x * x) <= 1.06e+77) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (z * (y * -4.0)); tmp = 0.0; if ((x * x) <= 2.25e-215) tmp = t_1; elseif ((x * x) <= 5.5e-150) tmp = t * (y * 4.0); elseif ((x * x) <= 1.06e+77) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(z * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 2.25e-215], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 5.5e-150], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 1.06e+77], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\mathbf{if}\;x \cdot x \leq 2.25 \cdot 10^{-215}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot x \leq 5.5 \cdot 10^{-150}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{elif}\;x \cdot x \leq 1.06 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 2.25e-215 or 5.4999999999999996e-150 < (*.f64 x x) < 1.06000000000000003e77Initial program 90.6%
Taylor expanded in z around inf 50.8%
metadata-eval50.8%
distribute-lft-neg-in50.8%
*-commutative50.8%
unpow250.8%
*-commutative50.8%
associate-*r*50.8%
associate-*l*60.1%
distribute-rgt-neg-in60.1%
distribute-rgt-neg-in60.1%
distribute-rgt-neg-in60.1%
metadata-eval60.1%
Simplified60.1%
if 2.25e-215 < (*.f64 x x) < 5.4999999999999996e-150Initial program 89.7%
Taylor expanded in t around inf 78.3%
associate-*r*78.3%
Simplified78.3%
if 1.06000000000000003e77 < (*.f64 x x) Initial program 83.5%
Taylor expanded in x around inf 81.1%
unpow281.1%
Simplified81.1%
Final simplification69.6%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 1e+151)
(- (* x x) (* t (* y -4.0)))
(if (<= (* z z) 2e+303)
(* (- (* z z) t) (* y -4.0))
(* z (* z (* y -4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+151) {
tmp = (x * x) - (t * (y * -4.0));
} else if ((z * z) <= 2e+303) {
tmp = ((z * z) - t) * (y * -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+151) then
tmp = (x * x) - (t * (y * (-4.0d0)))
else if ((z * z) <= 2d+303) then
tmp = ((z * z) - t) * (y * (-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+151) {
tmp = (x * x) - (t * (y * -4.0));
} else if ((z * z) <= 2e+303) {
tmp = ((z * z) - t) * (y * -4.0);
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 1e+151: tmp = (x * x) - (t * (y * -4.0)) elif (z * z) <= 2e+303: tmp = ((z * z) - t) * (y * -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+151) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); elseif (Float64(z * z) <= 2e+303) tmp = Float64(Float64(Float64(z * z) - t) * Float64(y * -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+151) tmp = (x * x) - (t * (y * -4.0)); elseif ((z * z) <= 2e+303) tmp = ((z * z) - t) * (y * -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+151], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+303], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $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^{+151}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+303}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000002e151Initial program 98.6%
Taylor expanded in z around 0 87.4%
*-commutative87.4%
*-commutative87.4%
associate-*l*87.4%
Simplified87.4%
if 1.00000000000000002e151 < (*.f64 z z) < 2e303Initial program 96.4%
Taylor expanded in x around 0 79.6%
*-commutative79.6%
*-commutative79.6%
unpow279.6%
*-commutative79.6%
associate-*l*79.6%
Simplified79.6%
if 2e303 < (*.f64 z z) Initial program 64.4%
Taylor expanded in z around inf 69.4%
metadata-eval69.4%
distribute-lft-neg-in69.4%
*-commutative69.4%
unpow269.4%
*-commutative69.4%
associate-*r*69.4%
associate-*l*85.0%
distribute-rgt-neg-in85.0%
distribute-rgt-neg-in85.0%
distribute-rgt-neg-in85.0%
metadata-eval85.0%
Simplified85.0%
Final simplification85.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+292) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+292) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) - (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+292) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (x * x) - (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+292) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 2e+292: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (x * x) - (z * (z * (y * 4.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+292) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(x * x) - 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+292) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (x * x) - (z * (z * (y * 4.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+292], 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[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+292}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2e292Initial program 98.8%
if 2e292 < (*.f64 z z) Initial program 64.1%
Taylor expanded in z around inf 64.1%
unpow264.1%
associate-*r*64.1%
*-commutative64.1%
associate-*r*87.8%
*-commutative87.8%
Simplified87.8%
Final simplification95.2%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e-81) (- (* x x) (* t (* y -4.0))) (- (* x x) (* z (* z (* y 4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-81) {
tmp = (x * x) - (t * (y * -4.0));
} else {
tmp = (x * x) - (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-81) then
tmp = (x * x) - (t * (y * (-4.0d0)))
else
tmp = (x * x) - (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-81) {
tmp = (x * x) - (t * (y * -4.0));
} else {
tmp = (x * x) - (z * (z * (y * 4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e-81: tmp = (x * x) - (t * (y * -4.0)) else: tmp = (x * x) - (z * (z * (y * 4.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e-81) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); else tmp = Float64(Float64(x * x) - 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-81) tmp = (x * x) - (t * (y * -4.0)); else tmp = (x * x) - (z * (z * (y * 4.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-81], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(z * N[(z * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-81}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - z \cdot \left(z \cdot \left(y \cdot 4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999981e-81Initial program 99.0%
Taylor expanded in z around 0 96.1%
*-commutative96.1%
*-commutative96.1%
associate-*l*96.1%
Simplified96.1%
if 4.99999999999999981e-81 < (*.f64 z z) Initial program 80.5%
Taylor expanded in z around inf 73.8%
unpow273.8%
associate-*r*73.8%
*-commutative73.8%
associate-*r*86.2%
*-commutative86.2%
Simplified86.2%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1.95e+82) (* (- (* z z) t) (* y -4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1.95e+82) {
tmp = ((z * z) - t) * (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 * x) <= 1.95d+82) then
tmp = ((z * z) - t) * (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 * x) <= 1.95e+82) {
tmp = ((z * z) - t) * (y * -4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 1.95e+82: tmp = ((z * z) - t) * (y * -4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1.95e+82) tmp = Float64(Float64(Float64(z * z) - t) * 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 * x) <= 1.95e+82) tmp = ((z * z) - t) * (y * -4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.95e+82], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.95 \cdot 10^{+82}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(y \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.94999999999999988e82Initial program 90.6%
Taylor expanded in x around 0 84.2%
*-commutative84.2%
*-commutative84.2%
unpow284.2%
*-commutative84.2%
associate-*l*84.2%
Simplified84.2%
if 1.94999999999999988e82 < (*.f64 x x) Initial program 83.2%
Taylor expanded in x around inf 82.5%
unpow282.5%
Simplified82.5%
Final simplification83.5%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 3e+20) (* t (* y 4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 3e+20) {
tmp = t * (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 * x) <= 3d+20) then
tmp = t * (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 * x) <= 3e+20) {
tmp = t * (y * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 3e+20: tmp = t * (y * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 3e+20) tmp = Float64(t * 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 * x) <= 3e+20) tmp = t * (y * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 3e+20], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 3 \cdot 10^{+20}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 3e20Initial program 90.6%
Taylor expanded in t around inf 48.9%
associate-*r*48.9%
Simplified48.9%
if 3e20 < (*.f64 x x) Initial program 84.4%
Taylor expanded in x around inf 73.7%
unpow273.7%
Simplified73.7%
Final simplification61.1%
(FPCore (x y z t) :precision binary64 (* x x))
double code(double x, double y, double z, double t) {
return x * x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * x
end function
public static double code(double x, double y, double z, double t) {
return x * x;
}
def code(x, y, z, t): return x * x
function code(x, y, z, t) return Float64(x * x) end
function tmp = code(x, y, z, t) tmp = x * x; end
code[x_, y_, z_, t_] := N[(x * x), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x
\end{array}
Initial program 87.5%
Taylor expanded in x around inf 40.3%
unpow240.3%
Simplified40.3%
Final simplification40.3%
(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 2023240
(FPCore (x y z t)
:name "Graphics.Rasterific.Shading:$sradialGradientWithFocusShader from Rasterific-0.6.1, B"
:precision binary64
:herbie-target
(- (* x x) (* 4.0 (* y (- (* z z) t))))
(- (* x x) (* (* y 4.0) (- (* z z) t))))