
(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 (* t 0.0625) z (* x y)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (fma((t * 0.0625), z, (x * y)) - ((a * b) / 4.0)) + c;
}
function code(x, y, z, t, a, b, c) return Float64(Float64(fma(Float64(t * 0.0625), z, Float64(x * y)) - Float64(Float64(a * b) / 4.0)) + c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(t * 0.0625), $MachinePrecision] * z + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(t \cdot 0.0625, z, x \cdot y\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
Initial program 98.4%
+-commutative98.4%
associate-*r/98.4%
*-commutative98.4%
fma-define98.8%
div-inv98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (x y z t a b c) :precision binary64 (+ c (- (fma x y (* z (/ t 16.0))) (* a (/ b 4.0)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (fma(x, y, (z * (t / 16.0))) - (a * (b / 4.0)));
}
function code(x, y, z, t, a, b, c) return Float64(c + Float64(fma(x, y, Float64(z * Float64(t / 16.0))) - Float64(a * Float64(b / 4.0)))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(N[(x * y + N[(z * N[(t / 16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + \left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right)
\end{array}
Initial program 98.4%
associate-+l-98.4%
*-commutative98.4%
associate-+l-98.4%
fma-define98.4%
*-commutative98.4%
associate-/l*98.4%
associate-/l*98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* x y) -1.88e+102)
(+ (* x y) c)
(if (<= (* x y) 3600000.0)
(+ c (* z (* t 0.0625)))
(if (<= (* x y) 1.08e+86)
(+ c (* a (* b -0.25)))
(+ (* x y) (* 0.0625 (* t z)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -1.88e+102) {
tmp = (x * y) + c;
} else if ((x * y) <= 3600000.0) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 1.08e+86) {
tmp = c + (a * (b * -0.25));
} else {
tmp = (x * y) + (0.0625 * (t * z));
}
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) <= (-1.88d+102)) then
tmp = (x * y) + c
else if ((x * y) <= 3600000.0d0) then
tmp = c + (z * (t * 0.0625d0))
else if ((x * y) <= 1.08d+86) then
tmp = c + (a * (b * (-0.25d0)))
else
tmp = (x * y) + (0.0625d0 * (t * z))
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) <= -1.88e+102) {
tmp = (x * y) + c;
} else if ((x * y) <= 3600000.0) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 1.08e+86) {
tmp = c + (a * (b * -0.25));
} else {
tmp = (x * y) + (0.0625 * (t * z));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (x * y) <= -1.88e+102: tmp = (x * y) + c elif (x * y) <= 3600000.0: tmp = c + (z * (t * 0.0625)) elif (x * y) <= 1.08e+86: tmp = c + (a * (b * -0.25)) else: tmp = (x * y) + (0.0625 * (t * z)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -1.88e+102) tmp = Float64(Float64(x * y) + c); elseif (Float64(x * y) <= 3600000.0) tmp = Float64(c + Float64(z * Float64(t * 0.0625))); elseif (Float64(x * y) <= 1.08e+86) tmp = Float64(c + Float64(a * Float64(b * -0.25))); else tmp = Float64(Float64(x * y) + Float64(0.0625 * Float64(t * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((x * y) <= -1.88e+102) tmp = (x * y) + c; elseif ((x * y) <= 3600000.0) tmp = c + (z * (t * 0.0625)); elseif ((x * y) <= 1.08e+86) tmp = c + (a * (b * -0.25)); else tmp = (x * y) + (0.0625 * (t * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(x * y), $MachinePrecision], -1.88e+102], N[(N[(x * y), $MachinePrecision] + c), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3600000.0], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.08e+86], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.88 \cdot 10^{+102}:\\
\;\;\;\;x \cdot y + c\\
\mathbf{elif}\;x \cdot y \leq 3600000:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{elif}\;x \cdot y \leq 1.08 \cdot 10^{+86}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + 0.0625 \cdot \left(t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.87999999999999988e102Initial program 100.0%
Taylor expanded in x around inf 87.5%
if -1.87999999999999988e102 < (*.f64 x y) < 3.6e6Initial program 100.0%
Taylor expanded in z around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-*r*66.4%
*-commutative66.4%
Simplified66.4%
if 3.6e6 < (*.f64 x y) < 1.07999999999999993e86Initial program 99.9%
Taylor expanded in a around inf 76.9%
*-commutative76.9%
associate-*r*76.9%
Simplified76.9%
if 1.07999999999999993e86 < (*.f64 x y) Initial program 92.5%
Taylor expanded in a around 0 88.8%
Taylor expanded in c around 0 81.6%
Final simplification74.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ (* x y) c)))
(if (<= (* x y) -2.55e+114)
t_1
(if (<= (* x y) 320000.0)
(+ c (* z (* t 0.0625)))
(if (<= (* x y) 1.15e+84) (+ c (* a (* b -0.25))) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (x * y) + c;
double tmp;
if ((x * y) <= -2.55e+114) {
tmp = t_1;
} else if ((x * y) <= 320000.0) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 1.15e+84) {
tmp = c + (a * (b * -0.25));
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = (x * y) + c
if ((x * y) <= (-2.55d+114)) then
tmp = t_1
else if ((x * y) <= 320000.0d0) then
tmp = c + (z * (t * 0.0625d0))
else if ((x * y) <= 1.15d+84) then
tmp = c + (a * (b * (-0.25d0)))
else
tmp = t_1
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 t_1 = (x * y) + c;
double tmp;
if ((x * y) <= -2.55e+114) {
tmp = t_1;
} else if ((x * y) <= 320000.0) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 1.15e+84) {
tmp = c + (a * (b * -0.25));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (x * y) + c tmp = 0 if (x * y) <= -2.55e+114: tmp = t_1 elif (x * y) <= 320000.0: tmp = c + (z * (t * 0.0625)) elif (x * y) <= 1.15e+84: tmp = c + (a * (b * -0.25)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(x * y) + c) tmp = 0.0 if (Float64(x * y) <= -2.55e+114) tmp = t_1; elseif (Float64(x * y) <= 320000.0) tmp = Float64(c + Float64(z * Float64(t * 0.0625))); elseif (Float64(x * y) <= 1.15e+84) tmp = Float64(c + Float64(a * Float64(b * -0.25))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (x * y) + c; tmp = 0.0; if ((x * y) <= -2.55e+114) tmp = t_1; elseif ((x * y) <= 320000.0) tmp = c + (z * (t * 0.0625)); elseif ((x * y) <= 1.15e+84) tmp = c + (a * (b * -0.25)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + c), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.55e+114], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 320000.0], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.15e+84], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + c\\
\mathbf{if}\;x \cdot y \leq -2.55 \cdot 10^{+114}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 320000:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{elif}\;x \cdot y \leq 1.15 \cdot 10^{+84}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -2.55e114 or 1.1499999999999999e84 < (*.f64 x y) Initial program 96.0%
Taylor expanded in x around inf 82.3%
if -2.55e114 < (*.f64 x y) < 3.2e5Initial program 100.0%
Taylor expanded in z around inf 66.4%
*-commutative66.4%
*-commutative66.4%
associate-*r*66.4%
*-commutative66.4%
Simplified66.4%
if 3.2e5 < (*.f64 x y) < 1.1499999999999999e84Initial program 99.9%
Taylor expanded in a around inf 76.9%
*-commutative76.9%
associate-*r*76.9%
Simplified76.9%
Final simplification73.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* 0.0625 (* t z))))
(if (or (<= (* x y) -3.2e+47) (not (<= (* x y) 9.8e+85)))
(+ c (+ (* x y) t_1))
(+ c (- t_1 (* (* a b) 0.25))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = 0.0625 * (t * z);
double tmp;
if (((x * y) <= -3.2e+47) || !((x * y) <= 9.8e+85)) {
tmp = c + ((x * y) + t_1);
} else {
tmp = c + (t_1 - ((a * b) * 0.25));
}
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) :: t_1
real(8) :: tmp
t_1 = 0.0625d0 * (t * z)
if (((x * y) <= (-3.2d+47)) .or. (.not. ((x * y) <= 9.8d+85))) then
tmp = c + ((x * y) + t_1)
else
tmp = c + (t_1 - ((a * b) * 0.25d0))
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 t_1 = 0.0625 * (t * z);
double tmp;
if (((x * y) <= -3.2e+47) || !((x * y) <= 9.8e+85)) {
tmp = c + ((x * y) + t_1);
} else {
tmp = c + (t_1 - ((a * b) * 0.25));
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = 0.0625 * (t * z) tmp = 0 if ((x * y) <= -3.2e+47) or not ((x * y) <= 9.8e+85): tmp = c + ((x * y) + t_1) else: tmp = c + (t_1 - ((a * b) * 0.25)) return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(0.0625 * Float64(t * z)) tmp = 0.0 if ((Float64(x * y) <= -3.2e+47) || !(Float64(x * y) <= 9.8e+85)) tmp = Float64(c + Float64(Float64(x * y) + t_1)); else tmp = Float64(c + Float64(t_1 - Float64(Float64(a * b) * 0.25))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = 0.0625 * (t * z); tmp = 0.0; if (((x * y) <= -3.2e+47) || ~(((x * y) <= 9.8e+85))) tmp = c + ((x * y) + t_1); else tmp = c + (t_1 - ((a * b) * 0.25)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(x * y), $MachinePrecision], -3.2e+47], N[Not[LessEqual[N[(x * y), $MachinePrecision], 9.8e+85]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(c + N[(t$95$1 - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(t \cdot z\right)\\
\mathbf{if}\;x \cdot y \leq -3.2 \cdot 10^{+47} \lor \neg \left(x \cdot y \leq 9.8 \cdot 10^{+85}\right):\\
\;\;\;\;c + \left(x \cdot y + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(t\_1 - \left(a \cdot b\right) \cdot 0.25\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -3.2e47 or 9.7999999999999993e85 < (*.f64 x y) Initial program 96.1%
Taylor expanded in a around 0 90.5%
if -3.2e47 < (*.f64 x y) < 9.7999999999999993e85Initial program 100.0%
Taylor expanded in x around 0 96.8%
Final simplification94.3%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -5e+79) (not (<= (* a b) 1.0))) (+ c (- (* x y) (* (* a b) 0.25))) (+ c (+ (* x y) (* 0.0625 (* t z))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((a * b) <= -5e+79) || !((a * b) <= 1.0)) {
tmp = c + ((x * y) - ((a * b) * 0.25));
} else {
tmp = c + ((x * y) + (0.0625 * (t * z)));
}
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 (((a * b) <= (-5d+79)) .or. (.not. ((a * b) <= 1.0d0))) then
tmp = c + ((x * y) - ((a * b) * 0.25d0))
else
tmp = c + ((x * y) + (0.0625d0 * (t * z)))
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 (((a * b) <= -5e+79) || !((a * b) <= 1.0)) {
tmp = c + ((x * y) - ((a * b) * 0.25));
} else {
tmp = c + ((x * y) + (0.0625 * (t * z)));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((a * b) <= -5e+79) or not ((a * b) <= 1.0): tmp = c + ((x * y) - ((a * b) * 0.25)) else: tmp = c + ((x * y) + (0.0625 * (t * z))) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(a * b) <= -5e+79) || !(Float64(a * b) <= 1.0)) tmp = Float64(c + Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25))); else tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(t * z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((a * b) <= -5e+79) || ~(((a * b) <= 1.0))) tmp = c + ((x * y) - ((a * b) * 0.25)); else tmp = c + ((x * y) + (0.0625 * (t * z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -5e+79], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.0]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+79} \lor \neg \left(a \cdot b \leq 1\right):\\
\;\;\;\;c + \left(x \cdot y - \left(a \cdot b\right) \cdot 0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(t \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -5e79 or 1 < (*.f64 a b) Initial program 97.3%
Taylor expanded in z around 0 84.5%
if -5e79 < (*.f64 a b) < 1Initial program 99.3%
Taylor expanded in a around 0 97.4%
Final simplification91.8%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* a b) -2e+132)
(+ c (* a (* b -0.25)))
(if (<= (* a b) 1e+262)
(+ c (+ (* x y) (* 0.0625 (* t z))))
(* b (* a -0.25)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((a * b) <= -2e+132) {
tmp = c + (a * (b * -0.25));
} else if ((a * b) <= 1e+262) {
tmp = c + ((x * y) + (0.0625 * (t * z)));
} else {
tmp = b * (a * -0.25);
}
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 ((a * b) <= (-2d+132)) then
tmp = c + (a * (b * (-0.25d0)))
else if ((a * b) <= 1d+262) then
tmp = c + ((x * y) + (0.0625d0 * (t * z)))
else
tmp = b * (a * (-0.25d0))
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 ((a * b) <= -2e+132) {
tmp = c + (a * (b * -0.25));
} else if ((a * b) <= 1e+262) {
tmp = c + ((x * y) + (0.0625 * (t * z)));
} else {
tmp = b * (a * -0.25);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (a * b) <= -2e+132: tmp = c + (a * (b * -0.25)) elif (a * b) <= 1e+262: tmp = c + ((x * y) + (0.0625 * (t * z))) else: tmp = b * (a * -0.25) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(a * b) <= -2e+132) tmp = Float64(c + Float64(a * Float64(b * -0.25))); elseif (Float64(a * b) <= 1e+262) tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(t * z)))); else tmp = Float64(b * Float64(a * -0.25)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((a * b) <= -2e+132) tmp = c + (a * (b * -0.25)); elseif ((a * b) <= 1e+262) tmp = c + ((x * y) + (0.0625 * (t * z))); else tmp = b * (a * -0.25); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(a * b), $MachinePrecision], -2e+132], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+262], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+132}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{elif}\;a \cdot b \leq 10^{+262}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot -0.25\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1.99999999999999998e132Initial program 97.3%
Taylor expanded in a around inf 73.7%
*-commutative73.7%
associate-*r*73.7%
Simplified73.7%
if -1.99999999999999998e132 < (*.f64 a b) < 1e262Initial program 99.5%
Taylor expanded in a around 0 90.1%
if 1e262 < (*.f64 a b) Initial program 88.9%
Taylor expanded in z around 0 88.9%
Taylor expanded in x around 0 94.4%
metadata-eval94.4%
associate-/r/94.4%
Applied egg-rr94.4%
Taylor expanded in c around 0 94.4%
associate-*r*94.4%
Simplified94.4%
Final simplification88.1%
(FPCore (x y z t a b c)
:precision binary64
(if (<= (* x y) -1.4e+106)
(* x y)
(if (<= (* x y) 7.6e-13)
(* t (* 0.0625 z))
(if (<= (* x y) 2.95e+84) c (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((x * y) <= -1.4e+106) {
tmp = x * y;
} else if ((x * y) <= 7.6e-13) {
tmp = t * (0.0625 * z);
} else if ((x * y) <= 2.95e+84) {
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) <= (-1.4d+106)) then
tmp = x * y
else if ((x * y) <= 7.6d-13) then
tmp = t * (0.0625d0 * z)
else if ((x * y) <= 2.95d+84) 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) <= -1.4e+106) {
tmp = x * y;
} else if ((x * y) <= 7.6e-13) {
tmp = t * (0.0625 * z);
} else if ((x * y) <= 2.95e+84) {
tmp = c;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (x * y) <= -1.4e+106: tmp = x * y elif (x * y) <= 7.6e-13: tmp = t * (0.0625 * z) elif (x * y) <= 2.95e+84: tmp = c else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(x * y) <= -1.4e+106) tmp = Float64(x * y); elseif (Float64(x * y) <= 7.6e-13) tmp = Float64(t * Float64(0.0625 * z)); elseif (Float64(x * y) <= 2.95e+84) 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) <= -1.4e+106) tmp = x * y; elseif ((x * y) <= 7.6e-13) tmp = t * (0.0625 * z); elseif ((x * y) <= 2.95e+84) 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], -1.4e+106], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 7.6e-13], N[(t * N[(0.0625 * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.95e+84], c, N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.4 \cdot 10^{+106}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 7.6 \cdot 10^{-13}:\\
\;\;\;\;t \cdot \left(0.0625 \cdot z\right)\\
\mathbf{elif}\;x \cdot y \leq 2.95 \cdot 10^{+84}:\\
\;\;\;\;c\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -1.39999999999999996e106 or 2.94999999999999992e84 < (*.f64 x y) Initial program 96.0%
Taylor expanded in a around 0 91.1%
associate-*r*91.1%
fma-define92.1%
Applied egg-rr92.1%
Taylor expanded in x around inf 72.8%
if -1.39999999999999996e106 < (*.f64 x y) < 7.5999999999999999e-13Initial program 100.0%
Taylor expanded in a around 0 67.5%
associate-*r*67.5%
fma-define67.5%
Applied egg-rr67.5%
Taylor expanded in t around inf 39.6%
*-commutative39.6%
associate-*l*39.6%
Simplified39.6%
if 7.5999999999999999e-13 < (*.f64 x y) < 2.94999999999999992e84Initial program 99.9%
Taylor expanded in x around inf 51.9%
Taylor expanded in x around 0 41.6%
Final simplification52.6%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -2.1e+103) (not (<= (* x y) 1.72e+84))) (+ (* x y) c) (+ c (* a (* b -0.25)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -2.1e+103) || !((x * y) <= 1.72e+84)) {
tmp = (x * y) + c;
} else {
tmp = c + (a * (b * -0.25));
}
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) <= (-2.1d+103)) .or. (.not. ((x * y) <= 1.72d+84))) then
tmp = (x * y) + c
else
tmp = c + (a * (b * (-0.25d0)))
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) <= -2.1e+103) || !((x * y) <= 1.72e+84)) {
tmp = (x * y) + c;
} else {
tmp = c + (a * (b * -0.25));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -2.1e+103) or not ((x * y) <= 1.72e+84): tmp = (x * y) + c else: tmp = c + (a * (b * -0.25)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -2.1e+103) || !(Float64(x * y) <= 1.72e+84)) tmp = Float64(Float64(x * y) + c); else tmp = Float64(c + Float64(a * Float64(b * -0.25))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((x * y) <= -2.1e+103) || ~(((x * y) <= 1.72e+84))) tmp = (x * y) + c; else tmp = c + (a * (b * -0.25)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2.1e+103], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.72e+84]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + c), $MachinePrecision], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.1 \cdot 10^{+103} \lor \neg \left(x \cdot y \leq 1.72 \cdot 10^{+84}\right):\\
\;\;\;\;x \cdot y + c\\
\mathbf{else}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -2.1000000000000002e103 or 1.72e84 < (*.f64 x y) Initial program 96.0%
Taylor expanded in x around inf 82.3%
if -2.1000000000000002e103 < (*.f64 x y) < 1.72e84Initial program 100.0%
Taylor expanded in a around inf 62.1%
*-commutative62.1%
associate-*r*62.1%
Simplified62.1%
Final simplification70.0%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -1.75e+39) (not (<= (* x y) 6.2e+83))) (* x y) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -1.75e+39) || !((x * y) <= 6.2e+83)) {
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 (((x * y) <= (-1.75d+39)) .or. (.not. ((x * y) <= 6.2d+83))) 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 (((x * y) <= -1.75e+39) || !((x * y) <= 6.2e+83)) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -1.75e+39) or not ((x * y) <= 6.2e+83): tmp = x * y else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -1.75e+39) || !(Float64(x * y) <= 6.2e+83)) 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 (((x * y) <= -1.75e+39) || ~(((x * y) <= 6.2e+83))) tmp = x * y; else tmp = c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1.75e+39], N[Not[LessEqual[N[(x * y), $MachinePrecision], 6.2e+83]], $MachinePrecision]], N[(x * y), $MachinePrecision], c]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.75 \cdot 10^{+39} \lor \neg \left(x \cdot y \leq 6.2 \cdot 10^{+83}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if (*.f64 x y) < -1.7500000000000001e39 or 6.19999999999999984e83 < (*.f64 x y) Initial program 96.2%
Taylor expanded in a around 0 89.8%
associate-*r*89.8%
fma-define90.7%
Applied egg-rr90.7%
Taylor expanded in x around inf 69.7%
if -1.7500000000000001e39 < (*.f64 x y) < 6.19999999999999984e83Initial program 100.0%
Taylor expanded in x around inf 32.8%
Taylor expanded in x around 0 30.8%
Final simplification46.8%
(FPCore (x y z t a b c) :precision binary64 (+ c (- (+ (* x y) (/ (* t z) 16.0)) (/ (* a b) 4.0))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (((x * y) + ((t * z) / 16.0)) - ((a * b) / 4.0));
}
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 + (((x * y) + ((t * z) / 16.0d0)) - ((a * b) / 4.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (((x * y) + ((t * z) / 16.0)) - ((a * b) / 4.0));
}
def code(x, y, z, t, a, b, c): return c + (((x * y) + ((t * z) / 16.0)) - ((a * b) / 4.0))
function code(x, y, z, t, a, b, c) return Float64(c + Float64(Float64(Float64(x * y) + Float64(Float64(t * z) / 16.0)) - Float64(Float64(a * b) / 4.0))) end
function tmp = code(x, y, z, t, a, b, c) tmp = c + (((x * y) + ((t * z) / 16.0)) - ((a * b) / 4.0)); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(N[(N[(x * y), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + \left(\left(x \cdot y + \frac{t \cdot z}{16}\right) - \frac{a \cdot b}{4}\right)
\end{array}
Initial program 98.4%
Final simplification98.4%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= t -3e-6) (not (<= t 8e+193))) (* t (* 0.0625 z)) (+ (* x y) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((t <= -3e-6) || !(t <= 8e+193)) {
tmp = t * (0.0625 * z);
} else {
tmp = (x * y) + 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 ((t <= (-3d-6)) .or. (.not. (t <= 8d+193))) then
tmp = t * (0.0625d0 * z)
else
tmp = (x * y) + 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 ((t <= -3e-6) || !(t <= 8e+193)) {
tmp = t * (0.0625 * z);
} else {
tmp = (x * y) + c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (t <= -3e-6) or not (t <= 8e+193): tmp = t * (0.0625 * z) else: tmp = (x * y) + c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((t <= -3e-6) || !(t <= 8e+193)) tmp = Float64(t * Float64(0.0625 * z)); else tmp = Float64(Float64(x * y) + c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((t <= -3e-6) || ~((t <= 8e+193))) tmp = t * (0.0625 * z); else tmp = (x * y) + c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[t, -3e-6], N[Not[LessEqual[t, 8e+193]], $MachinePrecision]], N[(t * N[(0.0625 * z), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{-6} \lor \neg \left(t \leq 8 \cdot 10^{+193}\right):\\
\;\;\;\;t \cdot \left(0.0625 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + c\\
\end{array}
\end{array}
if t < -3.0000000000000001e-6 or 8.00000000000000053e193 < t Initial program 97.6%
Taylor expanded in a around 0 78.6%
associate-*r*78.6%
fma-define78.6%
Applied egg-rr78.6%
Taylor expanded in t around inf 50.8%
*-commutative50.8%
associate-*l*50.8%
Simplified50.8%
if -3.0000000000000001e-6 < t < 8.00000000000000053e193Initial program 98.8%
Taylor expanded in x around inf 60.3%
Final simplification57.2%
(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 98.4%
Taylor expanded in x around inf 51.6%
Taylor expanded in x around 0 22.6%
Final simplification22.6%
herbie shell --seed 2024067
(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))