
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
(FPCore (x y z t a b c) :precision binary64 (fma a (* b -0.25) (fma 0.0625 (* t z) (fma x y c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(a, (b * -0.25), fma(0.0625, (t * z), fma(x, y, c)));
}
function code(x, y, z, t, a, b, c) return fma(a, Float64(b * -0.25), fma(0.0625, Float64(t * z), fma(x, y, c))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(a * N[(b * -0.25), $MachinePrecision] + N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(x, y, c\right)\right)\right)
\end{array}
Initial program 97.3%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6498.5
Simplified98.5%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma x y (* 0.0625 (* t z)))) (t_2 (+ (* x y) (/ (* t z) 16.0)))) (if (<= t_2 -1e+147) t_1 (if (<= t_2 5e+116) (fma a (* b -0.25) c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(x, y, (0.0625 * (t * z)));
double t_2 = (x * y) + ((t * z) / 16.0);
double tmp;
if (t_2 <= -1e+147) {
tmp = t_1;
} else if (t_2 <= 5e+116) {
tmp = fma(a, (b * -0.25), c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(x, y, Float64(0.0625 * Float64(t * z))) t_2 = Float64(Float64(x * y) + Float64(Float64(t * z) / 16.0)) tmp = 0.0 if (t_2 <= -1e+147) tmp = t_1; elseif (t_2 <= 5e+116) tmp = fma(a, Float64(b * -0.25), c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(x * y + N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+147], t$95$1, If[LessEqual[t$95$2, 5e+116], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, 0.0625 \cdot \left(t \cdot z\right)\right)\\
t_2 := x \cdot y + \frac{t \cdot z}{16}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+147}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < -9.9999999999999998e146 or 5.00000000000000025e116 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) Initial program 94.1%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6496.7
Simplified96.7%
Taylor expanded in a around 0
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6494.1
Simplified94.1%
Taylor expanded in t around inf
*-lowering-*.f64N/A
*-lowering-*.f6484.1
Simplified84.1%
if -9.9999999999999998e146 < (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) < 5.00000000000000025e116Initial program 100.0%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64100.0
Simplified100.0%
Taylor expanded in c around inf
Simplified80.4%
Final simplification82.1%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* x y) -1e+47)
(fma y x c)
(if (<= (* x y) 0.0)
(fma (* t z) 0.0625 c)
(if (<= (* x y) 1e+116)
(fma a (* b -0.25) c)
(fma a (* b -0.25) (* x y))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -1e+47) {
tmp = fma(y, x, c);
} else if ((x * y) <= 0.0) {
tmp = fma((t * z), 0.0625, c);
} else if ((x * y) <= 1e+116) {
tmp = fma(a, (b * -0.25), c);
} else {
tmp = fma(a, (b * -0.25), (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -1e+47) tmp = fma(y, x, c); elseif (Float64(x * y) <= 0.0) tmp = fma(Float64(t * z), 0.0625, c); elseif (Float64(x * y) <= 1e+116) tmp = fma(a, Float64(b * -0.25), c); else tmp = fma(a, Float64(b * -0.25), Float64(x * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+47], N[(y * x + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 0.0], N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+116], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{elif}\;x \cdot y \leq 0:\\
\;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1e47Initial program 91.6%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6477.6
Simplified77.6%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6477.6
Applied egg-rr77.6%
if -1e47 < (*.f64 x y) < 0.0Initial program 100.0%
Taylor expanded in z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6472.1
Simplified72.1%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6472.1
Applied egg-rr72.1%
if 0.0 < (*.f64 x y) < 1.00000000000000002e116Initial program 97.4%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6498.8
Simplified98.8%
Taylor expanded in c around inf
Simplified76.5%
if 1.00000000000000002e116 < (*.f64 x y) Initial program 97.1%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6497.1
Simplified97.1%
Taylor expanded in x around inf
*-lowering-*.f6483.6
Simplified83.6%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* x y) -1e+47)
(fma y x c)
(if (<= (* x y) 0.0)
(fma (* t z) 0.0625 c)
(if (<= (* x y) 2e+105) (fma a (* b -0.25) c) (fma y x c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -1e+47) {
tmp = fma(y, x, c);
} else if ((x * y) <= 0.0) {
tmp = fma((t * z), 0.0625, c);
} else if ((x * y) <= 2e+105) {
tmp = fma(a, (b * -0.25), c);
} else {
tmp = fma(y, x, c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -1e+47) tmp = fma(y, x, c); elseif (Float64(x * y) <= 0.0) tmp = fma(Float64(t * z), 0.0625, c); elseif (Float64(x * y) <= 2e+105) tmp = fma(a, Float64(b * -0.25), c); else tmp = fma(y, x, c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+47], N[(y * x + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 0.0], N[(N[(t * z), $MachinePrecision] * 0.0625 + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+105], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], N[(y * x + c), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{elif}\;x \cdot y \leq 0:\\
\;\;\;\;\mathsf{fma}\left(t \cdot z, 0.0625, c\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1e47 or 1.9999999999999999e105 < (*.f64 x y) Initial program 94.0%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6479.1
Simplified79.1%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6479.1
Applied egg-rr79.1%
if -1e47 < (*.f64 x y) < 0.0Initial program 100.0%
Taylor expanded in z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6472.1
Simplified72.1%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6472.1
Applied egg-rr72.1%
if 0.0 < (*.f64 x y) < 1.9999999999999999e105Initial program 97.4%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6498.8
Simplified98.8%
Taylor expanded in c around inf
Simplified76.2%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* x y) -1e+47)
(fma 0.0625 (* t z) (fma x y c))
(if (<= (* x y) 1e+117)
(fma 0.0625 (* t z) (fma a (* b -0.25) c))
(fma a (* b -0.25) (fma x y c)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -1e+47) {
tmp = fma(0.0625, (t * z), fma(x, y, c));
} else if ((x * y) <= 1e+117) {
tmp = fma(0.0625, (t * z), fma(a, (b * -0.25), c));
} else {
tmp = fma(a, (b * -0.25), fma(x, y, c));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -1e+47) tmp = fma(0.0625, Float64(t * z), fma(x, y, c)); elseif (Float64(x * y) <= 1e+117) tmp = fma(0.0625, Float64(t * z), fma(a, Float64(b * -0.25), c)); else tmp = fma(a, Float64(b * -0.25), fma(x, y, c)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+47], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+117], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1e47Initial program 91.6%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6487.8
Simplified87.8%
if -1e47 < (*.f64 x y) < 1.00000000000000005e117Initial program 99.0%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
+-commutativeN/A
metadata-evalN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6495.9
Simplified95.9%
if 1.00000000000000005e117 < (*.f64 x y) Initial program 97.1%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6491.7
Simplified91.7%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma a (* b -0.25) (fma x y c))))
(if (<= (* a b) -1e+190)
t_1
(if (<= (* a b) 1e+59) (fma 0.0625 (* t z) (fma x y c)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = fma(a, (b * -0.25), fma(x, y, c));
double tmp;
if ((a * b) <= -1e+190) {
tmp = t_1;
} else if ((a * b) <= 1e+59) {
tmp = fma(0.0625, (t * z), fma(x, y, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(a, Float64(b * -0.25), fma(x, y, c)) tmp = 0.0 if (Float64(a * b) <= -1e+190) tmp = t_1; elseif (Float64(a * b) <= 1e+59) tmp = fma(0.0625, Float64(t * z), fma(x, y, c)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -1e+190], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1e+59], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+190}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.0000000000000001e190 or 9.99999999999999972e58 < (*.f64 a b) Initial program 93.2%
Taylor expanded in z around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6490.8
Simplified90.8%
if -1.0000000000000001e190 < (*.f64 a b) < 9.99999999999999972e58Initial program 99.4%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6493.4
Simplified93.4%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* a b) -1e+190)
(fma a (* b -0.25) c)
(if (<= (* a b) 1e+59)
(fma 0.0625 (* t z) (fma x y c))
(fma x y (* -0.25 (* a b))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((a * b) <= -1e+190) {
tmp = fma(a, (b * -0.25), c);
} else if ((a * b) <= 1e+59) {
tmp = fma(0.0625, (t * z), fma(x, y, c));
} else {
tmp = fma(x, y, (-0.25 * (a * b)));
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(a * b) <= -1e+190) tmp = fma(a, Float64(b * -0.25), c); elseif (Float64(a * b) <= 1e+59) tmp = fma(0.0625, Float64(t * z), fma(x, y, c)); else tmp = fma(x, y, Float64(-0.25 * Float64(a * b))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(a * b), $MachinePrecision], -1e+190], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+59], N[(0.0625 * N[(t * z), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(x * y + N[(-0.25 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+190}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+59}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, t \cdot z, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, -0.25 \cdot \left(a \cdot b\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1.0000000000000001e190Initial program 92.9%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64100.0
Simplified100.0%
Taylor expanded in c around inf
Simplified91.3%
if -1.0000000000000001e190 < (*.f64 a b) < 9.99999999999999972e58Initial program 99.4%
Taylor expanded in a around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6493.4
Simplified93.4%
if 9.99999999999999972e58 < (*.f64 a b) Initial program 93.3%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6495.1
Simplified95.1%
Taylor expanded in a around 0
associate-+r+N/A
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6493.3
Simplified93.3%
Taylor expanded in a around inf
*-lowering-*.f64N/A
*-lowering-*.f6477.1
Simplified77.1%
(FPCore (x y z t a b c) :precision binary64 (if (<= (* x y) -1e+38) (fma y x c) (if (<= (* x y) 2e+105) (fma a (* b -0.25) c) (fma y x c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -1e+38) {
tmp = fma(y, x, c);
} else if ((x * y) <= 2e+105) {
tmp = fma(a, (b * -0.25), c);
} else {
tmp = fma(y, x, c);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -1e+38) tmp = fma(y, x, c); elseif (Float64(x * y) <= 2e+105) tmp = fma(a, Float64(b * -0.25), c); else tmp = fma(y, x, c); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+38], N[(y * x + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+105], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], N[(y * x + c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+105}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999977e37 or 1.9999999999999999e105 < (*.f64 x y) Initial program 94.2%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6478.5
Simplified78.5%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6478.5
Applied egg-rr78.5%
if -9.99999999999999977e37 < (*.f64 x y) < 1.9999999999999999e105Initial program 98.9%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6499.5
Simplified99.5%
Taylor expanded in c around inf
Simplified65.6%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* t (* 0.0625 z)))) (if (<= (* t z) -2e+159) t_1 (if (<= (* t z) 1e+129) (fma y x c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = t * (0.0625 * z);
double tmp;
if ((t * z) <= -2e+159) {
tmp = t_1;
} else if ((t * z) <= 1e+129) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(t * Float64(0.0625 * z)) tmp = 0.0 if (Float64(t * z) <= -2e+159) tmp = t_1; elseif (Float64(t * z) <= 1e+129) tmp = fma(y, x, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(t * N[(0.0625 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -2e+159], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 1e+129], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(0.0625 \cdot z\right)\\
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 10^{+129}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.9999999999999999e159 or 1e129 < (*.f64 z t) Initial program 92.7%
Taylor expanded in z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6477.9
Simplified77.9%
+-rgt-identityN/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6479.1
Applied egg-rr79.1%
if -1.9999999999999999e159 < (*.f64 z t) < 1e129Initial program 98.9%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6460.0
Simplified60.0%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6460.0
Applied egg-rr60.0%
Final simplification65.0%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* a (* b -0.25)))) (if (<= (* a b) -4e+187) t_1 (if (<= (* a b) 1e+67) (fma y x c) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = a * (b * -0.25);
double tmp;
if ((a * b) <= -4e+187) {
tmp = t_1;
} else if ((a * b) <= 1e+67) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(a * Float64(b * -0.25)) tmp = 0.0 if (Float64(a * b) <= -4e+187) tmp = t_1; elseif (Float64(a * b) <= 1e+67) tmp = fma(y, x, c); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -4e+187], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1e+67], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(b \cdot -0.25\right)\\
\mathbf{if}\;a \cdot b \leq -4 \cdot 10^{+187}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 10^{+67}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -3.99999999999999963e187 or 9.99999999999999983e66 < (*.f64 a b) Initial program 94.3%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6469.2
Simplified69.2%
if -3.99999999999999963e187 < (*.f64 a b) < 9.99999999999999983e66Initial program 98.8%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6460.9
Simplified60.9%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6460.9
Applied egg-rr60.9%
(FPCore (x y z t a b c) :precision binary64 (if (<= (* x y) -4e+58) (* x y) (if (<= (* x y) 1e+116) c (* x y))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -4e+58) {
tmp = x * y;
} else if ((x * y) <= 1e+116) {
tmp = c;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((x * y) <= (-4d+58)) then
tmp = x * y
else if ((x * y) <= 1d+116) then
tmp = c
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -4e+58) {
tmp = x * y;
} else if ((x * y) <= 1e+116) {
tmp = c;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (x * y) <= -4e+58: tmp = x * y elif (x * y) <= 1e+116: tmp = c else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -4e+58) tmp = Float64(x * y); elseif (Float64(x * y) <= 1e+116) tmp = c; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((x * y) <= -4e+58) tmp = x * y; elseif ((x * y) <= 1e+116) tmp = c; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -4e+58], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+116], c, N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -4 \cdot 10^{+58}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 10^{+116}:\\
\;\;\;\;c\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -3.99999999999999978e58 or 1.00000000000000002e116 < (*.f64 x y) Initial program 93.7%
Taylor expanded in x around 0
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6496.3
Simplified96.3%
Taylor expanded in x around inf
*-lowering-*.f6468.5
Simplified68.5%
if -3.99999999999999978e58 < (*.f64 x y) < 1.00000000000000002e116Initial program 99.0%
Taylor expanded in c around inf
Simplified33.0%
(FPCore (x y z t a b c) :precision binary64 (fma y x c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(y, x, c);
}
function code(x, y, z, t, a, b, c) return fma(y, x, c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(y * x + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, x, c\right)
\end{array}
Initial program 97.3%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6449.1
Simplified49.1%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6449.1
Applied egg-rr49.1%
(FPCore (x y z t a b c) :precision binary64 c)
double code(double x, double y, double z, double t, double a, double b, double c) {
return c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c;
}
def code(x, y, z, t, a, b, c): return c
function code(x, y, z, t, a, b, c) return c end
function tmp = code(x, y, z, t, a, b, c) tmp = c; end
code[x_, y_, z_, t_, a_, b_, c_] := c
\begin{array}{l}
\\
c
\end{array}
Initial program 97.3%
Taylor expanded in c around inf
Simplified26.5%
herbie shell --seed 2024195
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, C"
:precision binary64
(+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))