
(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 10 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 x y (fma 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 fma(x, y, fma(z, (t / 16.0), ((a * b) / -4.0))) + c;
}
function code(x, y, z, t, a, b, c) return Float64(fma(x, y, fma(z, Float64(t / 16.0), Float64(Float64(a * b) / -4.0))) + c) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(x * y + N[(z * N[(t / 16.0), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] / -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, \frac{t}{16}, \frac{a \cdot b}{-4}\right)\right) + c
\end{array}
Initial program 99.2%
associate--l+99.2%
fma-define99.6%
associate-/l*99.6%
fma-neg99.6%
distribute-neg-frac299.6%
metadata-eval99.6%
Simplified99.6%
(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 99.2%
associate-+l-99.2%
*-commutative99.2%
associate-+l-99.2%
fma-define99.6%
*-commutative99.6%
associate-/l*99.6%
associate-/l*99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* t (* z 0.0625)))) (t_2 (+ c (* x y))))
(if (<= (* x y) -3.7e+39)
t_2
(if (<= (* x y) 4.4e-209)
t_1
(if (<= (* x y) 1.58e-145)
(+ c (* a (/ b -4.0)))
(if (<= (* x y) 8.8e+71) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (t * (z * 0.0625));
double t_2 = c + (x * y);
double tmp;
if ((x * y) <= -3.7e+39) {
tmp = t_2;
} else if ((x * y) <= 4.4e-209) {
tmp = t_1;
} else if ((x * y) <= 1.58e-145) {
tmp = c + (a * (b / -4.0));
} else if ((x * y) <= 8.8e+71) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = c + (t * (z * 0.0625d0))
t_2 = c + (x * y)
if ((x * y) <= (-3.7d+39)) then
tmp = t_2
else if ((x * y) <= 4.4d-209) then
tmp = t_1
else if ((x * y) <= 1.58d-145) then
tmp = c + (a * (b / (-4.0d0)))
else if ((x * y) <= 8.8d+71) then
tmp = t_1
else
tmp = t_2
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 = c + (t * (z * 0.0625));
double t_2 = c + (x * y);
double tmp;
if ((x * y) <= -3.7e+39) {
tmp = t_2;
} else if ((x * y) <= 4.4e-209) {
tmp = t_1;
} else if ((x * y) <= 1.58e-145) {
tmp = c + (a * (b / -4.0));
} else if ((x * y) <= 8.8e+71) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = c + (t * (z * 0.0625)) t_2 = c + (x * y) tmp = 0 if (x * y) <= -3.7e+39: tmp = t_2 elif (x * y) <= 4.4e-209: tmp = t_1 elif (x * y) <= 1.58e-145: tmp = c + (a * (b / -4.0)) elif (x * y) <= 8.8e+71: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(t * Float64(z * 0.0625))) t_2 = Float64(c + Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -3.7e+39) tmp = t_2; elseif (Float64(x * y) <= 4.4e-209) tmp = t_1; elseif (Float64(x * y) <= 1.58e-145) tmp = Float64(c + Float64(a * Float64(b / -4.0))); elseif (Float64(x * y) <= 8.8e+71) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = c + (t * (z * 0.0625)); t_2 = c + (x * y); tmp = 0.0; if ((x * y) <= -3.7e+39) tmp = t_2; elseif ((x * y) <= 4.4e-209) tmp = t_1; elseif ((x * y) <= 1.58e-145) tmp = c + (a * (b / -4.0)); elseif ((x * y) <= 8.8e+71) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -3.7e+39], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 4.4e-209], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.58e-145], N[(c + N[(a * N[(b / -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 8.8e+71], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + t \cdot \left(z \cdot 0.0625\right)\\
t_2 := c + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -3.7 \cdot 10^{+39}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq 4.4 \cdot 10^{-209}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 1.58 \cdot 10^{-145}:\\
\;\;\;\;c + a \cdot \frac{b}{-4}\\
\mathbf{elif}\;x \cdot y \leq 8.8 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 x y) < -3.70000000000000012e39 or 8.79999999999999978e71 < (*.f64 x y) Initial program 98.1%
Taylor expanded in x around inf 87.3%
Taylor expanded in a around 0 78.3%
+-commutative78.3%
Simplified78.3%
if -3.70000000000000012e39 < (*.f64 x y) < 4.40000000000000019e-209 or 1.58000000000000003e-145 < (*.f64 x y) < 8.79999999999999978e71Initial program 100.0%
Taylor expanded in x around 0 97.3%
*-commutative97.3%
*-commutative97.3%
associate-*r*97.3%
*-commutative97.3%
Simplified97.3%
Taylor expanded in a around 0 73.0%
associate-*r*73.0%
*-commutative73.0%
associate-*r*73.0%
Simplified73.0%
if 4.40000000000000019e-209 < (*.f64 x y) < 1.58000000000000003e-145Initial program 100.0%
Taylor expanded in a around inf 81.8%
associate-*r*81.8%
metadata-eval81.8%
distribute-lft-neg-in81.8%
*-commutative81.8%
distribute-lft-neg-in81.8%
metadata-eval81.8%
associate-/l*81.8%
*-rgt-identity81.8%
associate-*l/81.8%
distribute-lft-neg-in81.8%
distribute-rgt-neg-out81.8%
metadata-eval81.8%
distribute-neg-frac281.8%
distribute-frac-neg81.8%
distribute-rgt-neg-out81.8%
remove-double-neg81.8%
associate-/l*81.8%
Simplified81.8%
Final simplification75.7%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (/ (* a b) 4.0)))
(if (<= (* x y) -3.8e+39)
(+ c (- (* x y) t_1))
(if (<= (* x y) 3e+39)
(+ c (- (* z (* t 0.0625)) t_1))
(+ c (+ (* x y) (* 0.0625 (* z t))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) / 4.0;
double tmp;
if ((x * y) <= -3.8e+39) {
tmp = c + ((x * y) - t_1);
} else if ((x * y) <= 3e+39) {
tmp = c + ((z * (t * 0.0625)) - t_1);
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
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 = (a * b) / 4.0d0
if ((x * y) <= (-3.8d+39)) then
tmp = c + ((x * y) - t_1)
else if ((x * y) <= 3d+39) then
tmp = c + ((z * (t * 0.0625d0)) - t_1)
else
tmp = c + ((x * y) + (0.0625d0 * (z * t)))
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 = (a * b) / 4.0;
double tmp;
if ((x * y) <= -3.8e+39) {
tmp = c + ((x * y) - t_1);
} else if ((x * y) <= 3e+39) {
tmp = c + ((z * (t * 0.0625)) - t_1);
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (a * b) / 4.0 tmp = 0 if (x * y) <= -3.8e+39: tmp = c + ((x * y) - t_1) elif (x * y) <= 3e+39: tmp = c + ((z * (t * 0.0625)) - t_1) else: tmp = c + ((x * y) + (0.0625 * (z * t))) return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) / 4.0) tmp = 0.0 if (Float64(x * y) <= -3.8e+39) tmp = Float64(c + Float64(Float64(x * y) - t_1)); elseif (Float64(x * y) <= 3e+39) tmp = Float64(c + Float64(Float64(z * Float64(t * 0.0625)) - t_1)); else tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (a * b) / 4.0; tmp = 0.0; if ((x * y) <= -3.8e+39) tmp = c + ((x * y) - t_1); elseif ((x * y) <= 3e+39) tmp = c + ((z * (t * 0.0625)) - t_1); else tmp = c + ((x * y) + (0.0625 * (z * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -3.8e+39], N[(c + N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3e+39], N[(c + N[(N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a \cdot b}{4}\\
\mathbf{if}\;x \cdot y \leq -3.8 \cdot 10^{+39}:\\
\;\;\;\;c + \left(x \cdot y - t\_1\right)\\
\mathbf{elif}\;x \cdot y \leq 3 \cdot 10^{+39}:\\
\;\;\;\;c + \left(z \cdot \left(t \cdot 0.0625\right) - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -3.7999999999999998e39Initial program 98.1%
Taylor expanded in x around inf 87.5%
if -3.7999999999999998e39 < (*.f64 x y) < 3e39Initial program 100.0%
Taylor expanded in x around 0 98.2%
*-commutative98.2%
*-commutative98.2%
associate-*r*98.2%
*-commutative98.2%
Simplified98.2%
if 3e39 < (*.f64 x y) Initial program 98.3%
Taylor expanded in t around inf 79.4%
Taylor expanded in a around 0 80.9%
Taylor expanded in t around 0 94.9%
Final simplification95.2%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -1e+126) (not (<= (* a b) 4e+62))) (+ c (- (* x y) (/ (* a b) 4.0))) (+ c (+ (* x y) (* 0.0625 (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((a * b) <= -1e+126) || !((a * b) <= 4e+62)) {
tmp = c + ((x * y) - ((a * b) / 4.0));
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
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) <= (-1d+126)) .or. (.not. ((a * b) <= 4d+62))) then
tmp = c + ((x * y) - ((a * b) / 4.0d0))
else
tmp = c + ((x * y) + (0.0625d0 * (z * t)))
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) <= -1e+126) || !((a * b) <= 4e+62)) {
tmp = c + ((x * y) - ((a * b) / 4.0));
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((a * b) <= -1e+126) or not ((a * b) <= 4e+62): tmp = c + ((x * y) - ((a * b) / 4.0)) else: tmp = c + ((x * y) + (0.0625 * (z * t))) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(a * b) <= -1e+126) || !(Float64(a * b) <= 4e+62)) tmp = Float64(c + Float64(Float64(x * y) - Float64(Float64(a * b) / 4.0))); else tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((a * b) <= -1e+126) || ~(((a * b) <= 4e+62))) tmp = c + ((x * y) - ((a * b) / 4.0)); else tmp = c + ((x * y) + (0.0625 * (z * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -1e+126], N[Not[LessEqual[N[(a * b), $MachinePrecision], 4e+62]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+126} \lor \neg \left(a \cdot b \leq 4 \cdot 10^{+62}\right):\\
\;\;\;\;c + \left(x \cdot y - \frac{a \cdot b}{4}\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -9.99999999999999925e125 or 4.00000000000000014e62 < (*.f64 a b) Initial program 97.5%
Taylor expanded in x around inf 86.2%
if -9.99999999999999925e125 < (*.f64 a b) < 4.00000000000000014e62Initial program 100.0%
Taylor expanded in t around inf 91.4%
Taylor expanded in a around 0 89.2%
Taylor expanded in t around 0 97.8%
Final simplification94.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= b -9.5e-72) (not (<= b 4.2e+245))) (+ c (* a (/ b -4.0))) (+ c (+ (* x y) (* 0.0625 (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((b <= -9.5e-72) || !(b <= 4.2e+245)) {
tmp = c + (a * (b / -4.0));
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
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 ((b <= (-9.5d-72)) .or. (.not. (b <= 4.2d+245))) then
tmp = c + (a * (b / (-4.0d0)))
else
tmp = c + ((x * y) + (0.0625d0 * (z * t)))
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 ((b <= -9.5e-72) || !(b <= 4.2e+245)) {
tmp = c + (a * (b / -4.0));
} else {
tmp = c + ((x * y) + (0.0625 * (z * t)));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (b <= -9.5e-72) or not (b <= 4.2e+245): tmp = c + (a * (b / -4.0)) else: tmp = c + ((x * y) + (0.0625 * (z * t))) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((b <= -9.5e-72) || !(b <= 4.2e+245)) tmp = Float64(c + Float64(a * Float64(b / -4.0))); else tmp = Float64(c + Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((b <= -9.5e-72) || ~((b <= 4.2e+245))) tmp = c + (a * (b / -4.0)); else tmp = c + ((x * y) + (0.0625 * (z * t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[b, -9.5e-72], N[Not[LessEqual[b, 4.2e+245]], $MachinePrecision]], N[(c + N[(a * N[(b / -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -9.5 \cdot 10^{-72} \lor \neg \left(b \leq 4.2 \cdot 10^{+245}\right):\\
\;\;\;\;c + a \cdot \frac{b}{-4}\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if b < -9.4999999999999998e-72 or 4.19999999999999992e245 < b Initial program 98.9%
Taylor expanded in a around inf 59.1%
associate-*r*59.1%
metadata-eval59.1%
distribute-lft-neg-in59.1%
*-commutative59.1%
distribute-lft-neg-in59.1%
metadata-eval59.1%
associate-/l*59.1%
*-rgt-identity59.1%
associate-*l/59.1%
distribute-lft-neg-in59.1%
distribute-rgt-neg-out59.1%
metadata-eval59.1%
distribute-neg-frac259.1%
distribute-frac-neg59.1%
distribute-rgt-neg-out59.1%
remove-double-neg59.1%
associate-/l*59.1%
Simplified59.1%
if -9.4999999999999998e-72 < b < 4.19999999999999992e245Initial program 99.4%
Taylor expanded in t around inf 89.0%
Taylor expanded in a around 0 80.0%
Taylor expanded in t around 0 86.8%
Final simplification77.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -1.7e+40) (not (<= (* x y) 4.5e+71))) (+ c (* x y)) (+ c (* t (* z 0.0625)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -1.7e+40) || !((x * y) <= 4.5e+71)) {
tmp = c + (x * y);
} else {
tmp = c + (t * (z * 0.0625));
}
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.7d+40)) .or. (.not. ((x * y) <= 4.5d+71))) then
tmp = c + (x * y)
else
tmp = c + (t * (z * 0.0625d0))
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.7e+40) || !((x * y) <= 4.5e+71)) {
tmp = c + (x * y);
} else {
tmp = c + (t * (z * 0.0625));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -1.7e+40) or not ((x * y) <= 4.5e+71): tmp = c + (x * y) else: tmp = c + (t * (z * 0.0625)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -1.7e+40) || !(Float64(x * y) <= 4.5e+71)) tmp = Float64(c + Float64(x * y)); else tmp = Float64(c + Float64(t * Float64(z * 0.0625))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((x * y) <= -1.7e+40) || ~(((x * y) <= 4.5e+71))) tmp = c + (x * y); else tmp = c + (t * (z * 0.0625)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1.7e+40], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4.5e+71]], $MachinePrecision]], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c + N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.7 \cdot 10^{+40} \lor \neg \left(x \cdot y \leq 4.5 \cdot 10^{+71}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.69999999999999994e40 or 4.50000000000000043e71 < (*.f64 x y) Initial program 98.1%
Taylor expanded in x around inf 87.3%
Taylor expanded in a around 0 78.3%
+-commutative78.3%
Simplified78.3%
if -1.69999999999999994e40 < (*.f64 x y) < 4.50000000000000043e71Initial program 100.0%
Taylor expanded in x around 0 97.5%
*-commutative97.5%
*-commutative97.5%
associate-*r*97.5%
*-commutative97.5%
Simplified97.5%
Taylor expanded in a around 0 69.7%
associate-*r*69.7%
*-commutative69.7%
associate-*r*69.7%
Simplified69.7%
Final simplification73.2%
(FPCore (x y z t a b c) :precision binary64 (+ c (- (+ (* 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 + (((x * y) + ((z * t) / 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) + ((z * t) / 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) + ((z * t) / 16.0)) - ((a * b) / 4.0));
}
def code(x, y, z, t, a, b, c): return c + (((x * y) + ((z * t) / 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(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0))) end
function tmp = code(x, y, z, t, a, b, c) tmp = c + (((x * y) + ((z * t) / 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[(z * t), $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{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right)
\end{array}
Initial program 99.2%
Final simplification99.2%
(FPCore (x y z t a b c) :precision binary64 (+ c (* x y)))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (x * y);
}
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)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c + (x * y);
}
def code(x, y, z, t, a, b, c): return c + (x * y)
function code(x, y, z, t, a, b, c) return Float64(c + Float64(x * y)) end
function tmp = code(x, y, z, t, a, b, c) tmp = c + (x * y); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + x \cdot y
\end{array}
Initial program 99.2%
Taylor expanded in x around inf 73.3%
Taylor expanded in a around 0 52.8%
+-commutative52.8%
Simplified52.8%
Final simplification52.8%
(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 99.2%
Taylor expanded in a around inf 46.7%
associate-*r*46.7%
metadata-eval46.7%
distribute-lft-neg-in46.7%
*-commutative46.7%
distribute-lft-neg-in46.7%
metadata-eval46.7%
associate-/l*46.7%
*-rgt-identity46.7%
associate-*l/46.7%
distribute-lft-neg-in46.7%
distribute-rgt-neg-out46.7%
metadata-eval46.7%
distribute-neg-frac246.7%
distribute-frac-neg46.7%
distribute-rgt-neg-out46.7%
remove-double-neg46.7%
associate-/l*46.7%
Simplified46.7%
Taylor expanded in a around 0 25.4%
herbie shell --seed 2024086
(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))