
(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 (<= t 2e+27) (fma (* (* -4.0 y) z) z (fma (* (- t) y) -4.0 (* x x))) (fma (* (* -4.0 y) (fma (/ z t) z -1.0)) t (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 2e+27) {
tmp = fma(((-4.0 * y) * z), z, fma((-t * y), -4.0, (x * x)));
} else {
tmp = fma(((-4.0 * y) * fma((z / t), z, -1.0)), t, (x * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (t <= 2e+27) tmp = fma(Float64(Float64(-4.0 * y) * z), z, fma(Float64(Float64(-t) * y), -4.0, Float64(x * x))); else tmp = fma(Float64(Float64(-4.0 * y) * fma(Float64(z / t), z, -1.0)), t, Float64(x * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[t, 2e+27], N[(N[(N[(-4.0 * y), $MachinePrecision] * z), $MachinePrecision] * z + N[(N[((-t) * y), $MachinePrecision] * -4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(-4.0 * y), $MachinePrecision] * N[(N[(z / t), $MachinePrecision] * z + -1.0), $MachinePrecision]), $MachinePrecision] * t + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(\left(-4 \cdot y\right) \cdot z, z, \mathsf{fma}\left(\left(-t\right) \cdot y, -4, x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-4 \cdot y\right) \cdot \mathsf{fma}\left(\frac{z}{t}, z, -1\right), t, x \cdot x\right)\\
\end{array}
\end{array}
if t < 2e27Initial program 92.4%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites98.9%
if 2e27 < t Initial program 89.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6431.9
Applied rewrites31.9%
Applied rewrites35.6%
Taylor expanded in t around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites94.7%
(FPCore (x y z t) :precision binary64 (if (<= (* y 4.0) 1e-52) (fma (* (* -4.0 y) z) z (fma (* (- t) y) -4.0 (* x x))) (fma x x (* (* (- (* z z) t) y) -4.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y * 4.0) <= 1e-52) {
tmp = fma(((-4.0 * y) * z), z, fma((-t * y), -4.0, (x * x)));
} else {
tmp = fma(x, x, ((((z * z) - t) * y) * -4.0));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(y * 4.0) <= 1e-52) tmp = fma(Float64(Float64(-4.0 * y) * z), z, fma(Float64(Float64(-t) * y), -4.0, Float64(x * x))); else tmp = fma(x, x, Float64(Float64(Float64(Float64(z * z) - t) * y) * -4.0)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(y * 4.0), $MachinePrecision], 1e-52], N[(N[(N[(-4.0 * y), $MachinePrecision] * z), $MachinePrecision] * z + N[(N[((-t) * y), $MachinePrecision] * -4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x + N[(N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot 4 \leq 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(\left(-4 \cdot y\right) \cdot z, z, \mathsf{fma}\left(\left(-t\right) \cdot y, -4, x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(\left(z \cdot z - t\right) \cdot y\right) \cdot -4\right)\\
\end{array}
\end{array}
if (*.f64 y #s(literal 4 binary64)) < 1e-52Initial program 91.2%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lift--.f64N/A
sub-negN/A
distribute-lft-inN/A
associate-+l+N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
Applied rewrites97.7%
if 1e-52 < (*.f64 y #s(literal 4 binary64)) Initial program 92.5%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval97.5
Applied rewrites97.5%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 5e+27)
(fma (* t 4.0) y (* x x))
(if (<= (* z z) 1e+273)
(fma (* (* z z) -4.0) y (* x x))
(* (* (* z y) z) -4.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+27) {
tmp = fma((t * 4.0), y, (x * x));
} else if ((z * z) <= 1e+273) {
tmp = fma(((z * z) * -4.0), y, (x * x));
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+27) tmp = fma(Float64(t * 4.0), y, Float64(x * x)); elseif (Float64(z * z) <= 1e+273) tmp = fma(Float64(Float64(z * z) * -4.0), y, Float64(x * x)); else tmp = Float64(Float64(Float64(z * y) * z) * -4.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+27], N[(N[(t * 4.0), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+273], N[(N[(N[(z * z), $MachinePrecision] * -4.0), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+27}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 4, y, x \cdot x\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+273}:\\
\;\;\;\;\mathsf{fma}\left(\left(z \cdot z\right) \cdot -4, y, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot z\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 4.99999999999999979e27Initial program 99.2%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6493.7
Applied rewrites93.7%
Applied rewrites94.5%
if 4.99999999999999979e27 < (*.f64 z z) < 9.99999999999999945e272Initial program 99.8%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6486.5
Applied rewrites86.5%
if 9.99999999999999945e272 < (*.f64 z z) Initial program 74.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6479.5
Applied rewrites79.5%
Applied rewrites88.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z z) t)))
(if (<= t_1 -1e-126)
(* (* t y) 4.0)
(if (<= t_1 2e+212) (* 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 <= -1e-126) {
tmp = (t * y) * 4.0;
} else if (t_1 <= 2e+212) {
tmp = x * x;
} else {
tmp = ((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) :: t_1
real(8) :: tmp
t_1 = (z * z) - t
if (t_1 <= (-1d-126)) then
tmp = (t * y) * 4.0d0
else if (t_1 <= 2d+212) then
tmp = x * x
else
tmp = ((z * y) * z) * (-4.0d0)
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 (t_1 <= -1e-126) {
tmp = (t * y) * 4.0;
} else if (t_1 <= 2e+212) {
tmp = x * x;
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * z) - t tmp = 0 if t_1 <= -1e-126: tmp = (t * y) * 4.0 elif t_1 <= 2e+212: tmp = x * x else: tmp = ((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 <= -1e-126) tmp = Float64(Float64(t * y) * 4.0); elseif (t_1 <= 2e+212) tmp = Float64(x * x); else tmp = Float64(Float64(Float64(z * y) * z) * -4.0); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * z) - t; tmp = 0.0; if (t_1 <= -1e-126) tmp = (t * y) * 4.0; elseif (t_1 <= 2e+212) tmp = x * x; else tmp = ((z * y) * z) * -4.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-126], N[(N[(t * y), $MachinePrecision] * 4.0), $MachinePrecision], If[LessEqual[t$95$1, 2e+212], N[(x * x), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot z - t\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-126}:\\
\;\;\;\;\left(t \cdot y\right) \cdot 4\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+212}:\\
\;\;\;\;x \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot z\right) \cdot -4\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < -9.9999999999999995e-127Initial program 98.3%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6462.7
Applied rewrites62.7%
if -9.9999999999999995e-127 < (-.f64 (*.f64 z z) t) < 1.9999999999999998e212Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6424.5
Applied rewrites24.5%
Applied rewrites24.5%
Taylor expanded in t around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites91.9%
Taylor expanded in x around inf
Applied rewrites63.6%
if 1.9999999999999998e212 < (-.f64 (*.f64 z z) t) Initial program 79.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.9
Applied rewrites71.9%
Applied rewrites79.4%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+273) (fma x x (* (* (- (* z z) t) y) -4.0)) (* (* (* z y) z) -4.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+273) {
tmp = fma(x, x, ((((z * z) - t) * y) * -4.0));
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+273) tmp = fma(x, x, Float64(Float64(Float64(Float64(z * z) - t) * y) * -4.0)); else tmp = Float64(Float64(Float64(z * y) * z) * -4.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+273], N[(x * x + N[(N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+273}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(\left(z \cdot z - t\right) \cdot y\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot z\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999945e272Initial program 99.4%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-*.f64N/A
metadata-eval99.4
Applied rewrites99.4%
if 9.99999999999999945e272 < (*.f64 z z) Initial program 74.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6479.5
Applied rewrites79.5%
Applied rewrites88.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+183) (fma (* t 4.0) y (* x x)) (* (* (* z y) z) -4.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+183) {
tmp = fma((t * 4.0), y, (x * x));
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+183) tmp = fma(Float64(t * 4.0), y, Float64(x * x)); else tmp = Float64(Float64(Float64(z * y) * z) * -4.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+183], N[(N[(t * 4.0), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+183}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 4, y, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot z\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000009e183Initial program 99.3%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.7
Applied rewrites89.7%
Applied rewrites90.4%
if 5.00000000000000009e183 < (*.f64 z z) Initial program 78.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.6
Applied rewrites77.6%
Applied rewrites85.5%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+183) (fma x x (* (* t y) 4.0)) (* (* (* z y) z) -4.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+183) {
tmp = fma(x, x, ((t * y) * 4.0));
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e+183) tmp = fma(x, x, Float64(Float64(t * y) * 4.0)); else tmp = Float64(Float64(Float64(z * y) * z) * -4.0); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e+183], N[(x * x + N[(N[(t * y), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z * y), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{+183}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(t \cdot y\right) \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot z\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 5.00000000000000009e183Initial program 99.3%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.7
Applied rewrites89.7%
Applied rewrites89.7%
if 5.00000000000000009e183 < (*.f64 z z) Initial program 78.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.6
Applied rewrites77.6%
Applied rewrites85.5%
(FPCore (x y z t) :precision binary64 (if (<= (* x x) 5.4e-33) (* (* t y) 4.0) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x * x) <= 5.4e-33) {
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) <= 5.4d-33) 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) <= 5.4e-33) {
tmp = (t * y) * 4.0;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x * x) <= 5.4e-33: tmp = (t * y) * 4.0 else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x * x) <= 5.4e-33) tmp = Float64(Float64(t * 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) <= 5.4e-33) 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], 5.4e-33], N[(N[(t * y), $MachinePrecision] * 4.0), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 5.4 \cdot 10^{-33}:\\
\;\;\;\;\left(t \cdot y\right) \cdot 4\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 5.4000000000000002e-33Initial program 96.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6447.6
Applied rewrites47.6%
if 5.4000000000000002e-33 < (*.f64 x x) Initial program 87.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6427.4
Applied rewrites27.4%
Applied rewrites30.1%
Taylor expanded in t around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites88.3%
Taylor expanded in x around inf
Applied rewrites71.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 91.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.7
Applied rewrites37.7%
Applied rewrites40.6%
Taylor expanded in t around inf
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites89.4%
Taylor expanded in x around inf
Applied rewrites43.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 2024317
(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))))