
(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) 1e+263) (fma (* (- (* z z) t) -4.0) y (* x x)) (+ (* x x) (* z (* y (* z -4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+263) {
tmp = fma((((z * z) - t) * -4.0), y, (x * x));
} else {
tmp = (x * x) + (z * (y * (z * -4.0)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+263) tmp = fma(Float64(Float64(Float64(z * z) - t) * -4.0), y, Float64(x * x)); else tmp = Float64(Float64(x * x) + Float64(z * Float64(y * Float64(z * -4.0)))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+263], N[(N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * -4.0), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(z * N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+263}:\\
\;\;\;\;\mathsf{fma}\left(\left(z \cdot z - t\right) \cdot -4, y, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000002e263Initial program 97.7%
sub-neg97.7%
+-commutative97.7%
*-commutative97.7%
distribute-rgt-neg-in97.7%
*-commutative97.7%
distribute-lft-neg-in97.7%
metadata-eval97.7%
associate-*r*97.7%
fma-def99.4%
Applied egg-rr99.4%
if 1.00000000000000002e263 < (*.f64 z z) Initial program 67.3%
Taylor expanded in t around 0 67.3%
unpow267.3%
cancel-sign-sub-inv67.3%
metadata-eval67.3%
fma-def74.1%
*-commutative74.1%
unpow274.1%
*-commutative74.1%
associate-*l*74.1%
Simplified74.1%
fma-udef67.3%
+-commutative67.3%
associate-*l*93.2%
*-commutative93.2%
associate-*r*93.2%
Applied egg-rr93.2%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z z) t)))
(if (<= t_1 5e+305)
(fma x x (* t_1 (* -4.0 y)))
(+ (* x x) (* z (* y (* z -4.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (t_1 <= 5e+305) {
tmp = fma(x, x, (t_1 * (-4.0 * y)));
} else {
tmp = (x * x) + (z * (y * (z * -4.0)));
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(z * z) - t) tmp = 0.0 if (t_1 <= 5e+305) tmp = fma(x, x, Float64(t_1 * Float64(-4.0 * y))); else tmp = Float64(Float64(x * x) + Float64(z * Float64(y * Float64(z * -4.0)))); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, 5e+305], N[(x * x + N[(t$95$1 * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(z * N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot z - t\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(x, x, t_1 \cdot \left(-4 \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < 5.00000000000000009e305Initial program 98.3%
fma-neg98.8%
*-commutative98.8%
distribute-rgt-neg-in98.8%
distribute-rgt-neg-in98.8%
metadata-eval98.8%
Simplified98.8%
if 5.00000000000000009e305 < (-.f64 (*.f64 z z) t) Initial program 60.8%
Taylor expanded in t around 0 60.8%
unpow260.8%
cancel-sign-sub-inv60.8%
metadata-eval60.8%
fma-def68.6%
*-commutative68.6%
unpow268.6%
*-commutative68.6%
associate-*l*68.6%
Simplified68.6%
fma-udef60.8%
+-commutative60.8%
associate-*l*90.6%
*-commutative90.6%
associate-*r*90.6%
Applied egg-rr90.6%
Final simplification96.8%
(FPCore (x y z t) :precision binary64 (if (<= (- (* z z) t) 5e+305) (+ (* x x) (* (* y 4.0) (- t (* z z)))) (+ (* x x) (* z (* y (* z -4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (((z * z) - t) <= 5e+305) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) + (z * (y * (z * -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) - t) <= 5d+305) then
tmp = (x * x) + ((y * 4.0d0) * (t - (z * z)))
else
tmp = (x * x) + (z * (y * (z * (-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) - t) <= 5e+305) {
tmp = (x * x) + ((y * 4.0) * (t - (z * z)));
} else {
tmp = (x * x) + (z * (y * (z * -4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((z * z) - t) <= 5e+305: tmp = (x * x) + ((y * 4.0) * (t - (z * z))) else: tmp = (x * x) + (z * (y * (z * -4.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(z * z) - t) <= 5e+305) tmp = Float64(Float64(x * x) + Float64(Float64(y * 4.0) * Float64(t - Float64(z * z)))); else tmp = Float64(Float64(x * x) + Float64(z * Float64(y * Float64(z * -4.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((z * z) - t) <= 5e+305) tmp = (x * x) + ((y * 4.0) * (t - (z * z))); else tmp = (x * x) + (z * (y * (z * -4.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision], 5e+305], 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[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z - t \leq 5 \cdot 10^{+305}:\\
\;\;\;\;x \cdot x + \left(y \cdot 4\right) \cdot \left(t - z \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < 5.00000000000000009e305Initial program 98.3%
if 5.00000000000000009e305 < (-.f64 (*.f64 z z) t) Initial program 60.8%
Taylor expanded in t around 0 60.8%
unpow260.8%
cancel-sign-sub-inv60.8%
metadata-eval60.8%
fma-def68.6%
*-commutative68.6%
unpow268.6%
*-commutative68.6%
associate-*l*68.6%
Simplified68.6%
fma-udef60.8%
+-commutative60.8%
associate-*l*90.6%
*-commutative90.6%
associate-*r*90.6%
Applied egg-rr90.6%
Final simplification96.4%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e-106) (- (* x x) (* y (* t -4.0))) (+ (* x x) (* z (* y (* z -4.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-106) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (x * x) + (z * (y * (z * -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-106) then
tmp = (x * x) - (y * (t * (-4.0d0)))
else
tmp = (x * x) + (z * (y * (z * (-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-106) {
tmp = (x * x) - (y * (t * -4.0));
} else {
tmp = (x * x) + (z * (y * (z * -4.0)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 5e-106: tmp = (x * x) - (y * (t * -4.0)) else: tmp = (x * x) + (z * (y * (z * -4.0))) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e-106) tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); else tmp = Float64(Float64(x * x) + Float64(z * Float64(y * Float64(z * -4.0)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 5e-106) tmp = (x * x) - (y * (t * -4.0)); else tmp = (x * x) + (z * (y * (z * -4.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-106], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] + N[(z * N[(y * N[(z * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-106}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x + z \cdot \left(y \cdot \left(z \cdot -4\right)\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999983e-106Initial program 99.0%
Taylor expanded in z around 0 98.5%
associate-*r*98.5%
Simplified98.5%
if 4.99999999999999983e-106 < (*.f64 z z) Initial program 82.7%
Taylor expanded in t around 0 73.0%
unpow273.0%
cancel-sign-sub-inv73.0%
metadata-eval73.0%
fma-def76.2%
*-commutative76.2%
unpow276.2%
*-commutative76.2%
associate-*l*76.2%
Simplified76.2%
fma-udef73.0%
+-commutative73.0%
associate-*l*85.1%
*-commutative85.1%
associate-*r*85.1%
Applied egg-rr85.1%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1e-108) (* (* z z) (* -4.0 y)) (if (<= (* x x) 7.2e+66) (* y (* t 4.0)) (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1e-108) {
tmp = (z * z) * (-4.0 * y);
} else if ((x * x) <= 7.2e+66) {
tmp = y * (t * 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) <= 1d-108) then
tmp = (z * z) * ((-4.0d0) * y)
else if ((x * x) <= 7.2d+66) then
tmp = y * (t * 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) <= 1e-108) {
tmp = (z * z) * (-4.0 * y);
} else if ((x * x) <= 7.2e+66) {
tmp = y * (t * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 1e-108: tmp = (z * z) * (-4.0 * y) elif (x * x) <= 7.2e+66: tmp = y * (t * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1e-108) tmp = Float64(Float64(z * z) * Float64(-4.0 * y)); elseif (Float64(x * x) <= 7.2e+66) tmp = Float64(y * Float64(t * 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) <= 1e-108) tmp = (z * z) * (-4.0 * y); elseif ((x * x) <= 7.2e+66) tmp = y * (t * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1e-108], N[(N[(z * z), $MachinePrecision] * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 7.2e+66], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 10^{-108}:\\
\;\;\;\;\left(z \cdot z\right) \cdot \left(-4 \cdot y\right)\\
\mathbf{elif}\;x \cdot x \leq 7.2 \cdot 10^{+66}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.00000000000000004e-108Initial program 95.1%
Taylor expanded in z around inf 53.0%
*-commutative53.0%
unpow253.0%
*-commutative53.0%
associate-*l*53.0%
Simplified53.0%
if 1.00000000000000004e-108 < (*.f64 x x) < 7.2e66Initial program 88.8%
Taylor expanded in t around inf 44.6%
associate-*r*44.6%
*-commutative44.6%
Simplified44.6%
if 7.2e66 < (*.f64 x x) Initial program 82.1%
Taylor expanded in x around inf 77.0%
unpow277.0%
Simplified77.0%
Final simplification61.7%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 3e+71) (* (- (* z z) t) (* -4.0 y)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 3e+71) {
tmp = ((z * z) - t) * (-4.0 * 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 * x) <= 3d+71) then
tmp = ((z * z) - t) * ((-4.0d0) * 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 * x) <= 3e+71) {
tmp = ((z * z) - t) * (-4.0 * y);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 3e+71: tmp = ((z * z) - t) * (-4.0 * y) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 3e+71) tmp = Float64(Float64(Float64(z * z) - t) * Float64(-4.0 * y)); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 3e+71) tmp = ((z * z) - t) * (-4.0 * y); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 3e+71], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 3 \cdot 10^{+71}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(-4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 3.00000000000000013e71Initial program 93.7%
Taylor expanded in x around 0 82.7%
associate-*r*82.7%
unpow282.7%
*-commutative82.7%
*-commutative82.7%
Simplified82.7%
if 3.00000000000000013e71 < (*.f64 x x) Initial program 82.0%
Taylor expanded in x around inf 77.7%
unpow277.7%
Simplified77.7%
Final simplification80.7%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 4.2e-12) (* (- (* z z) t) (* -4.0 y)) (- (* x x) (* y (* t -4.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 4.2e-12) {
tmp = ((z * z) - t) * (-4.0 * y);
} else {
tmp = (x * x) - (y * (t * -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 ((x * x) <= 4.2d-12) then
tmp = ((z * z) - t) * ((-4.0d0) * y)
else
tmp = (x * x) - (y * (t * (-4.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 4.2e-12) {
tmp = ((z * z) - t) * (-4.0 * y);
} else {
tmp = (x * x) - (y * (t * -4.0));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 4.2e-12: tmp = ((z * z) - t) * (-4.0 * y) else: tmp = (x * x) - (y * (t * -4.0)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 4.2e-12) tmp = Float64(Float64(Float64(z * z) - t) * Float64(-4.0 * y)); else tmp = Float64(Float64(x * x) - Float64(y * Float64(t * -4.0))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x * x) <= 4.2e-12) tmp = ((z * z) - t) * (-4.0 * y); else tmp = (x * x) - (y * (t * -4.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 4.2e-12], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] - N[(y * N[(t * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4.2 \cdot 10^{-12}:\\
\;\;\;\;\left(z \cdot z - t\right) \cdot \left(-4 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x - y \cdot \left(t \cdot -4\right)\\
\end{array}
\end{array}
if (*.f64 x x) < 4.19999999999999988e-12Initial program 93.2%
Taylor expanded in x around 0 83.2%
associate-*r*83.2%
unpow283.2%
*-commutative83.2%
*-commutative83.2%
Simplified83.2%
if 4.19999999999999988e-12 < (*.f64 x x) Initial program 83.8%
Taylor expanded in z around 0 80.9%
associate-*r*80.9%
Simplified80.9%
Final simplification82.2%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 1.65e+67) (* y (* t 4.0)) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 1.65e+67) {
tmp = y * (t * 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.65d+67) then
tmp = y * (t * 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.65e+67) {
tmp = y * (t * 4.0);
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 1.65e+67: tmp = y * (t * 4.0) else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 1.65e+67) tmp = Float64(y * Float64(t * 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.65e+67) tmp = y * (t * 4.0); else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x * x), $MachinePrecision], 1.65e+67], N[(y * N[(t * 4.0), $MachinePrecision]), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1.65 \cdot 10^{+67}:\\
\;\;\;\;y \cdot \left(t \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.6500000000000001e67Initial program 93.7%
Taylor expanded in t around inf 43.0%
associate-*r*43.0%
*-commutative43.0%
Simplified43.0%
if 1.6500000000000001e67 < (*.f64 x x) Initial program 82.1%
Taylor expanded in x around inf 77.0%
unpow277.0%
Simplified77.0%
Final simplification56.9%
(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.9%
Taylor expanded in x around inf 41.7%
unpow241.7%
Simplified41.7%
Final simplification41.7%
(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 2023279
(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))))