
(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 11 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 (<= (* 4.0 y) 5e-119) (fma (* z (* -4.0 y)) 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 ((4.0 * y) <= 5e-119) {
tmp = fma((z * (-4.0 * y)), 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(4.0 * y) <= 5e-119) tmp = fma(Float64(z * Float64(-4.0 * y)), 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[(4.0 * y), $MachinePrecision], 5e-119], N[(N[(z * N[(-4.0 * y), $MachinePrecision]), $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}\;4 \cdot y \leq 5 \cdot 10^{-119}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(-4 \cdot y\right), 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)) < 4.99999999999999993e-119Initial program 92.1%
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 rewrites99.3%
if 4.99999999999999993e-119 < (*.f64 y #s(literal 4 binary64)) Initial program 91.7%
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.6
Applied rewrites97.6%
Final simplification98.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* 4.0 y) t)))
(if (<= (* x x) 1.05e-293)
t_1
(if (<= (* x x) 5.6e-104)
(* (* (* z y) z) -4.0)
(if (<= (* x x) 4.8e+65) t_1 (* x x))))))
double code(double x, double y, double z, double t) {
double t_1 = (4.0 * y) * t;
double tmp;
if ((x * x) <= 1.05e-293) {
tmp = t_1;
} else if ((x * x) <= 5.6e-104) {
tmp = ((z * y) * z) * -4.0;
} else if ((x * x) <= 4.8e+65) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (4.0d0 * y) * t
if ((x * x) <= 1.05d-293) then
tmp = t_1
else if ((x * x) <= 5.6d-104) then
tmp = ((z * y) * z) * (-4.0d0)
else if ((x * x) <= 4.8d+65) then
tmp = t_1
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (4.0 * y) * t;
double tmp;
if ((x * x) <= 1.05e-293) {
tmp = t_1;
} else if ((x * x) <= 5.6e-104) {
tmp = ((z * y) * z) * -4.0;
} else if ((x * x) <= 4.8e+65) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (4.0 * y) * t tmp = 0 if (x * x) <= 1.05e-293: tmp = t_1 elif (x * x) <= 5.6e-104: tmp = ((z * y) * z) * -4.0 elif (x * x) <= 4.8e+65: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(4.0 * y) * t) tmp = 0.0 if (Float64(x * x) <= 1.05e-293) tmp = t_1; elseif (Float64(x * x) <= 5.6e-104) tmp = Float64(Float64(Float64(z * y) * z) * -4.0); elseif (Float64(x * x) <= 4.8e+65) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (4.0 * y) * t; tmp = 0.0; if ((x * x) <= 1.05e-293) tmp = t_1; elseif ((x * x) <= 5.6e-104) tmp = ((z * y) * z) * -4.0; elseif ((x * x) <= 4.8e+65) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(4.0 * y), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 1.05e-293], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 5.6e-104], N[(N[(N[(z * y), $MachinePrecision] * z), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 4.8e+65], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(4 \cdot y\right) \cdot t\\
\mathbf{if}\;x \cdot x \leq 1.05 \cdot 10^{-293}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot x \leq 5.6 \cdot 10^{-104}:\\
\;\;\;\;\left(\left(z \cdot y\right) \cdot z\right) \cdot -4\\
\mathbf{elif}\;x \cdot x \leq 4.8 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.05000000000000003e-293 or 5.6e-104 < (*.f64 x x) < 4.8000000000000003e65Initial program 94.3%
Taylor expanded in t around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.1
Applied rewrites58.1%
if 1.05000000000000003e-293 < (*.f64 x x) < 5.6e-104Initial program 92.0%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites48.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.6
Applied rewrites55.6%
Applied rewrites63.3%
if 4.8000000000000003e65 < (*.f64 x x) Initial program 90.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6479.0
Applied rewrites79.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (* 4.0 y) t)))
(if (<= (* x x) 1.2e-293)
t_1
(if (<= (* x x) 1.35e-107)
(* (* (* z z) y) -4.0)
(if (<= (* x x) 4.8e+65) t_1 (* x x))))))
double code(double x, double y, double z, double t) {
double t_1 = (4.0 * y) * t;
double tmp;
if ((x * x) <= 1.2e-293) {
tmp = t_1;
} else if ((x * x) <= 1.35e-107) {
tmp = ((z * z) * y) * -4.0;
} else if ((x * x) <= 4.8e+65) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (4.0d0 * y) * t
if ((x * x) <= 1.2d-293) then
tmp = t_1
else if ((x * x) <= 1.35d-107) then
tmp = ((z * z) * y) * (-4.0d0)
else if ((x * x) <= 4.8d+65) then
tmp = t_1
else
tmp = x * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (4.0 * y) * t;
double tmp;
if ((x * x) <= 1.2e-293) {
tmp = t_1;
} else if ((x * x) <= 1.35e-107) {
tmp = ((z * z) * y) * -4.0;
} else if ((x * x) <= 4.8e+65) {
tmp = t_1;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (4.0 * y) * t tmp = 0 if (x * x) <= 1.2e-293: tmp = t_1 elif (x * x) <= 1.35e-107: tmp = ((z * z) * y) * -4.0 elif (x * x) <= 4.8e+65: tmp = t_1 else: tmp = x * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(4.0 * y) * t) tmp = 0.0 if (Float64(x * x) <= 1.2e-293) tmp = t_1; elseif (Float64(x * x) <= 1.35e-107) tmp = Float64(Float64(Float64(z * z) * y) * -4.0); elseif (Float64(x * x) <= 4.8e+65) tmp = t_1; else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (4.0 * y) * t; tmp = 0.0; if ((x * x) <= 1.2e-293) tmp = t_1; elseif ((x * x) <= 1.35e-107) tmp = ((z * z) * y) * -4.0; elseif ((x * x) <= 4.8e+65) tmp = t_1; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(4.0 * y), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[N[(x * x), $MachinePrecision], 1.2e-293], t$95$1, If[LessEqual[N[(x * x), $MachinePrecision], 1.35e-107], N[(N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision], If[LessEqual[N[(x * x), $MachinePrecision], 4.8e+65], t$95$1, N[(x * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(4 \cdot y\right) \cdot t\\
\mathbf{if}\;x \cdot x \leq 1.2 \cdot 10^{-293}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot x \leq 1.35 \cdot 10^{-107}:\\
\;\;\;\;\left(\left(z \cdot z\right) \cdot y\right) \cdot -4\\
\mathbf{elif}\;x \cdot x \leq 4.8 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if (*.f64 x x) < 1.2e-293 or 1.35e-107 < (*.f64 x x) < 4.8000000000000003e65Initial program 94.3%
Taylor expanded in t around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6458.1
Applied rewrites58.1%
if 1.2e-293 < (*.f64 x x) < 1.35e-107Initial program 92.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6455.6
Applied rewrites55.6%
if 4.8000000000000003e65 < (*.f64 x x) Initial program 90.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6479.0
Applied rewrites79.0%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 2e+125)
(fma x x (* (* t y) 4.0))
(if (<= (* z z) 2e+270)
(fma x x (* (* (* z z) y) -4.0))
(* (* (* z y) z) -4.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+125) {
tmp = fma(x, x, ((t * y) * 4.0));
} else if ((z * z) <= 2e+270) {
tmp = fma(x, x, (((z * z) * 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) <= 2e+125) tmp = fma(x, x, Float64(Float64(t * y) * 4.0)); elseif (Float64(z * z) <= 2e+270) tmp = fma(x, x, Float64(Float64(Float64(z * z) * 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], 2e+125], N[(x * x + N[(N[(t * y), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+270], N[(x * x + N[(N[(N[(z * z), $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 2 \cdot 10^{+125}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(t \cdot y\right) \cdot 4\right)\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+270}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(\left(z \cdot z\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) < 1.9999999999999998e125Initial program 98.1%
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.3
Applied rewrites99.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6490.7
Applied rewrites90.7%
if 1.9999999999999998e125 < (*.f64 z z) < 2.0000000000000001e270Initial program 96.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-eval99.8
Applied rewrites99.8%
Taylor expanded in z around inf
unpow2N/A
lower-*.f6489.9
Applied rewrites89.9%
if 2.0000000000000001e270 < (*.f64 z z) Initial program 72.7%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.7
Applied rewrites77.7%
Applied rewrites91.7%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 2e+125)
(fma x x (* (* t y) 4.0))
(if (<= (* z z) 2e+266)
(fma (* (* z z) y) -4.0 (* x x))
(* (* (* z y) z) -4.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 2e+125) {
tmp = fma(x, x, ((t * y) * 4.0));
} else if ((z * z) <= 2e+266) {
tmp = fma(((z * z) * y), -4.0, (x * x));
} else {
tmp = ((z * y) * z) * -4.0;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 2e+125) tmp = fma(x, x, Float64(Float64(t * y) * 4.0)); elseif (Float64(z * z) <= 2e+266) tmp = fma(Float64(Float64(z * z) * y), -4.0, 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], 2e+125], N[(x * x + N[(N[(t * y), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 2e+266], N[(N[(N[(z * z), $MachinePrecision] * y), $MachinePrecision] * -4.0 + 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 2 \cdot 10^{+125}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(t \cdot y\right) \cdot 4\right)\\
\mathbf{elif}\;z \cdot z \leq 2 \cdot 10^{+266}:\\
\;\;\;\;\mathsf{fma}\left(\left(z \cdot z\right) \cdot y, -4, 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) < 1.9999999999999998e125Initial program 98.1%
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.3
Applied rewrites99.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6490.7
Applied rewrites90.7%
if 1.9999999999999998e125 < (*.f64 z z) < 2.0000000000000001e266Initial program 99.8%
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-*.f6489.2
Applied rewrites89.2%
if 2.0000000000000001e266 < (*.f64 z z) Initial program 72.0%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.1%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6476.9
Applied rewrites76.9%
Applied rewrites90.5%
(FPCore (x y z t) :precision binary64 (if (<= z 6.2e+156) (fma x x (* (* (- (* z z) t) y) -4.0)) (fma (* z (* -4.0 y)) z (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 6.2e+156) {
tmp = fma(x, x, ((((z * z) - t) * y) * -4.0));
} else {
tmp = fma((z * (-4.0 * y)), z, (x * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 6.2e+156) tmp = fma(x, x, Float64(Float64(Float64(Float64(z * z) - t) * y) * -4.0)); else tmp = fma(Float64(z * Float64(-4.0 * y)), z, Float64(x * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 6.2e+156], N[(x * x + N[(N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision] * z + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.2 \cdot 10^{+156}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(\left(z \cdot z - t\right) \cdot y\right) \cdot -4\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(-4 \cdot y\right), z, x \cdot x\right)\\
\end{array}
\end{array}
if z < 6.2000000000000004e156Initial program 95.0%
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.3
Applied rewrites97.3%
if 6.2000000000000004e156 < z Initial program 72.1%
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 rewrites94.0%
Taylor expanded in t around 0
unpow2N/A
lower-*.f6496.9
Applied rewrites96.9%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (<= z 8.5e+62) (fma x x (* (* t y) 4.0)) (fma (* z (* -4.0 y)) z (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 8.5e+62) {
tmp = fma(x, x, ((t * y) * 4.0));
} else {
tmp = fma((z * (-4.0 * y)), z, (x * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= 8.5e+62) tmp = fma(x, x, Float64(Float64(t * y) * 4.0)); else tmp = fma(Float64(z * Float64(-4.0 * y)), z, Float64(x * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 8.5e+62], N[(x * x + N[(N[(t * y), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(-4.0 * y), $MachinePrecision]), $MachinePrecision] * z + N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8.5 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(t \cdot y\right) \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \left(-4 \cdot y\right), z, x \cdot x\right)\\
\end{array}
\end{array}
if z < 8.4999999999999997e62Initial program 95.2%
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.1
Applied rewrites97.1%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6482.0
Applied rewrites82.0%
if 8.4999999999999997e62 < z Initial program 78.0%
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 rewrites91.5%
Taylor expanded in t around 0
unpow2N/A
lower-*.f6493.6
Applied rewrites93.6%
Final simplification84.2%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+193) (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+193) {
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+193) 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+193], 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^{+193}:\\
\;\;\;\;\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) < 4.99999999999999972e193Initial program 98.3%
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%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f64N/A
lower-*.f6487.8
Applied rewrites87.8%
if 4.99999999999999972e193 < (*.f64 z z) Initial program 75.8%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites4.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6478.7
Applied rewrites78.7%
Applied rewrites90.3%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 5e+193) (fma (* 4.0 y) t (* x x)) (* (* (* z y) z) -4.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e+193) {
tmp = fma((4.0 * y), t, (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+193) tmp = fma(Float64(4.0 * y), t, 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+193], N[(N[(4.0 * y), $MachinePrecision] * t + 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^{+193}:\\
\;\;\;\;\mathsf{fma}\left(4 \cdot y, t, 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.99999999999999972e193Initial program 98.3%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.3
Applied rewrites87.3%
if 4.99999999999999972e193 < (*.f64 z z) Initial program 75.8%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
flip--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites4.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6478.7
Applied rewrites78.7%
Applied rewrites90.3%
(FPCore (x y z t) :precision binary64 (if (<= x 6e+32) (* (* 4.0 y) t) (* x x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 6e+32) {
tmp = (4.0 * y) * t;
} 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 <= 6d+32) then
tmp = (4.0d0 * y) * t
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 <= 6e+32) {
tmp = (4.0 * y) * t;
} else {
tmp = x * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 6e+32: tmp = (4.0 * y) * t else: tmp = x * x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 6e+32) tmp = Float64(Float64(4.0 * y) * t); else tmp = Float64(x * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 6e+32) tmp = (4.0 * y) * t; else tmp = x * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 6e+32], N[(N[(4.0 * y), $MachinePrecision] * t), $MachinePrecision], N[(x * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{+32}:\\
\;\;\;\;\left(4 \cdot y\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot x\\
\end{array}
\end{array}
if x < 6e32Initial program 93.8%
Taylor expanded in t around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6438.2
Applied rewrites38.2%
if 6e32 < x Initial program 85.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6473.0
Applied rewrites73.0%
(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 92.0%
Taylor expanded in x around inf
unpow2N/A
lower-*.f6444.4
Applied rewrites44.4%
(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 2024235
(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))))