
(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 (<= (- (* x x) (* (* y 4.0) (- (* z z) t))) INFINITY) (- (* x x) (fma (* -4.0 y) t (* (* (* 4.0 y) z) z))) (fma x x (/ (* y -4.0) (/ -1.0 t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x * x) - ((y * 4.0) * ((z * z) - t))) <= ((double) INFINITY)) {
tmp = (x * x) - fma((-4.0 * y), t, (((4.0 * y) * z) * z));
} else {
tmp = fma(x, x, ((y * -4.0) / (-1.0 / t)));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) <= Inf) tmp = Float64(Float64(x * x) - fma(Float64(-4.0 * y), t, Float64(Float64(Float64(4.0 * y) * z) * z))); else tmp = fma(x, x, Float64(Float64(y * -4.0) / Float64(-1.0 / t))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(x * x), $MachinePrecision] - N[(N[(-4.0 * y), $MachinePrecision] * t + N[(N[(N[(4.0 * y), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * x + N[(N[(y * -4.0), $MachinePrecision] / N[(-1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right) \leq \infty:\\
\;\;\;\;x \cdot x - \mathsf{fma}\left(-4 \cdot y, t, \left(\left(4 \cdot y\right) \cdot z\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \frac{y \cdot -4}{\frac{-1}{t}}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) < +inf.0Initial program 95.7%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.9
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
if +inf.0 < (-.f64 (*.f64 x x) (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t))) Initial program 0.0%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6416.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6416.7
Applied rewrites16.7%
Applied rewrites0.0%
Taylor expanded in z around 0
lower-/.f6466.7
Applied rewrites66.7%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lift-/.f64N/A
distribute-neg-fracN/A
lower-/.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f6475.0
Applied rewrites75.0%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 1e-37)
(- (* x x) (* (* y 4.0) (- t)))
(if (<= (* z z) 1e+57)
(* (* (- (* z z) t) y) -4.0)
(if (<= (* z z) 2e+297)
(fma (* (* z z) -4.0) y (* x x))
(* (* z y) (* -4.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e-37) {
tmp = (x * x) - ((y * 4.0) * -t);
} else if ((z * z) <= 1e+57) {
tmp = (((z * z) - t) * y) * -4.0;
} else if ((z * z) <= 2e+297) {
tmp = fma(((z * z) * -4.0), y, (x * x));
} else {
tmp = (z * y) * (-4.0 * z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e-37) tmp = Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(-t))); elseif (Float64(z * z) <= 1e+57) tmp = Float64(Float64(Float64(Float64(z * z) - t) * y) * -4.0); elseif (Float64(z * z) <= 2e+297) tmp = fma(Float64(Float64(z * z) * -4.0), y, Float64(x * x)); else tmp = Float64(Float64(z * y) * Float64(-4.0 * z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e-37], N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+57], N[(N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+297], N[(N[(N[(z * z), $MachinePrecision] * -4.0), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(-4.0 * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-37}:\\
\;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(-t\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+57}:\\
\;\;\;\;\left(\left(z \cdot z - t\right) \cdot y\right) \cdot -4\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+297}:\\
\;\;\;\;\mathsf{fma}\left(\left(z \cdot z\right) \cdot -4, y, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000007e-37Initial program 99.1%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6496.0
Applied rewrites96.0%
if 1.00000000000000007e-37 < (*.f64 z z) < 1.00000000000000005e57Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6494.7
Applied rewrites94.7%
if 1.00000000000000005e57 < (*.f64 z z) < 2e297Initial program 95.1%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6495.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6495.0
Applied rewrites95.0%
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-*.f6485.3
Applied rewrites85.3%
if 2e297 < (*.f64 z z) Initial program 74.0%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6490.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.5
Applied rewrites90.5%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.7
Applied rewrites76.7%
Applied rewrites86.8%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 1e-37)
(- (* x x) (* (* y 4.0) (- t)))
(if (<= (* z z) 1e+57)
(* (* (- (* z z) t) y) -4.0)
(if (<= (* z z) 2e+297)
(fma (* (* z z) y) -4.0 (* x x))
(* (* z y) (* -4.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e-37) {
tmp = (x * x) - ((y * 4.0) * -t);
} else if ((z * z) <= 1e+57) {
tmp = (((z * z) - t) * y) * -4.0;
} else if ((z * z) <= 2e+297) {
tmp = fma(((z * z) * y), -4.0, (x * x));
} else {
tmp = (z * y) * (-4.0 * z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e-37) tmp = Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(-t))); elseif (Float64(z * z) <= 1e+57) tmp = Float64(Float64(Float64(Float64(z * z) - t) * y) * -4.0); elseif (Float64(z * z) <= 2e+297) tmp = fma(Float64(Float64(z * z) * y), -4.0, Float64(x * x)); else tmp = Float64(Float64(z * y) * Float64(-4.0 * z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e-37], N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+57], N[(N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+297], N[(N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision] * -4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(-4.0 * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{-37}:\\
\;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(-t\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+57}:\\
\;\;\;\;\left(\left(z \cdot z - t\right) \cdot y\right) \cdot -4\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+297}:\\
\;\;\;\;\mathsf{fma}\left(\left(z \cdot z\right) \cdot y, -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 1.00000000000000007e-37Initial program 99.1%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6496.0
Applied rewrites96.0%
if 1.00000000000000007e-37 < (*.f64 z z) < 1.00000000000000005e57Initial program 99.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6494.7
Applied rewrites94.7%
if 1.00000000000000005e57 < (*.f64 z z) < 2e297Initial program 95.1%
Taylor expanded in t around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6483.0
Applied rewrites83.0%
if 2e297 < (*.f64 z z) Initial program 74.0%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6490.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.5
Applied rewrites90.5%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.7
Applied rewrites76.7%
Applied rewrites86.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+297) (- (* x x) (* (* y 4.0) (fma z z (- t)))) (* (* z y) (* -4.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+297) {
tmp = (x * x) - ((y * 4.0) * fma(z, z, -t));
} else {
tmp = (z * y) * (-4.0 * z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+297) tmp = Float64(Float64(x * x) - Float64(Float64(y * 4.0) * fma(z, z, Float64(-t)))); else tmp = Float64(Float64(z * y) * Float64(-4.0 * z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+297], N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(z * z + (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(-4.0 * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+297}:\\
\;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \mathsf{fma}\left(z, z, -t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2e297Initial program 98.3%
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
lower-neg.f6498.3
Applied rewrites98.3%
if 2e297 < (*.f64 z z) Initial program 74.0%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6490.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.5
Applied rewrites90.5%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.7
Applied rewrites76.7%
Applied rewrites86.8%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 2e+297) (- (* x x) (* (* y 4.0) (- (* z z) t))) (* (* z y) (* -4.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+297) {
tmp = (x * x) - ((y * 4.0) * ((z * z) - t));
} else {
tmp = (z * y) * (-4.0 * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z * z) <= 2d+297) then
tmp = (x * x) - ((y * 4.0d0) * ((z * z) - t))
else
tmp = (z * y) * ((-4.0d0) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+297) {
tmp = (x * x) - ((y * 4.0) * ((z * z) - t));
} else {
tmp = (z * y) * (-4.0 * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 2e+297: tmp = (x * x) - ((y * 4.0) * ((z * z) - t)) else: tmp = (z * y) * (-4.0 * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+297) tmp = Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))); else tmp = Float64(Float64(z * y) * Float64(-4.0 * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 2e+297) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); else tmp = (z * y) * (-4.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 2e+297], N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(-4.0 * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 2 \cdot 10^{+297}:\\
\;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 2e297Initial program 98.3%
if 2e297 < (*.f64 z z) Initial program 74.0%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6490.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.5
Applied rewrites90.5%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.7
Applied rewrites76.7%
Applied rewrites86.8%
(FPCore (x y z t) :precision binary64 (if (<= z 7e+67) (- (* x x) (* (* y 4.0) (- t))) (* (* z y) (* -4.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7e+67) {
tmp = (x * x) - ((y * 4.0) * -t);
} else {
tmp = (z * y) * (-4.0 * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 7d+67) then
tmp = (x * x) - ((y * 4.0d0) * -t)
else
tmp = (z * y) * ((-4.0d0) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7e+67) {
tmp = (x * x) - ((y * 4.0) * -t);
} else {
tmp = (z * y) * (-4.0 * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 7e+67: tmp = (x * x) - ((y * 4.0) * -t) else: tmp = (z * y) * (-4.0 * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 7e+67) tmp = Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(-t))); else tmp = Float64(Float64(z * y) * Float64(-4.0 * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 7e+67) tmp = (x * x) - ((y * 4.0) * -t); else tmp = (z * y) * (-4.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 7e+67], N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * (-t)), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(-4.0 * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{+67}:\\
\;\;\;\;x \cdot x - \left(y \cdot 4\right) \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)\\
\end{array}
\end{array}
if z < 7e67Initial program 96.9%
Taylor expanded in z around 0
mul-1-negN/A
lower-neg.f6477.1
Applied rewrites77.1%
if 7e67 < z Initial program 72.7%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6490.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.0
Applied rewrites90.0%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites83.7%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 3.3e+92) (* (* t 4.0) y) (* (* (* z z) y) -4.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 3.3e+92) {
tmp = (t * 4.0) * 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) <= 3.3d+92) then
tmp = (t * 4.0d0) * 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) <= 3.3e+92) {
tmp = (t * 4.0) * y;
} else {
tmp = ((z * z) * y) * -4.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * z) <= 3.3e+92: tmp = (t * 4.0) * y else: tmp = ((z * z) * y) * -4.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 3.3e+92) tmp = Float64(Float64(t * 4.0) * y); else tmp = Float64(Float64(Float64(z * z) * y) * -4.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * z) <= 3.3e+92) tmp = (t * 4.0) * y; else tmp = ((z * z) * y) * -4.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 3.3e+92], N[(N[(t * 4.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 3.3 \cdot 10^{+92}:\\
\;\;\;\;\left(t \cdot 4\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(\left(z \cdot z\right) \cdot y\right) \cdot -4\\
\end{array}
\end{array}
if (*.f64 z z) < 3.29999999999999974e92Initial program 99.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6456.7
Applied rewrites56.7%
Applied rewrites56.7%
if 3.29999999999999974e92 < (*.f64 z z) Initial program 80.5%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6473.4
Applied rewrites73.4%
(FPCore (x y z t) :precision binary64 (if (<= z 7e+67) (fma (* t y) 4.0 (* x x)) (* (* z y) (* -4.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7e+67) {
tmp = fma((t * y), 4.0, (x * x));
} else {
tmp = (z * y) * (-4.0 * z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 7e+67) tmp = fma(Float64(t * y), 4.0, Float64(x * x)); else tmp = Float64(Float64(z * y) * Float64(-4.0 * z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 7e+67], N[(N[(t * y), $MachinePrecision] * 4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(-4.0 * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot y, 4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)\\
\end{array}
\end{array}
if z < 7e67Initial program 96.9%
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-*.f6477.1
Applied rewrites77.1%
if 7e67 < z Initial program 72.7%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6490.0
lift-*.f64N/A
*-commutativeN/A
lower-*.f6490.0
Applied rewrites90.0%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites83.7%
(FPCore (x y z t) :precision binary64 (if (<= z 2e+50) (* (* t 4.0) y) (* (* z y) (* -4.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2e+50) {
tmp = (t * 4.0) * y;
} else {
tmp = (z * y) * (-4.0 * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= 2d+50) then
tmp = (t * 4.0d0) * y
else
tmp = (z * y) * ((-4.0d0) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2e+50) {
tmp = (t * 4.0) * y;
} else {
tmp = (z * y) * (-4.0 * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 2e+50: tmp = (t * 4.0) * y else: tmp = (z * y) * (-4.0 * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 2e+50) tmp = Float64(Float64(t * 4.0) * y); else tmp = Float64(Float64(z * y) * Float64(-4.0 * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 2e+50) tmp = (t * 4.0) * y; else tmp = (z * y) * (-4.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 2e+50], N[(N[(t * 4.0), $MachinePrecision] * y), $MachinePrecision], N[(N[(z * y), $MachinePrecision] * N[(-4.0 * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{+50}:\\
\;\;\;\;\left(t \cdot 4\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot y\right) \cdot \left(-4 \cdot z\right)\\
\end{array}
\end{array}
if z < 2.0000000000000002e50Initial program 97.4%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6446.2
Applied rewrites46.2%
Applied rewrites46.2%
if 2.0000000000000002e50 < z Initial program 73.2%
lift-*.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-inN/A
neg-mul-1N/A
associate-*r*N/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6489.2
lift-*.f64N/A
*-commutativeN/A
lower-*.f6489.2
Applied rewrites89.2%
Taylor expanded in z around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6467.4
Applied rewrites67.4%
Applied rewrites79.0%
(FPCore (x y z t) :precision binary64 (* (* t 4.0) y))
double code(double x, double y, double z, double t) {
return (t * 4.0) * y;
}
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 = (t * 4.0d0) * y
end function
public static double code(double x, double y, double z, double t) {
return (t * 4.0) * y;
}
def code(x, y, z, t): return (t * 4.0) * y
function code(x, y, z, t) return Float64(Float64(t * 4.0) * y) end
function tmp = code(x, y, z, t) tmp = (t * 4.0) * y; end
code[x_, y_, z_, t_] := N[(N[(t * 4.0), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\left(t \cdot 4\right) \cdot y
\end{array}
Initial program 91.2%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6438.0
Applied rewrites38.0%
Applied rewrites38.0%
(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 2024314
(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))))