
(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 11 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 (let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)))) (if (<= t_1 INFINITY) (+ t_1 c) (fma 0.0625 (* z t) (* (* a b) -0.25)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1 + c;
} else {
tmp = fma(0.0625, (z * t), ((a * b) * -0.25));
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) tmp = 0.0 if (t_1 <= Inf) tmp = Float64(t_1 + c); else tmp = fma(0.0625, Float64(z * t), Float64(Float64(a * b) * -0.25)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(t$95$1 + c), $MachinePrecision], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1 + c\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, \left(a \cdot b\right) \cdot -0.25\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) < +inf.0Initial program 100.0%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) Initial program 0.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-*.f6457.1
Simplified57.1%
Taylor expanded in a around inf
*-lowering-*.f64N/A
*-lowering-*.f6457.1
Simplified57.1%
Final simplification98.8%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma 0.0625 (* z t) (fma a (* b -0.25) c))))
(if (<= (* z t) -1e+17)
t_1
(if (<= (* z t) 5e+115) (fma a (* b -0.25) (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(0.0625, (z * t), fma(a, (b * -0.25), c));
double tmp;
if ((z * t) <= -1e+17) {
tmp = t_1;
} else if ((z * t) <= 5e+115) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(0.0625, Float64(z * t), fma(a, Float64(b * -0.25), c)) tmp = 0.0 if (Float64(z * t) <= -1e+17) tmp = t_1; elseif (Float64(z * t) <= 5e+115) tmp = fma(a, Float64(b * -0.25), 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[(0.0625 * N[(z * t), $MachinePrecision] + N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+17], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+115], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(0.0625, z \cdot t, \mathsf{fma}\left(a, b \cdot -0.25, c\right)\right)\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1e17 or 5.00000000000000008e115 < (*.f64 z t) Initial program 93.8%
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-*.f6488.0
Simplified88.0%
if -1e17 < (*.f64 z t) < 5.00000000000000008e115Initial program 99.4%
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.f6496.9
Simplified96.9%
Final simplification93.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma 0.0625 (* z t) (* (* a b) -0.25))))
(if (<= (* z t) -2e+213)
t_1
(if (<= (* z t) 2e+117) (fma a (* b -0.25) (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(0.0625, (z * t), ((a * b) * -0.25));
double tmp;
if ((z * t) <= -2e+213) {
tmp = t_1;
} else if ((z * t) <= 2e+117) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(0.0625, Float64(z * t), Float64(Float64(a * b) * -0.25)) tmp = 0.0 if (Float64(z * t) <= -2e+213) tmp = t_1; elseif (Float64(z * t) <= 2e+117) tmp = fma(a, Float64(b * -0.25), 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[(0.0625 * N[(z * t), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+213], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e+117], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(0.0625, z \cdot t, \left(a \cdot b\right) \cdot -0.25\right)\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+213}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999997e213 or 2.0000000000000001e117 < (*.f64 z t) Initial program 92.6%
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-*.f6489.9
Simplified89.9%
Taylor expanded in a around inf
*-lowering-*.f64N/A
*-lowering-*.f6484.7
Simplified84.7%
if -1.99999999999999997e213 < (*.f64 z t) < 2.0000000000000001e117Initial program 98.9%
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.f6493.9
Simplified93.9%
Final simplification91.4%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma 0.0625 (* z t) c)))
(if (<= (* z t) -2e+239)
t_1
(if (<= (* z t) 5e+115) (fma a (* b -0.25) (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(0.0625, (z * t), c);
double tmp;
if ((z * t) <= -2e+239) {
tmp = t_1;
} else if ((z * t) <= 5e+115) {
tmp = fma(a, (b * -0.25), fma(x, y, c));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(0.0625, Float64(z * t), c) tmp = 0.0 if (Float64(z * t) <= -2e+239) tmp = t_1; elseif (Float64(z * t) <= 5e+115) tmp = fma(a, Float64(b * -0.25), 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[(0.0625 * N[(z * t), $MachinePrecision] + c), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+239], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+115], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(0.0625, z \cdot t, c\right)\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+239}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999998e239 or 5.00000000000000008e115 < (*.f64 z t) Initial program 92.3%
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-*.f6490.9
Simplified90.9%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6479.2
Simplified79.2%
if -1.99999999999999998e239 < (*.f64 z t) < 5.00000000000000008e115Initial program 98.9%
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.f6492.9
Simplified92.9%
Final simplification89.4%
(FPCore (x y z t a b c) :precision binary64 (if (<= (* x y) -1e+29) (fma y x c) (if (<= (* x y) 2e+66) (fma (* b -0.25) a 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+29) {
tmp = fma(y, x, c);
} else if ((x * y) <= 2e+66) {
tmp = fma((b * -0.25), a, 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+29) tmp = fma(y, x, c); elseif (Float64(x * y) <= 2e+66) tmp = fma(Float64(b * -0.25), a, 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+29], N[(y * x + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+66], N[(N[(b * -0.25), $MachinePrecision] * a + c), $MachinePrecision], N[(y * x + c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+66}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot -0.25, a, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999914e28 or 1.99999999999999989e66 < (*.f64 x y) Initial program 95.4%
Taylor expanded in x around inf
*-lowering-*.f6471.6
Simplified71.6%
*-commutativeN/A
accelerator-lowering-fma.f6471.6
Applied egg-rr71.6%
if -9.99999999999999914e28 < (*.f64 x y) < 1.99999999999999989e66Initial program 98.6%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6470.5
Simplified70.5%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6470.5
Applied egg-rr70.5%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma 0.0625 (* z t) c))) (if (<= (* z t) -1e+17) t_1 (if (<= (* z t) 5e+115) (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 = fma(0.0625, (z * t), c);
double tmp;
if ((z * t) <= -1e+17) {
tmp = t_1;
} else if ((z * t) <= 5e+115) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(0.0625, Float64(z * t), c) tmp = 0.0 if (Float64(z * t) <= -1e+17) tmp = t_1; elseif (Float64(z * t) <= 5e+115) 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[(0.0625 * N[(z * t), $MachinePrecision] + c), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -1e+17], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+115], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(0.0625, z \cdot t, c\right)\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+17}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1e17 or 5.00000000000000008e115 < (*.f64 z t) Initial program 93.8%
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-*.f6488.0
Simplified88.0%
Taylor expanded in a around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6469.3
Simplified69.3%
if -1e17 < (*.f64 z t) < 5.00000000000000008e115Initial program 99.4%
Taylor expanded in x around inf
*-lowering-*.f6469.2
Simplified69.2%
*-commutativeN/A
accelerator-lowering-fma.f6469.2
Applied egg-rr69.2%
Final simplification69.3%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* a (* b -0.25)))) (if (<= (* a b) -4e+130) t_1 (if (<= (* a b) 4e+233) (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+130) {
tmp = t_1;
} else if ((a * b) <= 4e+233) {
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+130) tmp = t_1; elseif (Float64(a * b) <= 4e+233) 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+130], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 4e+233], 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^{+130}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{+233}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -4.0000000000000002e130 or 3.99999999999999989e233 < (*.f64 a b) Initial program 92.2%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6476.4
Simplified76.4%
if -4.0000000000000002e130 < (*.f64 a b) < 3.99999999999999989e233Initial program 98.9%
Taylor expanded in x around inf
*-lowering-*.f6464.7
Simplified64.7%
*-commutativeN/A
accelerator-lowering-fma.f6464.7
Applied egg-rr64.7%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* (* z t) 0.0625))) (if (<= (* z t) -2e+213) t_1 (if (<= (* z t) 2e+117) (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 = (z * t) * 0.0625;
double tmp;
if ((z * t) <= -2e+213) {
tmp = t_1;
} else if ((z * t) <= 2e+117) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(z * t) * 0.0625) tmp = 0.0 if (Float64(z * t) <= -2e+213) tmp = t_1; elseif (Float64(z * t) <= 2e+117) 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[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+213], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e+117], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z \cdot t\right) \cdot 0.0625\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+213}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999997e213 or 2.0000000000000001e117 < (*.f64 z t) Initial program 92.6%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f6471.0
Simplified71.0%
if -1.99999999999999997e213 < (*.f64 z t) < 2.0000000000000001e117Initial program 98.9%
Taylor expanded in x around inf
*-lowering-*.f6465.7
Simplified65.7%
*-commutativeN/A
accelerator-lowering-fma.f6465.7
Applied egg-rr65.7%
Final simplification67.1%
(FPCore (x y z t a b c) :precision binary64 (if (<= (* x y) -8.2e+20) (* x y) (if (<= (* x y) 1.25e+111) c (* x y))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -8.2e+20) {
tmp = x * y;
} else if ((x * y) <= 1.25e+111) {
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) <= (-8.2d+20)) then
tmp = x * y
else if ((x * y) <= 1.25d+111) 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) <= -8.2e+20) {
tmp = x * y;
} else if ((x * y) <= 1.25e+111) {
tmp = c;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (x * y) <= -8.2e+20: tmp = x * y elif (x * y) <= 1.25e+111: tmp = c else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -8.2e+20) tmp = Float64(x * y); elseif (Float64(x * y) <= 1.25e+111) 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) <= -8.2e+20) tmp = x * y; elseif ((x * y) <= 1.25e+111) 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], -8.2e+20], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.25e+111], c, N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -8.2 \cdot 10^{+20}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 1.25 \cdot 10^{+111}:\\
\;\;\;\;c\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -8.2e20 or 1.2499999999999999e111 < (*.f64 x y) Initial program 95.2%
Taylor expanded in x around inf
*-lowering-*.f6461.8
Simplified61.8%
if -8.2e20 < (*.f64 x y) < 1.2499999999999999e111Initial program 98.7%
Taylor expanded in c around inf
Simplified33.4%
(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
*-lowering-*.f6452.1
Simplified52.1%
*-commutativeN/A
accelerator-lowering-fma.f6452.1
Applied egg-rr52.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
Simplified24.3%
herbie shell --seed 2024205
(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))