
(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 14 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 16.0) t (fma (/ a -4.0) b c))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(x, y, fma((z / 16.0), t, fma((a / -4.0), b, c)));
}
function code(x, y, z, t, a, b, c) return fma(x, y, fma(Float64(z / 16.0), t, fma(Float64(a / -4.0), b, c))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(x * y + N[(N[(z / 16.0), $MachinePrecision] * t + N[(N[(a / -4.0), $MachinePrecision] * b + c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(\frac{z}{16}, t, \mathsf{fma}\left(\frac{a}{-4}, b, c\right)\right)\right)
\end{array}
Initial program 99.6%
associate-+l-99.6%
associate--l+99.6%
fma-def100.0%
associate-*l/100.0%
fma-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
associate-/l*99.9%
distribute-frac-neg99.9%
associate-/r/100.0%
fma-def100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (x y z t a b c) :precision binary64 (+ (+ (fma a (* b -0.25) c) (* x y)) (* t (* z 0.0625))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (fma(a, (b * -0.25), c) + (x * y)) + (t * (z * 0.0625));
}
function code(x, y, z, t, a, b, c) return Float64(Float64(fma(a, Float64(b * -0.25), c) + Float64(x * y)) + Float64(t * Float64(z * 0.0625))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(a * N[(b * -0.25), $MachinePrecision] + c), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\mathsf{fma}\left(a, b \cdot -0.25, c\right) + x \cdot y\right) + t \cdot \left(z \cdot 0.0625\right)
\end{array}
Initial program 99.6%
associate-+l-99.6%
associate--l+99.6%
fma-def100.0%
associate-*l/100.0%
fma-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
associate-/l*99.9%
distribute-frac-neg99.9%
associate-/r/100.0%
fma-def100.0%
neg-mul-1100.0%
*-commutative100.0%
associate-/l*100.0%
metadata-eval100.0%
Simplified100.0%
fma-udef99.6%
fma-udef99.6%
associate-*l/99.6%
fma-udef99.6%
associate-/r/99.6%
associate-+r+99.6%
associate-*l/99.6%
fma-udef99.9%
+-commutative99.9%
fma-udef99.6%
associate-*l/99.6%
associate-+r+99.6%
div-inv99.6%
fma-def99.6%
clear-num99.6%
div-inv99.6%
metadata-eval99.6%
associate-*l/99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x y z t a b c) :precision binary64 (+ (fma x y (* (/ z 16.0) t)) (+ c (/ a (/ -4.0 b)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(x, y, ((z / 16.0) * t)) + (c + (a / (-4.0 / b)));
}
function code(x, y, z, t, a, b, c) return Float64(fma(x, y, Float64(Float64(z / 16.0) * t)) + Float64(c + Float64(a / Float64(-4.0 / b)))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(x * y + N[(N[(z / 16.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(c + N[(a / N[(-4.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \frac{z}{16} \cdot t\right) + \left(c + \frac{a}{\frac{-4}{b}}\right)
\end{array}
Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
fma-def100.0%
associate-*l/100.0%
distribute-frac-neg100.0%
distribute-rgt-neg-out100.0%
associate-/l*99.9%
neg-mul-199.9%
associate-/r*99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* z (* t 0.0625)))) (t_2 (- (* x y) (* (* a b) 0.25))))
(if (<= (* x y) -2.9e+115)
t_2
(if (<= (* x y) -3e-49)
t_1
(if (<= (* x y) -9e-62)
t_2
(if (<= (* x y) 1.42e-292)
t_1
(if (<= (* x y) 1.95e+35) (+ c (* a (* b -0.25))) t_2)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (z * (t * 0.0625));
double t_2 = (x * y) - ((a * b) * 0.25);
double tmp;
if ((x * y) <= -2.9e+115) {
tmp = t_2;
} else if ((x * y) <= -3e-49) {
tmp = t_1;
} else if ((x * y) <= -9e-62) {
tmp = t_2;
} else if ((x * y) <= 1.42e-292) {
tmp = t_1;
} else if ((x * y) <= 1.95e+35) {
tmp = c + (a * (b * -0.25));
} 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 + (z * (t * 0.0625d0))
t_2 = (x * y) - ((a * b) * 0.25d0)
if ((x * y) <= (-2.9d+115)) then
tmp = t_2
else if ((x * y) <= (-3d-49)) then
tmp = t_1
else if ((x * y) <= (-9d-62)) then
tmp = t_2
else if ((x * y) <= 1.42d-292) then
tmp = t_1
else if ((x * y) <= 1.95d+35) then
tmp = c + (a * (b * (-0.25d0)))
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 + (z * (t * 0.0625));
double t_2 = (x * y) - ((a * b) * 0.25);
double tmp;
if ((x * y) <= -2.9e+115) {
tmp = t_2;
} else if ((x * y) <= -3e-49) {
tmp = t_1;
} else if ((x * y) <= -9e-62) {
tmp = t_2;
} else if ((x * y) <= 1.42e-292) {
tmp = t_1;
} else if ((x * y) <= 1.95e+35) {
tmp = c + (a * (b * -0.25));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = c + (z * (t * 0.0625)) t_2 = (x * y) - ((a * b) * 0.25) tmp = 0 if (x * y) <= -2.9e+115: tmp = t_2 elif (x * y) <= -3e-49: tmp = t_1 elif (x * y) <= -9e-62: tmp = t_2 elif (x * y) <= 1.42e-292: tmp = t_1 elif (x * y) <= 1.95e+35: tmp = c + (a * (b * -0.25)) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(z * Float64(t * 0.0625))) t_2 = Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25)) tmp = 0.0 if (Float64(x * y) <= -2.9e+115) tmp = t_2; elseif (Float64(x * y) <= -3e-49) tmp = t_1; elseif (Float64(x * y) <= -9e-62) tmp = t_2; elseif (Float64(x * y) <= 1.42e-292) tmp = t_1; elseif (Float64(x * y) <= 1.95e+35) tmp = Float64(c + Float64(a * Float64(b * -0.25))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = c + (z * (t * 0.0625)); t_2 = (x * y) - ((a * b) * 0.25); tmp = 0.0; if ((x * y) <= -2.9e+115) tmp = t_2; elseif ((x * y) <= -3e-49) tmp = t_1; elseif ((x * y) <= -9e-62) tmp = t_2; elseif ((x * y) <= 1.42e-292) tmp = t_1; elseif ((x * y) <= 1.95e+35) tmp = c + (a * (b * -0.25)); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.9e+115], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -3e-49], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -9e-62], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 1.42e-292], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.95e+35], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + z \cdot \left(t \cdot 0.0625\right)\\
t_2 := x \cdot y - \left(a \cdot b\right) \cdot 0.25\\
\mathbf{if}\;x \cdot y \leq -2.9 \cdot 10^{+115}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot y \leq -3 \cdot 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq -9 \cdot 10^{-62}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \cdot y \leq 1.42 \cdot 10^{-292}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 1.95 \cdot 10^{+35}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (*.f64 x y) < -2.90000000000000005e115 or -3e-49 < (*.f64 x y) < -9.00000000000000036e-62 or 1.95e35 < (*.f64 x y) Initial program 99.1%
Taylor expanded in z around 0 87.6%
Taylor expanded in c around 0 83.0%
if -2.90000000000000005e115 < (*.f64 x y) < -3e-49 or -9.00000000000000036e-62 < (*.f64 x y) < 1.41999999999999989e-292Initial program 100.0%
Taylor expanded in a around 0 76.4%
Taylor expanded in t around inf 74.5%
associate-*r*74.5%
Simplified74.5%
if 1.41999999999999989e-292 < (*.f64 x y) < 1.95e35Initial program 100.0%
Taylor expanded in a around inf 86.1%
*-commutative86.1%
associate-*r*86.1%
Simplified86.1%
Final simplification80.3%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* a b) 0.25)) (t_2 (* 0.0625 (* z t))))
(if (<= (* a b) -2e+117)
(- (+ c (* x y)) t_1)
(if (<= (* a b) 5e+126) (+ c (+ (* x y) t_2)) (- (+ c t_2) 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 t_2 = 0.0625 * (z * t);
double tmp;
if ((a * b) <= -2e+117) {
tmp = (c + (x * y)) - t_1;
} else if ((a * b) <= 5e+126) {
tmp = c + ((x * y) + t_2);
} else {
tmp = (c + t_2) - 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) :: t_2
real(8) :: tmp
t_1 = (a * b) * 0.25d0
t_2 = 0.0625d0 * (z * t)
if ((a * b) <= (-2d+117)) then
tmp = (c + (x * y)) - t_1
else if ((a * b) <= 5d+126) then
tmp = c + ((x * y) + t_2)
else
tmp = (c + t_2) - 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 = (a * b) * 0.25;
double t_2 = 0.0625 * (z * t);
double tmp;
if ((a * b) <= -2e+117) {
tmp = (c + (x * y)) - t_1;
} else if ((a * b) <= 5e+126) {
tmp = c + ((x * y) + t_2);
} else {
tmp = (c + t_2) - t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (a * b) * 0.25 t_2 = 0.0625 * (z * t) tmp = 0 if (a * b) <= -2e+117: tmp = (c + (x * y)) - t_1 elif (a * b) <= 5e+126: tmp = c + ((x * y) + t_2) else: tmp = (c + t_2) - t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) * 0.25) t_2 = Float64(0.0625 * Float64(z * t)) tmp = 0.0 if (Float64(a * b) <= -2e+117) tmp = Float64(Float64(c + Float64(x * y)) - t_1); elseif (Float64(a * b) <= 5e+126) tmp = Float64(c + Float64(Float64(x * y) + t_2)); else tmp = Float64(Float64(c + t_2) - t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (a * b) * 0.25; t_2 = 0.0625 * (z * t); tmp = 0.0; if ((a * b) <= -2e+117) tmp = (c + (x * y)) - t_1; elseif ((a * b) <= 5e+126) tmp = c + ((x * y) + t_2); else tmp = (c + t_2) - t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]}, Block[{t$95$2 = N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -2e+117], N[(N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+126], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(c + t$95$2), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot b\right) \cdot 0.25\\
t_2 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+117}:\\
\;\;\;\;\left(c + x \cdot y\right) - t_1\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+126}:\\
\;\;\;\;c + \left(x \cdot y + t_2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(c + t_2\right) - t_1\\
\end{array}
\end{array}
if (*.f64 a b) < -2.0000000000000001e117Initial program 100.0%
Taylor expanded in z around 0 89.8%
if -2.0000000000000001e117 < (*.f64 a b) < 4.99999999999999977e126Initial program 100.0%
Taylor expanded in a around 0 95.2%
if 4.99999999999999977e126 < (*.f64 a b) Initial program 96.7%
Taylor expanded in x around 0 90.2%
Final simplification93.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* x y))))
(if (<= (* x y) -1.45e+122)
t_1
(if (<= (* x y) 2.1e-307)
(+ c (* z (* t 0.0625)))
(if (<= (* x y) 1.05e+108) (+ 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 = c + (x * y);
double tmp;
if ((x * y) <= -1.45e+122) {
tmp = t_1;
} else if ((x * y) <= 2.1e-307) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 1.05e+108) {
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 = c + (x * y)
if ((x * y) <= (-1.45d+122)) then
tmp = t_1
else if ((x * y) <= 2.1d-307) then
tmp = c + (z * (t * 0.0625d0))
else if ((x * y) <= 1.05d+108) 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 = c + (x * y);
double tmp;
if ((x * y) <= -1.45e+122) {
tmp = t_1;
} else if ((x * y) <= 2.1e-307) {
tmp = c + (z * (t * 0.0625));
} else if ((x * y) <= 1.05e+108) {
tmp = c + (a * (b * -0.25));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = c + (x * y) tmp = 0 if (x * y) <= -1.45e+122: tmp = t_1 elif (x * y) <= 2.1e-307: tmp = c + (z * (t * 0.0625)) elif (x * y) <= 1.05e+108: tmp = c + (a * (b * -0.25)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -1.45e+122) tmp = t_1; elseif (Float64(x * y) <= 2.1e-307) tmp = Float64(c + Float64(z * Float64(t * 0.0625))); elseif (Float64(x * y) <= 1.05e+108) 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 = c + (x * y); tmp = 0.0; if ((x * y) <= -1.45e+122) tmp = t_1; elseif ((x * y) <= 2.1e-307) tmp = c + (z * (t * 0.0625)); elseif ((x * y) <= 1.05e+108) 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[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1.45e+122], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2.1e-307], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.05e+108], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -1.45 \cdot 10^{+122}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 2.1 \cdot 10^{-307}:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{elif}\;x \cdot y \leq 1.05 \cdot 10^{+108}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 x y) < -1.45e122 or 1.05000000000000005e108 < (*.f64 x y) Initial program 98.9%
Taylor expanded in a around 0 86.5%
Taylor expanded in t around 0 75.8%
if -1.45e122 < (*.f64 x y) < 2.1000000000000001e-307Initial program 100.0%
Taylor expanded in a around 0 74.5%
Taylor expanded in t around inf 70.1%
associate-*r*70.1%
Simplified70.1%
if 2.1000000000000001e-307 < (*.f64 x y) < 1.05000000000000005e108Initial program 100.0%
Taylor expanded in a around inf 79.8%
*-commutative79.8%
associate-*r*79.8%
Simplified79.8%
Final simplification74.3%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -5e+185) (not (<= (* a b) 2e+199))) (- (* x y) (* (* a b) 0.25)) (+ 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) <= -5e+185) || !((a * b) <= 2e+199)) {
tmp = (x * y) - ((a * b) * 0.25);
} 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) <= (-5d+185)) .or. (.not. ((a * b) <= 2d+199))) then
tmp = (x * y) - ((a * b) * 0.25d0)
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) <= -5e+185) || !((a * b) <= 2e+199)) {
tmp = (x * y) - ((a * b) * 0.25);
} 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) <= -5e+185) or not ((a * b) <= 2e+199): tmp = (x * y) - ((a * b) * 0.25) 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) <= -5e+185) || !(Float64(a * b) <= 2e+199)) tmp = Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25)); 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) <= -5e+185) || ~(((a * b) <= 2e+199))) tmp = (x * y) - ((a * b) * 0.25); 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], -5e+185], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+199]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $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 -5 \cdot 10^{+185} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+199}\right):\\
\;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -4.9999999999999999e185 or 2.00000000000000019e199 < (*.f64 a b) Initial program 98.3%
Taylor expanded in z around 0 93.6%
Taylor expanded in c around 0 91.6%
if -4.9999999999999999e185 < (*.f64 a b) < 2.00000000000000019e199Initial program 100.0%
Taylor expanded in a around 0 91.5%
Final simplification91.5%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -2e+117) (not (<= (* a b) 1e+46))) (- (+ c (* x y)) (* (* a b) 0.25)) (+ 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) <= -2e+117) || !((a * b) <= 1e+46)) {
tmp = (c + (x * y)) - ((a * b) * 0.25);
} 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) <= (-2d+117)) .or. (.not. ((a * b) <= 1d+46))) then
tmp = (c + (x * y)) - ((a * b) * 0.25d0)
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) <= -2e+117) || !((a * b) <= 1e+46)) {
tmp = (c + (x * y)) - ((a * b) * 0.25);
} 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) <= -2e+117) or not ((a * b) <= 1e+46): tmp = (c + (x * y)) - ((a * b) * 0.25) 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) <= -2e+117) || !(Float64(a * b) <= 1e+46)) tmp = Float64(Float64(c + Float64(x * y)) - Float64(Float64(a * b) * 0.25)); 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) <= -2e+117) || ~(((a * b) <= 1e+46))) tmp = (c + (x * y)) - ((a * b) * 0.25); 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], -2e+117], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+46]], $MachinePrecision]], N[(N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $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 -2 \cdot 10^{+117} \lor \neg \left(a \cdot b \leq 10^{+46}\right):\\
\;\;\;\;\left(c + x \cdot y\right) - \left(a \cdot b\right) \cdot 0.25\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -2.0000000000000001e117 or 9.9999999999999999e45 < (*.f64 a b) Initial program 99.0%
Taylor expanded in z around 0 87.9%
if -2.0000000000000001e117 < (*.f64 a b) < 9.9999999999999999e45Initial program 100.0%
Taylor expanded in a around 0 96.5%
Final simplification93.2%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* a b) 0.25)) (t_2 (* 0.0625 (* z t))))
(if (<= (* a b) -5e+185)
(- (* x y) t_1)
(if (<= (* a b) 2e+153) (+ c (+ (* x y) t_2)) (- t_2 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 t_2 = 0.0625 * (z * t);
double tmp;
if ((a * b) <= -5e+185) {
tmp = (x * y) - t_1;
} else if ((a * b) <= 2e+153) {
tmp = c + ((x * y) + t_2);
} else {
tmp = t_2 - 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) :: t_2
real(8) :: tmp
t_1 = (a * b) * 0.25d0
t_2 = 0.0625d0 * (z * t)
if ((a * b) <= (-5d+185)) then
tmp = (x * y) - t_1
else if ((a * b) <= 2d+153) then
tmp = c + ((x * y) + t_2)
else
tmp = t_2 - 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 = (a * b) * 0.25;
double t_2 = 0.0625 * (z * t);
double tmp;
if ((a * b) <= -5e+185) {
tmp = (x * y) - t_1;
} else if ((a * b) <= 2e+153) {
tmp = c + ((x * y) + t_2);
} else {
tmp = t_2 - t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = (a * b) * 0.25 t_2 = 0.0625 * (z * t) tmp = 0 if (a * b) <= -5e+185: tmp = (x * y) - t_1 elif (a * b) <= 2e+153: tmp = c + ((x * y) + t_2) else: tmp = t_2 - t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) * 0.25) t_2 = Float64(0.0625 * Float64(z * t)) tmp = 0.0 if (Float64(a * b) <= -5e+185) tmp = Float64(Float64(x * y) - t_1); elseif (Float64(a * b) <= 2e+153) tmp = Float64(c + Float64(Float64(x * y) + t_2)); else tmp = Float64(t_2 - t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = (a * b) * 0.25; t_2 = 0.0625 * (z * t); tmp = 0.0; if ((a * b) <= -5e+185) tmp = (x * y) - t_1; elseif ((a * b) <= 2e+153) tmp = c + ((x * y) + t_2); else tmp = t_2 - t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]}, Block[{t$95$2 = N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+185], N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2e+153], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$2 - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(a \cdot b\right) \cdot 0.25\\
t_2 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+185}:\\
\;\;\;\;x \cdot y - t_1\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{+153}:\\
\;\;\;\;c + \left(x \cdot y + t_2\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 - t_1\\
\end{array}
\end{array}
if (*.f64 a b) < -4.9999999999999999e185Initial program 100.0%
Taylor expanded in z around 0 93.0%
Taylor expanded in c around 0 90.1%
if -4.9999999999999999e185 < (*.f64 a b) < 2e153Initial program 100.0%
Taylor expanded in a around 0 92.7%
if 2e153 < (*.f64 a b) Initial program 96.1%
Taylor expanded in x around 0 91.9%
Taylor expanded in c around 0 88.0%
Final simplification91.9%
(FPCore (x y z t a b c) :precision binary64 (+ c (+ (* t (* z 0.0625)) (- (* x y) (/ a (/ 4.0 b))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + ((t * (z * 0.0625)) + ((x * y) - (a / (4.0 / b))));
}
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 + ((t * (z * 0.0625d0)) + ((x * y) - (a / (4.0d0 / b))))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c + ((t * (z * 0.0625)) + ((x * y) - (a / (4.0 / b))));
}
def code(x, y, z, t, a, b, c): return c + ((t * (z * 0.0625)) + ((x * y) - (a / (4.0 / b))))
function code(x, y, z, t, a, b, c) return Float64(c + Float64(Float64(t * Float64(z * 0.0625)) + Float64(Float64(x * y) - Float64(a / Float64(4.0 / b))))) end
function tmp = code(x, y, z, t, a, b, c) tmp = c + ((t * (z * 0.0625)) + ((x * y) - (a / (4.0 / b)))); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] - N[(a / N[(4.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + \left(t \cdot \left(z \cdot 0.0625\right) + \left(x \cdot y - \frac{a}{\frac{4}{b}}\right)\right)
\end{array}
Initial program 99.6%
+-commutative99.6%
associate--l+99.6%
associate-*l/99.6%
*-commutative99.6%
div-inv99.6%
metadata-eval99.6%
associate-/l*99.6%
Applied egg-rr99.6%
Final simplification99.6%
(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.6%
Final simplification99.6%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -1.4e+122) (not (<= (* x y) 1.95e-20))) (+ c (* x y)) (+ c (* z (* t 0.0625)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -1.4e+122) || !((x * y) <= 1.95e-20)) {
tmp = c + (x * y);
} else {
tmp = c + (z * (t * 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.4d+122)) .or. (.not. ((x * y) <= 1.95d-20))) then
tmp = c + (x * y)
else
tmp = c + (z * (t * 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.4e+122) || !((x * y) <= 1.95e-20)) {
tmp = c + (x * y);
} else {
tmp = c + (z * (t * 0.0625));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -1.4e+122) or not ((x * y) <= 1.95e-20): tmp = c + (x * y) else: tmp = c + (z * (t * 0.0625)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -1.4e+122) || !(Float64(x * y) <= 1.95e-20)) tmp = Float64(c + Float64(x * y)); else tmp = Float64(c + Float64(z * Float64(t * 0.0625))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (((x * y) <= -1.4e+122) || ~(((x * y) <= 1.95e-20))) tmp = c + (x * y); else tmp = c + (z * (t * 0.0625)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1.4e+122], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.95e-20]], $MachinePrecision]], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.4 \cdot 10^{+122} \lor \neg \left(x \cdot y \leq 1.95 \cdot 10^{-20}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.4e122 or 1.95000000000000004e-20 < (*.f64 x y) Initial program 99.1%
Taylor expanded in a around 0 80.1%
Taylor expanded in t around 0 69.5%
if -1.4e122 < (*.f64 x y) < 1.95000000000000004e-20Initial program 100.0%
Taylor expanded in a around 0 74.1%
Taylor expanded in t around inf 70.8%
associate-*r*70.8%
Simplified70.8%
Final simplification70.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.6%
Taylor expanded in a around 0 76.7%
Taylor expanded in t around 0 53.2%
Final simplification53.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 99.6%
Taylor expanded in c around inf 24.4%
Final simplification24.4%
herbie shell --seed 2023336
(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))