
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (* x x) (* (* y 4.0) (- (* z z) t))))
double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (x * x) - ((y * 4.0d0) * ((z * z) - t))
end function
public static double code(double x, double y, double z, double t) {
return (x * x) - ((y * 4.0) * ((z * z) - t));
}
def code(x, y, z, t): return (x * x) - ((y * 4.0) * ((z * z) - t))
function code(x, y, z, t) return Float64(Float64(x * x) - Float64(Float64(y * 4.0) * Float64(Float64(z * z) - t))) end
function tmp = code(x, y, z, t) tmp = (x * x) - ((y * 4.0) * ((z * z) - t)); end
code[x_, y_, z_, t_] := N[(N[(x * x), $MachinePrecision] - N[(N[(y * 4.0), $MachinePrecision] * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot x - \left(y \cdot 4\right) \cdot \left(z \cdot z - t\right)
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 4e+296) (fma (- (* z z) t) (* y -4.0) (* x x)) (* (* -4.0 z) (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 4e+296) {
tmp = fma(((z * z) - t), (y * -4.0), (x * x));
} else {
tmp = (-4.0 * z) * (y * z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 4e+296) tmp = fma(Float64(Float64(z * z) - t), Float64(y * -4.0), Float64(x * x)); else tmp = Float64(Float64(-4.0 * z) * Float64(y * z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 4e+296], N[(N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision] * N[(y * -4.0), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * z), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 4 \cdot 10^{+296}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot z - t, y \cdot -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-4 \cdot z\right) \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 3.99999999999999993e296Initial program 95.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-eval98.9
Applied rewrites98.9%
if 3.99999999999999993e296 < (*.f64 z z) Initial program 80.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6490.6
Applied rewrites90.6%
Applied rewrites93.6%
Final simplification97.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z z) t)) (t_2 (* (* 4.0 y) t_1)) (t_3 (* (* -4.0 t_1) y)))
(if (<= t_2 -1e+186)
t_3
(if (<= t_2 5e+83) (fma x x (* (* y t) 4.0)) t_3))))
double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double t_2 = (4.0 * y) * t_1;
double t_3 = (-4.0 * t_1) * y;
double tmp;
if (t_2 <= -1e+186) {
tmp = t_3;
} else if (t_2 <= 5e+83) {
tmp = fma(x, x, ((y * t) * 4.0));
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(z * z) - t) t_2 = Float64(Float64(4.0 * y) * t_1) t_3 = Float64(Float64(-4.0 * t_1) * y) tmp = 0.0 if (t_2 <= -1e+186) tmp = t_3; elseif (t_2 <= 5e+83) tmp = fma(x, x, Float64(Float64(y * t) * 4.0)); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(4.0 * y), $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(-4.0 * t$95$1), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+186], t$95$3, If[LessEqual[t$95$2, 5e+83], N[(x * x + N[(N[(y * t), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot z - t\\
t_2 := \left(4 \cdot y\right) \cdot t\_1\\
t_3 := \left(-4 \cdot t\_1\right) \cdot y\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+186}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+83}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(y \cdot t\right) \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < -9.9999999999999998e185 or 5.00000000000000029e83 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) Initial program 85.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
unpow2N/A
lower-*.f6486.8
Applied rewrites86.8%
Applied rewrites86.8%
if -9.9999999999999998e185 < (*.f64 (*.f64 y #s(literal 4 binary64)) (-.f64 (*.f64 z z) t)) < 5.00000000000000029e83Initial program 99.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-*.f6487.5
Applied rewrites87.5%
Applied rewrites87.5%
Final simplification87.1%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 5e-49)
(fma (* 4.0 t) y (* x x))
(if (<= (* z z) 1e+283)
(fma (* y (* z z)) -4.0 (* x x))
(* (* -4.0 z) (* y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-49) {
tmp = fma((4.0 * t), y, (x * x));
} else if ((z * z) <= 1e+283) {
tmp = fma((y * (z * z)), -4.0, (x * x));
} else {
tmp = (-4.0 * z) * (y * z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e-49) tmp = fma(Float64(4.0 * t), y, Float64(x * x)); elseif (Float64(z * z) <= 1e+283) tmp = fma(Float64(y * Float64(z * z)), -4.0, Float64(x * x)); else tmp = Float64(Float64(-4.0 * z) * Float64(y * z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-49], N[(N[(4.0 * t), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+283], N[(N[(y * N[(z * z), $MachinePrecision]), $MachinePrecision] * -4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * z), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-49}:\\
\;\;\;\;\mathsf{fma}\left(4 \cdot t, y, x \cdot x\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+283}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(z \cdot z\right), -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-4 \cdot z\right) \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.9999999999999999e-49Initial program 99.1%
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.1
Applied rewrites93.1%
Applied rewrites93.9%
if 4.9999999999999999e-49 < (*.f64 z z) < 9.99999999999999955e282Initial program 92.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-*.f6479.8
Applied rewrites79.8%
if 9.99999999999999955e282 < (*.f64 z z) Initial program 79.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6488.3
Applied rewrites88.3%
Applied rewrites91.1%
Final simplification89.3%
(FPCore (x y z t)
:precision binary64
(if (<= (* z z) 5e-49)
(fma (* 4.0 t) y (* x x))
(if (<= (* z z) 1e+283)
(fma (* (* y z) z) -4.0 (* x x))
(* (* -4.0 z) (* y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 5e-49) {
tmp = fma((4.0 * t), y, (x * x));
} else if ((z * z) <= 1e+283) {
tmp = fma(((y * z) * z), -4.0, (x * x));
} else {
tmp = (-4.0 * z) * (y * z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 5e-49) tmp = fma(Float64(4.0 * t), y, Float64(x * x)); elseif (Float64(z * z) <= 1e+283) tmp = fma(Float64(Float64(y * z) * z), -4.0, Float64(x * x)); else tmp = Float64(Float64(-4.0 * z) * Float64(y * z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 5e-49], N[(N[(4.0 * t), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * z), $MachinePrecision], 1e+283], N[(N[(N[(y * z), $MachinePrecision] * z), $MachinePrecision] * -4.0 + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * z), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 5 \cdot 10^{-49}:\\
\;\;\;\;\mathsf{fma}\left(4 \cdot t, y, x \cdot x\right)\\
\mathbf{elif}\;z \cdot z \leq 10^{+283}:\\
\;\;\;\;\mathsf{fma}\left(\left(y \cdot z\right) \cdot z, -4, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-4 \cdot z\right) \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 4.9999999999999999e-49Initial program 99.1%
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.1
Applied rewrites93.1%
Applied rewrites93.9%
if 4.9999999999999999e-49 < (*.f64 z z) < 9.99999999999999955e282Initial program 92.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-*.f6479.8
Applied rewrites79.8%
Applied rewrites79.7%
if 9.99999999999999955e282 < (*.f64 z z) Initial program 79.3%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6488.3
Applied rewrites88.3%
Applied rewrites91.1%
Final simplification89.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z z) t)))
(if (<= t_1 -5000000000000.0)
(* (* 4.0 t) y)
(if (<= t_1 3e+206) (* 1.0 (* x x)) (* (* -4.0 z) (* y z))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * z) - t;
double tmp;
if (t_1 <= -5000000000000.0) {
tmp = (4.0 * t) * y;
} else if (t_1 <= 3e+206) {
tmp = 1.0 * (x * x);
} else {
tmp = (-4.0 * z) * (y * 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) :: t_1
real(8) :: tmp
t_1 = (z * z) - t
if (t_1 <= (-5000000000000.0d0)) then
tmp = (4.0d0 * t) * y
else if (t_1 <= 3d+206) then
tmp = 1.0d0 * (x * x)
else
tmp = ((-4.0d0) * z) * (y * z)
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 <= -5000000000000.0) {
tmp = (4.0 * t) * y;
} else if (t_1 <= 3e+206) {
tmp = 1.0 * (x * x);
} else {
tmp = (-4.0 * z) * (y * z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * z) - t tmp = 0 if t_1 <= -5000000000000.0: tmp = (4.0 * t) * y elif t_1 <= 3e+206: tmp = 1.0 * (x * x) else: tmp = (-4.0 * z) * (y * z) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * z) - t) tmp = 0.0 if (t_1 <= -5000000000000.0) tmp = Float64(Float64(4.0 * t) * y); elseif (t_1 <= 3e+206) tmp = Float64(1.0 * Float64(x * x)); else tmp = Float64(Float64(-4.0 * z) * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * z) - t; tmp = 0.0; if (t_1 <= -5000000000000.0) tmp = (4.0 * t) * y; elseif (t_1 <= 3e+206) tmp = 1.0 * (x * x); else tmp = (-4.0 * z) * (y * z); 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, -5000000000000.0], N[(N[(4.0 * t), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 3e+206], N[(1.0 * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * z), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot z - t\\
\mathbf{if}\;t\_1 \leq -5000000000000:\\
\;\;\;\;\left(4 \cdot t\right) \cdot y\\
\mathbf{elif}\;t\_1 \leq 3 \cdot 10^{+206}:\\
\;\;\;\;1 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-4 \cdot z\right) \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 z z) t) < -5e12Initial program 100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6478.9
Applied rewrites78.9%
Applied rewrites78.9%
if -5e12 < (-.f64 (*.f64 z z) t) < 3.0000000000000001e206Initial 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-eval96.5
Applied rewrites96.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6496.4
Applied rewrites96.4%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites71.4%
Taylor expanded in x around inf
Applied rewrites55.1%
if 3.0000000000000001e206 < (-.f64 (*.f64 z z) t) Initial program 83.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.2
Applied rewrites71.2%
Applied rewrites73.2%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+213) (fma (* 4.0 t) y (* x x)) (* (* -4.0 z) (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+213) {
tmp = fma((4.0 * t), y, (x * x));
} else {
tmp = (-4.0 * z) * (y * z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+213) tmp = fma(Float64(4.0 * t), y, Float64(x * x)); else tmp = Float64(Float64(-4.0 * z) * Float64(y * z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+213], N[(N[(4.0 * t), $MachinePrecision] * y + N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * z), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+213}:\\
\;\;\;\;\mathsf{fma}\left(4 \cdot t, y, x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-4 \cdot z\right) \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999984e212Initial program 97.7%
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-*.f6483.0
Applied rewrites83.0%
Applied rewrites84.1%
if 9.99999999999999984e212 < (*.f64 z z) Initial program 79.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6486.1
Applied rewrites86.1%
Applied rewrites88.6%
Final simplification85.5%
(FPCore (x y z t) :precision binary64 (if (<= (* z z) 1e+213) (fma x x (* (* y t) 4.0)) (* (* -4.0 z) (* y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * z) <= 1e+213) {
tmp = fma(x, x, ((y * t) * 4.0));
} else {
tmp = (-4.0 * z) * (y * z);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * z) <= 1e+213) tmp = fma(x, x, Float64(Float64(y * t) * 4.0)); else tmp = Float64(Float64(-4.0 * z) * Float64(y * z)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * z), $MachinePrecision], 1e+213], N[(x * x + N[(N[(y * t), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], N[(N[(-4.0 * z), $MachinePrecision] * N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 10^{+213}:\\
\;\;\;\;\mathsf{fma}\left(x, x, \left(y \cdot t\right) \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-4 \cdot z\right) \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z z) < 9.99999999999999984e212Initial program 97.7%
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-*.f6483.0
Applied rewrites83.0%
Applied rewrites83.0%
if 9.99999999999999984e212 < (*.f64 z z) Initial program 79.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6486.1
Applied rewrites86.1%
Applied rewrites88.6%
Final simplification84.7%
(FPCore (x y z t) :precision binary64 (fma x x (* (* y (- (* z z) t)) -4.0)))
double code(double x, double y, double z, double t) {
return fma(x, x, ((y * ((z * z) - t)) * -4.0));
}
function code(x, y, z, t) return fma(x, x, Float64(Float64(y * Float64(Float64(z * z) - t)) * -4.0)) end
code[x_, y_, z_, t_] := N[(x * x + N[(N[(y * N[(N[(z * z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, x, \left(y \cdot \left(z \cdot z - t\right)\right) \cdot -4\right)
\end{array}
Initial program 92.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-eval95.3
Applied rewrites95.3%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (<= x 2.8e-34) (* (* 4.0 t) y) (* 1.0 (* x x))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2.8e-34) {
tmp = (4.0 * t) * y;
} else {
tmp = 1.0 * (x * x);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= 2.8d-34) then
tmp = (4.0d0 * t) * y
else
tmp = 1.0d0 * (x * x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= 2.8e-34) {
tmp = (4.0 * t) * y;
} else {
tmp = 1.0 * (x * x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 2.8e-34: tmp = (4.0 * t) * y else: tmp = 1.0 * (x * x) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 2.8e-34) tmp = Float64(Float64(4.0 * t) * y); else tmp = Float64(1.0 * Float64(x * x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= 2.8e-34) tmp = (4.0 * t) * y; else tmp = 1.0 * (x * x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 2.8e-34], N[(N[(4.0 * t), $MachinePrecision] * y), $MachinePrecision], N[(1.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.8 \cdot 10^{-34}:\\
\;\;\;\;\left(4 \cdot t\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < 2.79999999999999997e-34Initial program 94.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f64N/A
lower-*.f6437.8
Applied rewrites37.8%
Applied rewrites37.8%
if 2.79999999999999997e-34 < x Initial program 87.6%
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-eval94.5
Applied rewrites94.5%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites94.5%
Taylor expanded in x around inf
Applied rewrites64.5%
Final simplification45.4%
(FPCore (x y z t) :precision binary64 (* 1.0 (* x x)))
double code(double x, double y, double z, double t) {
return 1.0 * (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 = 1.0d0 * (x * x)
end function
public static double code(double x, double y, double z, double t) {
return 1.0 * (x * x);
}
def code(x, y, z, t): return 1.0 * (x * x)
function code(x, y, z, t) return Float64(1.0 * Float64(x * x)) end
function tmp = code(x, y, z, t) tmp = 1.0 * (x * x); end
code[x_, y_, z_, t_] := N[(1.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot \left(x \cdot x\right)
\end{array}
Initial program 92.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-eval95.3
Applied rewrites95.3%
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lift-*.f64N/A
lift--.f64N/A
flip--N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6495.2
Applied rewrites95.2%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites70.5%
Taylor expanded in x around inf
Applied rewrites39.2%
(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 2024295
(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))))