
(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 (if (<= (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) INFINITY) (fma (* t 0.0625) z (- (* x y) (fma a (* b 0.25) (- 0.0 c)))) (* 0.0625 (* z t))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= ((double) INFINITY)) {
tmp = fma((t * 0.0625), z, ((x * y) - fma(a, (b * 0.25), (0.0 - c))));
} else {
tmp = 0.0625 * (z * t);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) <= Inf) tmp = fma(Float64(t * 0.0625), z, Float64(Float64(x * y) - fma(a, Float64(b * 0.25), Float64(0.0 - c)))); else tmp = Float64(0.0625 * Float64(z * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(t * 0.0625), $MachinePrecision] * z + N[(N[(x * y), $MachinePrecision] - N[(a * N[(b * 0.25), $MachinePrecision] + N[(0.0 - c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4} \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 0.0625, z, x \cdot y - \mathsf{fma}\left(a, b \cdot 0.25, 0 - c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.0625 \cdot \left(z \cdot t\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%
associate-+l-N/A
+-commutativeN/A
associate--l+N/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sub-negN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
neg-lowering-neg.f64100.0%
Applied egg-rr100.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 z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6457.6%
Simplified57.6%
+-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6457.6%
Applied egg-rr57.6%
Final simplification98.8%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* x y) -100.0)
(fma y x c)
(if (<= (* x y) 1e-230)
(fma (* t 0.0625) z c)
(if (<= (* x y) 1e+151) (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) <= -100.0) {
tmp = fma(y, x, c);
} else if ((x * y) <= 1e-230) {
tmp = fma((t * 0.0625), z, c);
} else if ((x * y) <= 1e+151) {
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) <= -100.0) tmp = fma(y, x, c); elseif (Float64(x * y) <= 1e-230) tmp = fma(Float64(t * 0.0625), z, c); elseif (Float64(x * y) <= 1e+151) 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], -100.0], N[(y * x + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-230], N[(N[(t * 0.0625), $MachinePrecision] * z + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+151], 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 -100:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{-230}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 0.0625, z, c\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+151}:\\
\;\;\;\;\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) < -100 or 1.00000000000000002e151 < (*.f64 x y) Initial program 95.3%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6471.7%
Simplified71.7%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6471.7%
Applied egg-rr71.7%
if -100 < (*.f64 x y) < 1.00000000000000005e-230Initial program 98.9%
Taylor expanded in z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6473.4%
Simplified73.4%
+-rgt-identityN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6473.4%
Applied egg-rr73.4%
if 1.00000000000000005e-230 < (*.f64 x y) < 1.00000000000000002e151Initial program 98.3%
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.f6480.7%
Simplified80.7%
Taylor expanded in x around 0
Simplified65.5%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* x y) -2e+146)
(fma 0.0625 (* z t) (fma x y c))
(if (<= (* x y) 1e-22)
(fma 0.0625 (* z t) (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) <= -2e+146) {
tmp = fma(0.0625, (z * t), fma(x, y, c));
} else if ((x * y) <= 1e-22) {
tmp = fma(0.0625, (z * t), 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) <= -2e+146) tmp = fma(0.0625, Float64(z * t), fma(x, y, c)); elseif (Float64(x * y) <= 1e-22) tmp = fma(0.0625, Float64(z * t), 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], -2e+146], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-22], N[(0.0625 * N[(z * t), $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 -2 \cdot 10^{+146}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{-22}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, \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) < -1.99999999999999987e146Initial program 90.0%
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.3%
Simplified93.3%
if -1.99999999999999987e146 < (*.f64 x y) < 1e-22Initial program 98.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-*.f6490.5%
Simplified90.5%
if 1e-22 < (*.f64 x y) Initial program 97.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.f6489.8%
Simplified89.8%
Final simplification90.6%
(FPCore (x y z t a b c) :precision binary64 (if (<= (* x y) -0.0002) (fma (* t 0.0625) z (* x y)) (if (<= (* x y) 1e-65) (fma (* t 0.0625) z 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) <= -0.0002) {
tmp = fma((t * 0.0625), z, (x * y));
} else if ((x * y) <= 1e-65) {
tmp = fma((t * 0.0625), z, 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) <= -0.0002) tmp = fma(Float64(t * 0.0625), z, Float64(x * y)); elseif (Float64(x * y) <= 1e-65) tmp = fma(Float64(t * 0.0625), z, 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], -0.0002], N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-65], N[(N[(t * 0.0625), $MachinePrecision] * z + 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 -0.0002:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 0.0625, z, x \cdot y\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{-65}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 0.0625, z, c\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e-4Initial program 95.2%
associate-+l-N/A
+-commutativeN/A
associate--l+N/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sub-negN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
neg-lowering-neg.f6495.2%
Applied egg-rr95.2%
Taylor expanded in x around inf
*-lowering-*.f6470.3%
Simplified70.3%
if -2.0000000000000001e-4 < (*.f64 x y) < 9.99999999999999923e-66Initial program 98.2%
Taylor expanded in z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6471.1%
Simplified71.1%
+-rgt-identityN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6471.1%
Applied egg-rr71.1%
if 9.99999999999999923e-66 < (*.f64 x y) Initial program 97.6%
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.f6489.2%
Simplified89.2%
Taylor expanded in x around inf
*-lowering-*.f6477.8%
Simplified77.8%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma a (* b -0.25) (* x y))))
(if (<= (* x y) -100.0)
t_1
(if (<= (* x y) 1e-65) (fma (* t 0.0625) z 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), (x * y));
double tmp;
if ((x * y) <= -100.0) {
tmp = t_1;
} else if ((x * y) <= 1e-65) {
tmp = fma((t * 0.0625), z, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(a, Float64(b * -0.25), Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -100.0) tmp = t_1; elseif (Float64(x * y) <= 1e-65) tmp = fma(Float64(t * 0.0625), z, 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), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -100.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e-65], N[(N[(t * 0.0625), $MachinePrecision] * z + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b \cdot -0.25, x \cdot y\right)\\
\mathbf{if}\;x \cdot y \leq -100:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{-65}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot 0.0625, z, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -100 or 9.99999999999999923e-66 < (*.f64 x y) Initial program 96.6%
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.f6484.4%
Simplified84.4%
Taylor expanded in x around inf
*-lowering-*.f6473.7%
Simplified73.7%
if -100 < (*.f64 x y) < 9.99999999999999923e-66Initial program 98.2%
Taylor expanded in z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6471.1%
Simplified71.1%
+-rgt-identityN/A
associate-*r*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6471.1%
Applied egg-rr71.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma 0.0625 (* z t) (fma x y c))))
(if (<= t -1.26e-7)
t_1
(if (<= t 1.45e+123) (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(x, y, c));
double tmp;
if (t <= -1.26e-7) {
tmp = t_1;
} else if (t <= 1.45e+123) {
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(x, y, c)) tmp = 0.0 if (t <= -1.26e-7) tmp = t_1; elseif (t <= 1.45e+123) 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[(x * y + c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.26e-7], t$95$1, If[LessEqual[t, 1.45e+123], 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(x, y, c\right)\right)\\
\mathbf{if}\;t \leq -1.26 \cdot 10^{-7}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+123}:\\
\;\;\;\;\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 t < -1.2599999999999999e-7 or 1.45000000000000005e123 < t Initial program 95.0%
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.f6481.5%
Simplified81.5%
if -1.2599999999999999e-7 < t < 1.45000000000000005e123Initial program 98.7%
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.f6488.5%
Simplified88.5%
Final simplification85.7%
(FPCore (x y z t a b c)
:precision binary64
(if (<= a -2.6e+121)
(fma a (* b -0.25) c)
(if (<= a 1.05e+31)
(fma 0.0625 (* z t) (fma x y 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 (a <= -2.6e+121) {
tmp = fma(a, (b * -0.25), c);
} else if (a <= 1.05e+31) {
tmp = fma(0.0625, (z * t), fma(x, y, 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 (a <= -2.6e+121) tmp = fma(a, Float64(b * -0.25), c); elseif (a <= 1.05e+31) tmp = fma(0.0625, Float64(z * t), fma(x, y, 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[a, -2.6e+121], N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision], If[LessEqual[a, 1.05e+31], N[(0.0625 * N[(z * t), $MachinePrecision] + N[(x * y + c), $MachinePrecision]), $MachinePrecision], N[(a * N[(b * -0.25), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{+121}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{fma}\left(0.0625, z \cdot t, \mathsf{fma}\left(x, y, c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b \cdot -0.25, x \cdot y\right)\\
\end{array}
\end{array}
if a < -2.5999999999999999e121Initial program 93.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.f6480.1%
Simplified80.1%
Taylor expanded in x around 0
Simplified73.2%
if -2.5999999999999999e121 < a < 1.04999999999999989e31Initial program 97.5%
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.f6486.7%
Simplified86.7%
if 1.04999999999999989e31 < a Initial program 98.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.f6478.5%
Simplified78.5%
Taylor expanded in x around inf
*-lowering-*.f6467.2%
Simplified67.2%
Final simplification80.3%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (fma a (* b -0.25) c))) (if (<= a -6.5e+121) t_1 (if (<= a 1.72e+43) (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(a, (b * -0.25), c);
double tmp;
if (a <= -6.5e+121) {
tmp = t_1;
} else if (a <= 1.72e+43) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = fma(a, Float64(b * -0.25), c) tmp = 0.0 if (a <= -6.5e+121) tmp = t_1; elseif (a <= 1.72e+43) 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] + c), $MachinePrecision]}, If[LessEqual[a, -6.5e+121], t$95$1, If[LessEqual[a, 1.72e+43], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b \cdot -0.25, c\right)\\
\mathbf{if}\;a \leq -6.5 \cdot 10^{+121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.72 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -6.50000000000000019e121 or 1.7199999999999999e43 < a Initial program 97.8%
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.f6479.4%
Simplified79.4%
Taylor expanded in x around 0
Simplified57.7%
if -6.50000000000000019e121 < a < 1.7199999999999999e43Initial program 97.0%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6460.2%
Simplified60.2%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6460.2%
Applied egg-rr60.2%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* 0.0625 (* z t)))) (if (<= t -57000000000.0) t_1 (if (<= t 1.05e+150) (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 = 0.0625 * (z * t);
double tmp;
if (t <= -57000000000.0) {
tmp = t_1;
} else if (t <= 1.05e+150) {
tmp = fma(y, x, c);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(0.0625 * Float64(z * t)) tmp = 0.0 if (t <= -57000000000.0) tmp = t_1; elseif (t <= 1.05e+150) 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]), $MachinePrecision]}, If[LessEqual[t, -57000000000.0], t$95$1, If[LessEqual[t, 1.05e+150], N[(y * x + c), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;t \leq -57000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+150}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.7e10 or 1.04999999999999999e150 < t Initial program 94.5%
Taylor expanded in z around inf
+-rgt-identityN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6451.6%
Simplified51.6%
+-rgt-identityN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6451.6%
Applied egg-rr51.6%
if -5.7e10 < t < 1.04999999999999999e150Initial program 98.8%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6461.4%
Simplified61.4%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6461.4%
Applied egg-rr61.4%
Final simplification57.9%
(FPCore (x y z t a b c) :precision binary64 (let* ((t_1 (* a (* b -0.25)))) (if (<= a -2.15e+175) t_1 (if (<= a 4.8e+77) (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 <= -2.15e+175) {
tmp = t_1;
} else if (a <= 4.8e+77) {
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 (a <= -2.15e+175) tmp = t_1; elseif (a <= 4.8e+77) 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[a, -2.15e+175], t$95$1, If[LessEqual[a, 4.8e+77], 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 \leq -2.15 \cdot 10^{+175}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 4.8 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.14999999999999992e175 or 4.7999999999999997e77 < a Initial program 98.6%
Taylor expanded in a around inf
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6449.6%
Simplified49.6%
if -2.14999999999999992e175 < a < 4.7999999999999997e77Initial program 96.8%
Taylor expanded in x around inf
+-rgt-identityN/A
accelerator-lowering-fma.f6459.1%
Simplified59.1%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6459.1%
Applied egg-rr59.1%
(FPCore (x y z t a b c) :precision binary64 (if (<= c -7.6e+135) c (if (<= c 0.00106) (* x y) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (c <= -7.6e+135) {
tmp = c;
} else if (c <= 0.00106) {
tmp = x * y;
} else {
tmp = c;
}
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 (c <= (-7.6d+135)) then
tmp = c
else if (c <= 0.00106d0) then
tmp = x * y
else
tmp = c
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 (c <= -7.6e+135) {
tmp = c;
} else if (c <= 0.00106) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if c <= -7.6e+135: tmp = c elif c <= 0.00106: tmp = x * y else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (c <= -7.6e+135) tmp = c; elseif (c <= 0.00106) tmp = Float64(x * y); else tmp = c; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (c <= -7.6e+135) tmp = c; elseif (c <= 0.00106) tmp = x * y; else tmp = c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[c, -7.6e+135], c, If[LessEqual[c, 0.00106], N[(x * y), $MachinePrecision], c]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -7.6 \cdot 10^{+135}:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq 0.00106:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if c < -7.6000000000000003e135 or 0.00105999999999999996 < c Initial program 97.8%
Taylor expanded in c around inf
Simplified50.9%
if -7.6000000000000003e135 < c < 0.00105999999999999996Initial program 96.9%
associate-+l-N/A
+-commutativeN/A
associate--l+N/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
sub-negN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
div-invN/A
*-lowering-*.f64N/A
metadata-evalN/A
neg-lowering-neg.f6496.9%
Applied egg-rr96.9%
Taylor expanded in x around inf
*-lowering-*.f6441.3%
Simplified41.3%
(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.f6452.0%
Simplified52.0%
+-rgt-identityN/A
*-commutativeN/A
accelerator-lowering-fma.f6452.0%
Applied egg-rr52.0%
(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
Simplified21.4%
herbie shell --seed 2024193
(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))