
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+242) (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) <= 1e+242) {
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) <= 1e+242) 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], 1e+242], 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 10^{+242}:\\
\;\;\;\;\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) < 1.00000000000000005e242Initial program 98.2%
fma-neg98.8%
*-commutative98.8%
distribute-rgt-neg-in98.8%
distribute-rgt-neg-in98.8%
metadata-eval98.8%
Simplified98.8%
if 1.00000000000000005e242 < (*.f64 z z) Initial program 68.0%
Taylor expanded in z around inf 68.0%
unpow268.0%
associate-*r*68.0%
*-commutative68.0%
associate-*r*90.1%
*-commutative90.1%
Simplified90.1%
Final simplification96.0%
(FPCore (x y z t)
:precision binary64
(if (or (<= (* x x) 1.25e-62)
(and (not (<= (* x x) 2.1e+27)) (<= (* x x) 5.5e+254)))
(* (- (* z z) t) (* y -4.0))
(* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * x) <= 1.25e-62) || (!((x * x) <= 2.1e+27) && ((x * x) <= 5.5e+254))) {
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.25d-62) .or. (.not. ((x * x) <= 2.1d+27)) .and. ((x * x) <= 5.5d+254)) 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.25e-62) || (!((x * x) <= 2.1e+27) && ((x * x) <= 5.5e+254))) {
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.25e-62) or (not ((x * x) <= 2.1e+27) and ((x * x) <= 5.5e+254)): 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.25e-62) || (!(Float64(x * x) <= 2.1e+27) && (Float64(x * x) <= 5.5e+254))) 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.25e-62) || (~(((x * x) <= 2.1e+27)) && ((x * x) <= 5.5e+254))) tmp = ((z * z) - t) * (y * -4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x * x), $MachinePrecision], 1.25e-62], And[N[Not[LessEqual[N[(x * x), $MachinePrecision], 2.1e+27]], $MachinePrecision], LessEqual[N[(x * x), $MachinePrecision], 5.5e+254]]], 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.25 \cdot 10^{-62} \lor \neg \left(x \cdot x \leq 2.1 \cdot 10^{+27}\right) \land x \cdot x \leq 5.5 \cdot 10^{+254}:\\
\;\;\;\;\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.25e-62 or 2.09999999999999995e27 < (*.f64 x x) < 5.50000000000000004e254Initial program 92.1%
Taylor expanded in x around 0 75.3%
*-commutative75.3%
*-commutative75.3%
unpow275.3%
*-commutative75.3%
associate-*l*75.3%
Simplified75.3%
if 1.25e-62 < (*.f64 x x) < 2.09999999999999995e27 or 5.50000000000000004e254 < (*.f64 x x) Initial program 82.1%
Taylor expanded in x around inf 90.1%
unpow290.1%
Simplified90.1%
Final simplification80.4%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 1e+20)
(- (* x x) (* t (* y -4.0)))
(if (<= (* z z) 2e+292)
(- (* x x) (* 4.0 (* (* z z) y)))
(* z (* z (* y -4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+20) {
tmp = (x * x) - (t * (y * -4.0));
} else if ((z * z) <= 2e+292) {
tmp = (x * x) - (4.0 * ((z * z) * 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) <= 1d+20) then
tmp = (x * x) - (t * (y * (-4.0d0)))
else if ((z * z) <= 2d+292) then
tmp = (x * x) - (4.0d0 * ((z * z) * 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) <= 1e+20) {
tmp = (x * x) - (t * (y * -4.0));
} else if ((z * z) <= 2e+292) {
tmp = (x * x) - (4.0 * ((z * z) * y));
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 1e+20: tmp = (x * x) - (t * (y * -4.0)) elif (z * z) <= 2e+292: tmp = (x * x) - (4.0 * ((z * z) * y)) else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+20) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); elseif (Float64(z * z) <= 2e+292) tmp = Float64(Float64(x * x) - Float64(4.0 * Float64(Float64(z * z) * 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) <= 1e+20) tmp = (x * x) - (t * (y * -4.0)); elseif ((z * z) <= 2e+292) tmp = (x * x) - (4.0 * ((z * z) * y)); else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+20], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+292], N[(N[(x * x), $MachinePrecision] - N[(4.0 * N[(N[(z * z), $MachinePrecision] * y), $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^{+20}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+292}:\\
\;\;\;\;x \cdot x - 4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1e20Initial program 99.1%
Taylor expanded in z around 0 94.2%
*-commutative94.2%
*-commutative94.2%
associate-*l*94.2%
Simplified94.2%
if 1e20 < (*.f64 z z) < 2e292Initial program 96.8%
Taylor expanded in z around inf 87.9%
unpow287.9%
associate-*r*87.9%
*-commutative87.9%
associate-*r*88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in y around 0 87.9%
*-commutative87.9%
unpow287.9%
Simplified87.9%
if 2e292 < (*.f64 z z) Initial program 63.0%
Taylor expanded in z around inf 65.8%
metadata-eval65.8%
distribute-lft-neg-in65.8%
*-commutative65.8%
unpow265.8%
*-commutative65.8%
associate-*r*65.8%
associate-*l*85.7%
distribute-rgt-neg-in85.7%
distribute-rgt-neg-in85.7%
distribute-rgt-neg-in85.7%
metadata-eval85.7%
Simplified85.7%
Final simplification90.3%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 2e+35)
(- (* x x) (* t (* y -4.0)))
(if (<= (* z z) 1e+212)
(* (- (* 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) <= 2e+35) {
tmp = (x * x) - (t * (y * -4.0));
} else if ((z * z) <= 1e+212) {
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) <= 2d+35) then
tmp = (x * x) - (t * (y * (-4.0d0)))
else if ((z * z) <= 1d+212) 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) <= 2e+35) {
tmp = (x * x) - (t * (y * -4.0));
} else if ((z * z) <= 1e+212) {
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) <= 2e+35: tmp = (x * x) - (t * (y * -4.0)) elif (z * z) <= 1e+212: 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) <= 2e+35) tmp = Float64(Float64(x * x) - Float64(t * Float64(y * -4.0))); elseif (Float64(z * z) <= 1e+212) 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) <= 2e+35) tmp = (x * x) - (t * (y * -4.0)); elseif ((z * z) <= 1e+212) 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], 2e+35], N[(N[(x * x), $MachinePrecision] - N[(t * N[(y * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+212], 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 2 \cdot 10^{+35}:\\
\;\;\;\;x \cdot x - t \cdot \left(y \cdot -4\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+212}:\\
\;\;\;\;\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.9999999999999999e35Initial program 99.2%
Taylor expanded in z around 0 94.3%
*-commutative94.3%
*-commutative94.3%
associate-*l*94.3%
Simplified94.3%
if 1.9999999999999999e35 < (*.f64 z z) < 9.9999999999999991e211Initial program 97.6%
Taylor expanded in x around 0 69.8%
*-commutative69.8%
*-commutative69.8%
unpow269.8%
*-commutative69.8%
associate-*l*69.8%
Simplified69.8%
if 9.9999999999999991e211 < (*.f64 z z) Initial program 69.7%
Taylor expanded in z around inf 69.7%
metadata-eval69.7%
distribute-lft-neg-in69.7%
*-commutative69.7%
unpow269.7%
*-commutative69.7%
associate-*r*69.7%
associate-*l*85.4%
distribute-rgt-neg-in85.4%
distribute-rgt-neg-in85.4%
distribute-rgt-neg-in85.4%
metadata-eval85.4%
Simplified85.4%
Final simplification87.0%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+212) (+ (* 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) <= 1e+212) {
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) <= 1d+212) 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) <= 1e+212) {
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) <= 1e+212: 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) <= 1e+212) 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) <= 1e+212) 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], 1e+212], 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 10^{+212}:\\
\;\;\;\;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) < 9.9999999999999991e211Initial program 98.8%
if 9.9999999999999991e211 < (*.f64 z z) Initial program 69.7%
Taylor expanded in z around inf 69.7%
unpow269.7%
associate-*r*69.7%
*-commutative69.7%
associate-*r*89.9%
*-commutative89.9%
Simplified89.9%
Final simplification95.7%
(FPCore (x y z t)
:precision binary64
(if (<= x 1.35e-242)
(* t (* y 4.0))
(if (or (<= x 2.9e-52) (and (not (<= x 6.5e+98)) (<= x 3.3e+126)))
(* -4.0 (* (* z z) y))
(* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.35e-242) {
tmp = t * (y * 4.0);
} else if ((x <= 2.9e-52) || (!(x <= 6.5e+98) && (x <= 3.3e+126))) {
tmp = -4.0 * ((z * z) * y);
} 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.35d-242) then
tmp = t * (y * 4.0d0)
else if ((x <= 2.9d-52) .or. (.not. (x <= 6.5d+98)) .and. (x <= 3.3d+126)) then
tmp = (-4.0d0) * ((z * z) * y)
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.35e-242) {
tmp = t * (y * 4.0);
} else if ((x <= 2.9e-52) || (!(x <= 6.5e+98) && (x <= 3.3e+126))) {
tmp = -4.0 * ((z * z) * y);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1.35e-242: tmp = t * (y * 4.0) elif (x <= 2.9e-52) or (not (x <= 6.5e+98) and (x <= 3.3e+126)): tmp = -4.0 * ((z * z) * y) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1.35e-242) tmp = Float64(t * Float64(y * 4.0)); elseif ((x <= 2.9e-52) || (!(x <= 6.5e+98) && (x <= 3.3e+126))) tmp = Float64(-4.0 * Float64(Float64(z * z) * y)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 1.35e-242) tmp = t * (y * 4.0); elseif ((x <= 2.9e-52) || (~((x <= 6.5e+98)) && (x <= 3.3e+126))) tmp = -4.0 * ((z * z) * y); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.35e-242], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 2.9e-52], And[N[Not[LessEqual[x, 6.5e+98]], $MachinePrecision], LessEqual[x, 3.3e+126]]], N[(-4.0 * N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.35 \cdot 10^{-242}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-52} \lor \neg \left(x \leq 6.5 \cdot 10^{+98}\right) \land x \leq 3.3 \cdot 10^{+126}:\\
\;\;\;\;-4 \cdot \left(\left(z \cdot z\right) \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 1.35e-242Initial program 88.9%
Taylor expanded in t around inf 29.4%
associate-*r*29.4%
Simplified29.4%
if 1.35e-242 < x < 2.9000000000000002e-52 or 6.4999999999999999e98 < x < 3.30000000000000013e126Initial program 89.9%
Taylor expanded in z around inf 60.5%
unpow260.5%
Simplified60.5%
if 2.9000000000000002e-52 < x < 6.4999999999999999e98 or 3.30000000000000013e126 < x Initial program 87.3%
Taylor expanded in x around inf 77.0%
unpow277.0%
Simplified77.0%
Final simplification48.0%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+20) (- (* 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) <= 1e+20) {
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) <= 1d+20) 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) <= 1e+20) {
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) <= 1e+20: 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) <= 1e+20) 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) <= 1e+20) 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], 1e+20], 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 10^{+20}:\\
\;\;\;\;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) < 1e20Initial program 99.1%
Taylor expanded in z around 0 94.2%
*-commutative94.2%
*-commutative94.2%
associate-*l*94.2%
Simplified94.2%
if 1e20 < (*.f64 z z) Initial program 79.2%
Taylor expanded in z around inf 75.0%
unpow275.0%
associate-*r*75.0%
*-commutative75.0%
associate-*r*88.3%
*-commutative88.3%
Simplified88.3%
Final simplification91.1%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+35) (* x x) (* z (* z (* y -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+35) {
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 * z) <= 2d+35) 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 * z) <= 2e+35) {
tmp = x * x;
} else {
tmp = z * (z * (y * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 2e+35: tmp = x * x else: tmp = z * (z * (y * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+35) 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 * z) <= 2e+35) tmp = x * x; else tmp = z * (z * (y * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+35], N[(x * x), $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^{+35}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(y \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.9999999999999999e35Initial program 99.2%
Taylor expanded in x around inf 60.9%
unpow260.9%
Simplified60.9%
if 1.9999999999999999e35 < (*.f64 z z) Initial program 78.9%
Taylor expanded in z around inf 65.5%
metadata-eval65.5%
distribute-lft-neg-in65.5%
*-commutative65.5%
unpow265.5%
*-commutative65.5%
associate-*r*65.5%
associate-*l*76.0%
distribute-rgt-neg-in76.0%
distribute-rgt-neg-in76.0%
distribute-rgt-neg-in76.0%
metadata-eval76.0%
Simplified76.0%
Final simplification68.8%
(FPCore (x y z t) :precision binary64 (if (<= x 2.5e-69) (* t (* y 4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2.5e-69) {
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 <= 2.5d-69) 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 <= 2.5e-69) {
tmp = t * (y * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 2.5e-69: tmp = t * (y * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 2.5e-69) 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 <= 2.5e-69) tmp = t * (y * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 2.5e-69], N[(t * N[(y * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.5 \cdot 10^{-69}:\\
\;\;\;\;t \cdot \left(y \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 2.50000000000000017e-69Initial program 88.6%
Taylor expanded in t around inf 32.0%
associate-*r*32.0%
Simplified32.0%
if 2.50000000000000017e-69 < x Initial program 88.8%
Taylor expanded in x around inf 69.7%
unpow269.7%
Simplified69.7%
Final simplification43.6%
(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 88.7%
Taylor expanded in x around inf 44.6%
unpow244.6%
Simplified44.6%
Final simplification44.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 2023238
(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))))