
(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 (let* ((t_1 (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)))) (if (<= t_1 INFINITY) (+ c t_1) (+ c (fma y x (* 0.0625 (* z t)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = c + t_1;
} else {
tmp = c + fma(y, x, (0.0625 * (z * t)));
}
return tmp;
}
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) tmp = 0.0 if (t_1 <= Inf) tmp = Float64(c + t_1); else tmp = Float64(c + fma(y, x, Float64(0.0625 * Float64(z * t)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], N[(c + t$95$1), $MachinePrecision], N[(c + N[(y * x + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;c + t\_1\\
\mathbf{else}:\\
\;\;\;\;c + \mathsf{fma}\left(y, x, 0.0625 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4)) < +inf.0Initial program 100.0%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) 16)) (/.f64 (*.f64 a b) 4)) Initial program 0.0%
Taylor expanded in a around 0 50.0%
+-commutative50.0%
*-commutative50.0%
fma-define83.3%
*-commutative83.3%
Applied egg-rr83.3%
Final simplification99.6%
(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 97.6%
associate--l+97.6%
fma-define98.8%
associate-/l*98.8%
fma-neg98.8%
distribute-neg-frac298.8%
metadata-eval98.8%
Simplified98.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 97.6%
associate-+l-97.6%
*-commutative97.6%
associate-+l-97.6%
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 (+ c (fma x y (- (* z (* t 0.0625)) (/ a (/ 4.0 b))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + fma(x, y, ((z * (t * 0.0625)) - (a / (4.0 / b))));
}
function code(x, y, z, t, a, b, c) return Float64(c + fma(x, y, Float64(Float64(z * Float64(t * 0.0625)) - Float64(a / Float64(4.0 / b))))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(x * y + N[(N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision] - N[(a / N[(4.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + \mathsf{fma}\left(x, y, z \cdot \left(t \cdot 0.0625\right) - \frac{a}{\frac{4}{b}}\right)
\end{array}
Initial program 97.6%
associate--l+97.6%
fma-define98.8%
associate-/l*98.8%
fma-neg98.8%
distribute-neg-frac298.8%
metadata-eval98.8%
Simplified98.8%
fma-undefine98.8%
associate-*r/98.8%
frac-2neg98.8%
metadata-eval98.8%
div-inv98.8%
cancel-sign-sub-inv98.8%
div-inv98.8%
associate-*r/98.8%
div-inv98.8%
metadata-eval98.8%
associate-*r/98.8%
clear-num98.8%
un-div-inv98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* b (* a -0.25))))
(t_2 (+ c (* 0.0625 (* z t))))
(t_3 (+ c (* x y))))
(if (<= (* x y) -2.4e+42)
t_3
(if (<= (* x y) 0.0)
t_1
(if (<= (* x y) 1.95e-289)
t_2
(if (<= (* x y) 1.7e-128) t_1 (if (<= (* x y) 3.4e+147) t_2 t_3)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (b * (a * -0.25));
double t_2 = c + (0.0625 * (z * t));
double t_3 = c + (x * y);
double tmp;
if ((x * y) <= -2.4e+42) {
tmp = t_3;
} else if ((x * y) <= 0.0) {
tmp = t_1;
} else if ((x * y) <= 1.95e-289) {
tmp = t_2;
} else if ((x * y) <= 1.7e-128) {
tmp = t_1;
} else if ((x * y) <= 3.4e+147) {
tmp = t_2;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = c + (b * (a * (-0.25d0)))
t_2 = c + (0.0625d0 * (z * t))
t_3 = c + (x * y)
if ((x * y) <= (-2.4d+42)) then
tmp = t_3
else if ((x * y) <= 0.0d0) then
tmp = t_1
else if ((x * y) <= 1.95d-289) then
tmp = t_2
else if ((x * y) <= 1.7d-128) then
tmp = t_1
else if ((x * y) <= 3.4d+147) then
tmp = t_2
else
tmp = t_3
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 + (b * (a * -0.25));
double t_2 = c + (0.0625 * (z * t));
double t_3 = c + (x * y);
double tmp;
if ((x * y) <= -2.4e+42) {
tmp = t_3;
} else if ((x * y) <= 0.0) {
tmp = t_1;
} else if ((x * y) <= 1.95e-289) {
tmp = t_2;
} else if ((x * y) <= 1.7e-128) {
tmp = t_1;
} else if ((x * y) <= 3.4e+147) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = c + (b * (a * -0.25)) t_2 = c + (0.0625 * (z * t)) t_3 = c + (x * y) tmp = 0 if (x * y) <= -2.4e+42: tmp = t_3 elif (x * y) <= 0.0: tmp = t_1 elif (x * y) <= 1.95e-289: tmp = t_2 elif (x * y) <= 1.7e-128: tmp = t_1 elif (x * y) <= 3.4e+147: tmp = t_2 else: tmp = t_3 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(b * Float64(a * -0.25))) t_2 = Float64(c + Float64(0.0625 * Float64(z * t))) t_3 = Float64(c + Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -2.4e+42) tmp = t_3; elseif (Float64(x * y) <= 0.0) tmp = t_1; elseif (Float64(x * y) <= 1.95e-289) tmp = t_2; elseif (Float64(x * y) <= 1.7e-128) tmp = t_1; elseif (Float64(x * y) <= 3.4e+147) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = c + (b * (a * -0.25)); t_2 = c + (0.0625 * (z * t)); t_3 = c + (x * y); tmp = 0.0; if ((x * y) <= -2.4e+42) tmp = t_3; elseif ((x * y) <= 0.0) tmp = t_1; elseif ((x * y) <= 1.95e-289) tmp = t_2; elseif ((x * y) <= 1.7e-128) tmp = t_1; elseif ((x * y) <= 3.4e+147) tmp = t_2; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.4e+42], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], 0.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.95e-289], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 1.7e-128], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 3.4e+147], t$95$2, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + b \cdot \left(a \cdot -0.25\right)\\
t_2 := c + 0.0625 \cdot \left(z \cdot t\right)\\
t_3 := c + x \cdot y\\
\mathbf{if}\;x \cdot y \leq -2.4 \cdot 10^{+42}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;x \cdot y \leq 0:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 1.95 \cdot 10^{-289}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq 1.7 \cdot 10^{-128}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{+147}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 x y) < -2.3999999999999999e42 or 3.4e147 < (*.f64 x y) Initial program 94.9%
Taylor expanded in x around inf 77.4%
if -2.3999999999999999e42 < (*.f64 x y) < 0.0 or 1.9499999999999999e-289 < (*.f64 x y) < 1.69999999999999987e-128Initial program 100.0%
Taylor expanded in a around inf 68.8%
associate-*r*68.8%
Simplified68.8%
if 0.0 < (*.f64 x y) < 1.9499999999999999e-289 or 1.69999999999999987e-128 < (*.f64 x y) < 3.4e147Initial program 98.1%
Taylor expanded in z around inf 75.2%
Final simplification73.4%
(FPCore (x y z t a b c)
:precision binary64
(if (or (<= z -9.6e+149)
(not (or (<= z 1.4e-170) (and (not (<= z 2.3e-115)) (<= z 3.7e-37)))))
(+ c (* 0.0625 (* z t)))
(- (* x y) (* (* a b) 0.25))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -9.6e+149) || !((z <= 1.4e-170) || (!(z <= 2.3e-115) && (z <= 3.7e-37)))) {
tmp = c + (0.0625 * (z * t));
} else {
tmp = (x * y) - ((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 ((z <= (-9.6d+149)) .or. (.not. (z <= 1.4d-170) .or. (.not. (z <= 2.3d-115)) .and. (z <= 3.7d-37))) then
tmp = c + (0.0625d0 * (z * t))
else
tmp = (x * y) - ((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 ((z <= -9.6e+149) || !((z <= 1.4e-170) || (!(z <= 2.3e-115) && (z <= 3.7e-37)))) {
tmp = c + (0.0625 * (z * t));
} else {
tmp = (x * y) - ((a * b) * 0.25);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (z <= -9.6e+149) or not ((z <= 1.4e-170) or (not (z <= 2.3e-115) and (z <= 3.7e-37))): tmp = c + (0.0625 * (z * t)) else: tmp = (x * y) - ((a * b) * 0.25) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -9.6e+149) || !((z <= 1.4e-170) || (!(z <= 2.3e-115) && (z <= 3.7e-37)))) tmp = Float64(c + Float64(0.0625 * Float64(z * t))); else tmp = Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((z <= -9.6e+149) || ~(((z <= 1.4e-170) || (~((z <= 2.3e-115)) && (z <= 3.7e-37))))) tmp = c + (0.0625 * (z * t)); else tmp = (x * y) - ((a * b) * 0.25); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -9.6e+149], N[Not[Or[LessEqual[z, 1.4e-170], And[N[Not[LessEqual[z, 2.3e-115]], $MachinePrecision], LessEqual[z, 3.7e-37]]]], $MachinePrecision]], N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.6 \cdot 10^{+149} \lor \neg \left(z \leq 1.4 \cdot 10^{-170} \lor \neg \left(z \leq 2.3 \cdot 10^{-115}\right) \land z \leq 3.7 \cdot 10^{-37}\right):\\
\;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\
\end{array}
\end{array}
if z < -9.60000000000000047e149 or 1.39999999999999998e-170 < z < 2.29999999999999985e-115 or 3.7e-37 < z Initial program 98.4%
Taylor expanded in z around inf 59.4%
if -9.60000000000000047e149 < z < 1.39999999999999998e-170 or 2.29999999999999985e-115 < z < 3.7e-37Initial program 97.0%
Taylor expanded in z around 0 85.3%
Taylor expanded in c around 0 67.3%
Final simplification63.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* 0.0625 (* z t))))
(if (or (<= (* x y) -2.6e+43) (not (<= (* x y) 8.2e-22)))
(+ 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 * (z * t);
double tmp;
if (((x * y) <= -2.6e+43) || !((x * y) <= 8.2e-22)) {
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 * (z * t)
if (((x * y) <= (-2.6d+43)) .or. (.not. ((x * y) <= 8.2d-22))) 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 * (z * t);
double tmp;
if (((x * y) <= -2.6e+43) || !((x * y) <= 8.2e-22)) {
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 * (z * t) tmp = 0 if ((x * y) <= -2.6e+43) or not ((x * y) <= 8.2e-22): 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(z * t)) tmp = 0.0 if ((Float64(x * y) <= -2.6e+43) || !(Float64(x * y) <= 8.2e-22)) tmp = Float64(c + Float64(Float64(x * y) + t_1)); else tmp = Float64(Float64(c + 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 * (z * t); tmp = 0.0; if (((x * y) <= -2.6e+43) || ~(((x * y) <= 8.2e-22))) 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[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(x * y), $MachinePrecision], -2.6e+43], N[Not[LessEqual[N[(x * y), $MachinePrecision], 8.2e-22]], $MachinePrecision]], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(c + t$95$1), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;x \cdot y \leq -2.6 \cdot 10^{+43} \lor \neg \left(x \cdot y \leq 8.2 \cdot 10^{-22}\right):\\
\;\;\;\;c + \left(x \cdot y + t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(c + t\_1\right) - \left(a \cdot b\right) \cdot 0.25\\
\end{array}
\end{array}
if (*.f64 x y) < -2.60000000000000021e43 or 8.1999999999999999e-22 < (*.f64 x y) Initial program 95.4%
Taylor expanded in a around 0 88.1%
if -2.60000000000000021e43 < (*.f64 x y) < 8.1999999999999999e-22Initial program 100.0%
Taylor expanded in x around 0 97.1%
Final simplification92.5%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -1e+71) (not (<= (* a b) 1e+262))) (- (* 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) <= -1e+71) || !((a * b) <= 1e+262)) {
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) <= (-1d+71)) .or. (.not. ((a * b) <= 1d+262))) 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) <= -1e+71) || !((a * b) <= 1e+262)) {
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) <= -1e+71) or not ((a * b) <= 1e+262): 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) <= -1e+71) || !(Float64(a * b) <= 1e+262)) 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) <= -1e+71) || ~(((a * b) <= 1e+262))) 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], -1e+71], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+262]], $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 -1 \cdot 10^{+71} \lor \neg \left(a \cdot b \leq 10^{+262}\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) < -1e71 or 1e262 < (*.f64 a b) Initial program 92.9%
Taylor expanded in z around 0 86.5%
Taylor expanded in c around 0 82.2%
if -1e71 < (*.f64 a b) < 1e262Initial program 99.4%
Taylor expanded in a around 0 87.1%
Final simplification85.8%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -2e-13) (not (<= (* a b) 2e+152))) (- (+ 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-13) || !((a * b) <= 2e+152)) {
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-13)) .or. (.not. ((a * b) <= 2d+152))) 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-13) || !((a * b) <= 2e+152)) {
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-13) or not ((a * b) <= 2e+152): 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-13) || !(Float64(a * b) <= 2e+152)) 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-13) || ~(((a * b) <= 2e+152))) 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-13], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+152]], $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^{-13} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+152}\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.0000000000000001e-13 or 2.0000000000000001e152 < (*.f64 a b) Initial program 94.9%
Taylor expanded in z around 0 82.6%
if -2.0000000000000001e-13 < (*.f64 a b) < 2.0000000000000001e152Initial program 99.3%
Taylor expanded in a around 0 90.6%
Final simplification87.5%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -5.2e+77) (not (<= (* x y) 6e+147))) (+ c (* x y)) (+ c (* 0.0625 (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((x * y) <= -5.2e+77) || !((x * y) <= 6e+147)) {
tmp = c + (x * y);
} else {
tmp = c + (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 (((x * y) <= (-5.2d+77)) .or. (.not. ((x * y) <= 6d+147))) then
tmp = c + (x * y)
else
tmp = c + (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 (((x * y) <= -5.2e+77) || !((x * y) <= 6e+147)) {
tmp = c + (x * y);
} else {
tmp = c + (0.0625 * (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -5.2e+77) or not ((x * y) <= 6e+147): tmp = c + (x * y) else: tmp = c + (0.0625 * (z * t)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(x * y) <= -5.2e+77) || !(Float64(x * y) <= 6e+147)) tmp = Float64(c + Float64(x * y)); else tmp = Float64(c + 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 (((x * y) <= -5.2e+77) || ~(((x * y) <= 6e+147))) tmp = c + (x * y); else tmp = c + (0.0625 * (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -5.2e+77], N[Not[LessEqual[N[(x * y), $MachinePrecision], 6e+147]], $MachinePrecision]], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5.2 \cdot 10^{+77} \lor \neg \left(x \cdot y \leq 6 \cdot 10^{+147}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + 0.0625 \cdot \left(z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -5.2000000000000004e77 or 5.99999999999999987e147 < (*.f64 x y) Initial program 94.6%
Taylor expanded in x around inf 78.3%
if -5.2000000000000004e77 < (*.f64 x y) < 5.99999999999999987e147Initial program 99.3%
Taylor expanded in z around inf 56.8%
Final simplification64.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 97.6%
Final simplification97.6%
(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 97.6%
Taylor expanded in x around inf 45.2%
Final simplification45.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 97.6%
Taylor expanded in c around inf 15.9%
Final simplification15.9%
herbie shell --seed 2024040
(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))