
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c) :precision binary64 (+ (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) c))
double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = (((x * y) + ((z * t) / 16.0d0)) - ((a * b) / 4.0d0)) + c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c;
}
def code(x, y, z, t, a, b, c): return (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c
function code(x, y, z, t, a, b, c) return Float64(Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) + c) end
function tmp = code(x, y, z, t, a, b, c) tmp = (((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) + c; end
code[x_, y_, z_, t_, a_, b_, c_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision] + c), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4}\right) + c
\end{array}
(FPCore (x y z t a b c) :precision binary64 (if (<= (- (+ (* x y) (/ (* z t) 16.0)) (/ (* a b) 4.0)) INFINITY) (+ c (- (fma x y (* z (/ t 16.0))) (* a (/ b 4.0)))) (+ c (* x y))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0)) <= ((double) INFINITY)) {
tmp = c + (fma(x, y, (z * (t / 16.0))) - (a * (b / 4.0)));
} else {
tmp = c + (x * y);
}
return tmp;
}
function code(x, y, z, t, a, b, c) tmp = 0.0 if (Float64(Float64(Float64(x * y) + Float64(Float64(z * t) / 16.0)) - Float64(Float64(a * b) / 4.0)) <= Inf) tmp = Float64(c + Float64(fma(x, y, Float64(z * Float64(t / 16.0))) - Float64(a * Float64(b / 4.0)))); else tmp = Float64(c + Float64(x * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], Infinity], N[(c + N[(N[(x * y + N[(z * N[(t / 16.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(b / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot y + \frac{z \cdot t}{16}\right) - \frac{a \cdot b}{4} \leq \infty:\\
\;\;\;\;c + \left(\mathsf{fma}\left(x, y, z \cdot \frac{t}{16}\right) - a \cdot \frac{b}{4}\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) < +inf.0Initial program 100.0%
associate-+l-100.0%
*-commutative100.0%
associate-+l-100.0%
fma-define100.0%
*-commutative100.0%
associate-/l*100.0%
associate-/l*100.0%
Simplified100.0%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) Initial program 0.0%
Taylor expanded in a around 0 44.4%
Taylor expanded in t around 0 45.7%
*-commutative45.7%
Simplified45.7%
Final simplification98.1%
(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 96.5%
associate--l+96.5%
fma-define96.9%
associate-/l*96.9%
fma-neg97.7%
distribute-neg-frac297.7%
metadata-eval97.7%
Simplified97.7%
(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 (* x y)))))
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 + (x * y);
}
return tmp;
}
public static 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.POSITIVE_INFINITY) {
tmp = c + t_1;
} else {
tmp = c + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0) tmp = 0 if t_1 <= math.inf: tmp = c + t_1 else: tmp = c + (x * y) 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 + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = ((x * y) + ((z * t) / 16.0)) - ((a * b) / 4.0); tmp = 0.0; if (t_1 <= Inf) tmp = c + t_1; else tmp = c + (x * y); end tmp_2 = 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[(x * y), $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 + x \cdot y\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) < +inf.0Initial program 100.0%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (/.f64 (*.f64 z t) #s(literal 16 binary64))) (/.f64 (*.f64 a b) #s(literal 4 binary64))) Initial program 0.0%
Taylor expanded in a around 0 44.4%
Taylor expanded in t around 0 45.7%
*-commutative45.7%
Simplified45.7%
Final simplification98.1%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* b (* a -0.25))))
(if (<= c -1.05e+161)
c
(if (<= c -2.1e-14)
t_1
(if (<= c 8e-153)
(* x y)
(if (<= c 3.8e+18) (* 0.0625 (* z t)) (if (<= c 1.4e+89) t_1 c)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = b * (a * -0.25);
double tmp;
if (c <= -1.05e+161) {
tmp = c;
} else if (c <= -2.1e-14) {
tmp = t_1;
} else if (c <= 8e-153) {
tmp = x * y;
} else if (c <= 3.8e+18) {
tmp = 0.0625 * (z * t);
} else if (c <= 1.4e+89) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = b * (a * (-0.25d0))
if (c <= (-1.05d+161)) then
tmp = c
else if (c <= (-2.1d-14)) then
tmp = t_1
else if (c <= 8d-153) then
tmp = x * y
else if (c <= 3.8d+18) then
tmp = 0.0625d0 * (z * t)
else if (c <= 1.4d+89) then
tmp = t_1
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 t_1 = b * (a * -0.25);
double tmp;
if (c <= -1.05e+161) {
tmp = c;
} else if (c <= -2.1e-14) {
tmp = t_1;
} else if (c <= 8e-153) {
tmp = x * y;
} else if (c <= 3.8e+18) {
tmp = 0.0625 * (z * t);
} else if (c <= 1.4e+89) {
tmp = t_1;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = b * (a * -0.25) tmp = 0 if c <= -1.05e+161: tmp = c elif c <= -2.1e-14: tmp = t_1 elif c <= 8e-153: tmp = x * y elif c <= 3.8e+18: tmp = 0.0625 * (z * t) elif c <= 1.4e+89: tmp = t_1 else: tmp = c return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(b * Float64(a * -0.25)) tmp = 0.0 if (c <= -1.05e+161) tmp = c; elseif (c <= -2.1e-14) tmp = t_1; elseif (c <= 8e-153) tmp = Float64(x * y); elseif (c <= 3.8e+18) tmp = Float64(0.0625 * Float64(z * t)); elseif (c <= 1.4e+89) tmp = t_1; else tmp = c; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = b * (a * -0.25); tmp = 0.0; if (c <= -1.05e+161) tmp = c; elseif (c <= -2.1e-14) tmp = t_1; elseif (c <= 8e-153) tmp = x * y; elseif (c <= 3.8e+18) tmp = 0.0625 * (z * t); elseif (c <= 1.4e+89) tmp = t_1; else tmp = c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.05e+161], c, If[LessEqual[c, -2.1e-14], t$95$1, If[LessEqual[c, 8e-153], N[(x * y), $MachinePrecision], If[LessEqual[c, 3.8e+18], N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.4e+89], t$95$1, c]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot -0.25\right)\\
\mathbf{if}\;c \leq -1.05 \cdot 10^{+161}:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq -2.1 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq 8 \cdot 10^{-153}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \leq 3.8 \cdot 10^{+18}:\\
\;\;\;\;0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{elif}\;c \leq 1.4 \cdot 10^{+89}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if c < -1.05e161 or 1.3999999999999999e89 < c Initial program 96.8%
Taylor expanded in c around inf 55.7%
if -1.05e161 < c < -2.0999999999999999e-14 or 3.8e18 < c < 1.3999999999999999e89Initial program 96.6%
associate--l+96.6%
fma-define98.3%
associate-/l*98.3%
fma-neg100.0%
distribute-neg-frac2100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in a around inf 66.4%
*-commutative66.4%
associate-*r*66.4%
Simplified66.4%
Taylor expanded in b around inf 66.4%
Taylor expanded in a around inf 47.3%
if -2.0999999999999999e-14 < c < 8.00000000000000031e-153Initial program 95.9%
Taylor expanded in a around 0 73.7%
Taylor expanded in y around inf 67.3%
Taylor expanded in c around 0 65.1%
Taylor expanded in x around inf 50.2%
if 8.00000000000000031e-153 < c < 3.8e18Initial program 96.7%
Taylor expanded in a around 0 77.2%
Taylor expanded in y around inf 68.1%
Taylor expanded in c around 0 58.4%
Taylor expanded in y around 0 44.7%
Final simplification50.9%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* a (* b -0.25)))) (t_2 (+ c (* x y))))
(if (<= x -3.1e+26)
t_2
(if (<= x -1.3e-21)
t_1
(if (<= x -6.8e-266)
(+ c (* t (* z 0.0625)))
(if (<= x 1.9e-33) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (a * (b * -0.25));
double t_2 = c + (x * y);
double tmp;
if (x <= -3.1e+26) {
tmp = t_2;
} else if (x <= -1.3e-21) {
tmp = t_1;
} else if (x <= -6.8e-266) {
tmp = c + (t * (z * 0.0625));
} else if (x <= 1.9e-33) {
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 + (a * (b * (-0.25d0)))
t_2 = c + (x * y)
if (x <= (-3.1d+26)) then
tmp = t_2
else if (x <= (-1.3d-21)) then
tmp = t_1
else if (x <= (-6.8d-266)) then
tmp = c + (t * (z * 0.0625d0))
else if (x <= 1.9d-33) 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 + (a * (b * -0.25));
double t_2 = c + (x * y);
double tmp;
if (x <= -3.1e+26) {
tmp = t_2;
} else if (x <= -1.3e-21) {
tmp = t_1;
} else if (x <= -6.8e-266) {
tmp = c + (t * (z * 0.0625));
} else if (x <= 1.9e-33) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = c + (a * (b * -0.25)) t_2 = c + (x * y) tmp = 0 if x <= -3.1e+26: tmp = t_2 elif x <= -1.3e-21: tmp = t_1 elif x <= -6.8e-266: tmp = c + (t * (z * 0.0625)) elif x <= 1.9e-33: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(a * Float64(b * -0.25))) t_2 = Float64(c + Float64(x * y)) tmp = 0.0 if (x <= -3.1e+26) tmp = t_2; elseif (x <= -1.3e-21) tmp = t_1; elseif (x <= -6.8e-266) tmp = Float64(c + Float64(t * Float64(z * 0.0625))); elseif (x <= 1.9e-33) 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 + (a * (b * -0.25)); t_2 = c + (x * y); tmp = 0.0; if (x <= -3.1e+26) tmp = t_2; elseif (x <= -1.3e-21) tmp = t_1; elseif (x <= -6.8e-266) tmp = c + (t * (z * 0.0625)); elseif (x <= 1.9e-33) 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[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.1e+26], t$95$2, If[LessEqual[x, -1.3e-21], t$95$1, If[LessEqual[x, -6.8e-266], N[(c + N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e-33], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c + a \cdot \left(b \cdot -0.25\right)\\
t_2 := c + x \cdot y\\
\mathbf{if}\;x \leq -3.1 \cdot 10^{+26}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -1.3 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -6.8 \cdot 10^{-266}:\\
\;\;\;\;c + t \cdot \left(z \cdot 0.0625\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-33}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if x < -3.1e26 or 1.89999999999999997e-33 < x Initial program 95.5%
Taylor expanded in a around 0 77.7%
Taylor expanded in t around 0 67.0%
*-commutative67.0%
Simplified67.0%
if -3.1e26 < x < -1.30000000000000009e-21 or -6.7999999999999999e-266 < x < 1.89999999999999997e-33Initial program 95.9%
associate--l+95.9%
fma-define95.9%
associate-/l*95.9%
fma-neg97.3%
distribute-neg-frac297.3%
metadata-eval97.3%
Simplified97.3%
Taylor expanded in a around inf 72.9%
*-commutative72.9%
associate-*r*72.9%
Simplified72.9%
if -1.30000000000000009e-21 < x < -6.7999999999999999e-266Initial program 100.0%
Taylor expanded in a around 0 71.1%
Taylor expanded in x around 0 54.7%
+-commutative54.7%
associate-*r*54.7%
*-commutative54.7%
associate-*r*54.7%
Simplified54.7%
Final simplification66.5%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -5e+47) (not (<= (* a b) 2e+14))) (- (+ 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) <= -5e+47) || !((a * b) <= 2e+14)) {
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) <= (-5d+47)) .or. (.not. ((a * b) <= 2d+14))) 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) <= -5e+47) || !((a * b) <= 2e+14)) {
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) <= -5e+47) or not ((a * b) <= 2e+14): 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) <= -5e+47) || !(Float64(a * b) <= 2e+14)) 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) <= -5e+47) || ~(((a * b) <= 2e+14))) 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], -5e+47], N[Not[LessEqual[N[(a * b), $MachinePrecision], 2e+14]], $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 -5 \cdot 10^{+47} \lor \neg \left(a \cdot b \leq 2 \cdot 10^{+14}\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) < -5.00000000000000022e47 or 2e14 < (*.f64 a b) Initial program 93.4%
Taylor expanded in z around 0 85.3%
if -5.00000000000000022e47 < (*.f64 a b) < 2e14Initial program 99.2%
Taylor expanded in a around 0 97.9%
Final simplification92.0%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* x y) -1e+106) (not (<= (* x y) 4e+189))) (+ (* x y) (* 0.0625 (* z t))) (+ 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) <= -1e+106) || !((x * y) <= 4e+189)) {
tmp = (x * y) + (0.0625 * (z * t));
} 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) <= (-1d+106)) .or. (.not. ((x * y) <= 4d+189))) then
tmp = (x * y) + (0.0625d0 * (z * t))
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) <= -1e+106) || !((x * y) <= 4e+189)) {
tmp = (x * y) + (0.0625 * (z * t));
} else {
tmp = c + (a * (b * -0.25));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((x * y) <= -1e+106) or not ((x * y) <= 4e+189): tmp = (x * y) + (0.0625 * (z * t)) 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) <= -1e+106) || !(Float64(x * y) <= 4e+189)) tmp = Float64(Float64(x * y) + Float64(0.0625 * Float64(z * t))); 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) <= -1e+106) || ~(((x * y) <= 4e+189))) tmp = (x * y) + (0.0625 * (z * t)); 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], -1e+106], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4e+189]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+106} \lor \neg \left(x \cdot y \leq 4 \cdot 10^{+189}\right):\\
\;\;\;\;x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.00000000000000009e106 or 4.0000000000000001e189 < (*.f64 x y) Initial program 92.8%
Taylor expanded in a around 0 87.2%
Taylor expanded in y around inf 87.1%
Taylor expanded in c around 0 85.7%
Taylor expanded in y around 0 85.8%
if -1.00000000000000009e106 < (*.f64 x y) < 4.0000000000000001e189Initial program 97.8%
associate--l+97.8%
fma-define97.9%
associate-/l*97.9%
fma-neg98.9%
distribute-neg-frac298.9%
metadata-eval98.9%
Simplified98.9%
Taylor expanded in a around inf 69.9%
*-commutative69.9%
associate-*r*69.9%
Simplified69.9%
Final simplification74.2%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= a -7.5e+156) (not (<= a 9500000.0))) (+ c (* 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 <= -7.5e+156) || !(a <= 9500000.0)) {
tmp = c + (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 <= (-7.5d+156)) .or. (.not. (a <= 9500000.0d0))) then
tmp = c + (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 <= -7.5e+156) || !(a <= 9500000.0)) {
tmp = c + (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 <= -7.5e+156) or not (a <= 9500000.0): tmp = c + (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 ((a <= -7.5e+156) || !(a <= 9500000.0)) tmp = Float64(c + Float64(a * Float64(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 <= -7.5e+156) || ~((a <= 9500000.0))) tmp = c + (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[a, -7.5e+156], N[Not[LessEqual[a, 9500000.0]], $MachinePrecision]], N[(c + N[(a * N[(b * -0.25), $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 \leq -7.5 \cdot 10^{+156} \lor \neg \left(a \leq 9500000\right):\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + 0.0625 \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if a < -7.50000000000000026e156 or 9.5e6 < a Initial program 93.7%
associate--l+93.7%
fma-define94.8%
associate-/l*94.8%
fma-neg96.9%
distribute-neg-frac296.9%
metadata-eval96.9%
Simplified96.9%
Taylor expanded in a around inf 70.9%
*-commutative70.9%
associate-*r*70.9%
Simplified70.9%
if -7.50000000000000026e156 < a < 9.5e6Initial program 98.1%
Taylor expanded in a around 0 84.3%
Final simplification79.3%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= y -1.06e-130) (not (<= y 1.05e+88))) (+ c (* x y)) (+ c (* a (* b -0.25)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((y <= -1.06e-130) || !(y <= 1.05e+88)) {
tmp = c + (x * y);
} 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 ((y <= (-1.06d-130)) .or. (.not. (y <= 1.05d+88))) then
tmp = c + (x * y)
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 ((y <= -1.06e-130) || !(y <= 1.05e+88)) {
tmp = c + (x * y);
} else {
tmp = c + (a * (b * -0.25));
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (y <= -1.06e-130) or not (y <= 1.05e+88): tmp = c + (x * y) else: tmp = c + (a * (b * -0.25)) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((y <= -1.06e-130) || !(y <= 1.05e+88)) tmp = Float64(c + Float64(x * y)); 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 ((y <= -1.06e-130) || ~((y <= 1.05e+88))) tmp = c + (x * y); else tmp = c + (a * (b * -0.25)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[y, -1.06e-130], N[Not[LessEqual[y, 1.05e+88]], $MachinePrecision]], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(c + N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.06 \cdot 10^{-130} \lor \neg \left(y \leq 1.05 \cdot 10^{+88}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + a \cdot \left(b \cdot -0.25\right)\\
\end{array}
\end{array}
if y < -1.06000000000000004e-130 or 1.05e88 < y Initial program 94.2%
Taylor expanded in a around 0 80.2%
Taylor expanded in t around 0 70.1%
*-commutative70.1%
Simplified70.1%
if -1.06000000000000004e-130 < y < 1.05e88Initial program 98.5%
associate--l+98.5%
fma-define98.5%
associate-/l*98.5%
fma-neg99.3%
distribute-neg-frac299.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in a around inf 66.4%
*-commutative66.4%
associate-*r*66.4%
Simplified66.4%
Final simplification68.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= a -5.7e+128) (not (<= a 9500000.0))) (* b (* a -0.25)) (+ c (* x y))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((a <= -5.7e+128) || !(a <= 9500000.0)) {
tmp = b * (a * -0.25);
} else {
tmp = c + (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 ((a <= (-5.7d+128)) .or. (.not. (a <= 9500000.0d0))) then
tmp = b * (a * (-0.25d0))
else
tmp = c + (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 ((a <= -5.7e+128) || !(a <= 9500000.0)) {
tmp = b * (a * -0.25);
} else {
tmp = c + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (a <= -5.7e+128) or not (a <= 9500000.0): tmp = b * (a * -0.25) else: tmp = c + (x * y) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((a <= -5.7e+128) || !(a <= 9500000.0)) tmp = Float64(b * Float64(a * -0.25)); else tmp = Float64(c + Float64(x * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((a <= -5.7e+128) || ~((a <= 9500000.0))) tmp = b * (a * -0.25); else tmp = c + (x * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[a, -5.7e+128], N[Not[LessEqual[a, 9500000.0]], $MachinePrecision]], N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.7 \cdot 10^{+128} \lor \neg \left(a \leq 9500000\right):\\
\;\;\;\;b \cdot \left(a \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if a < -5.70000000000000024e128 or 9.5e6 < a Initial program 94.4%
associate--l+94.4%
fma-define95.4%
associate-/l*95.4%
fma-neg97.2%
distribute-neg-frac297.2%
metadata-eval97.2%
Simplified97.2%
Taylor expanded in a around inf 68.6%
*-commutative68.6%
associate-*r*68.6%
Simplified68.6%
Taylor expanded in b around inf 61.3%
Taylor expanded in a around inf 50.3%
if -5.70000000000000024e128 < a < 9.5e6Initial program 98.0%
Taylor expanded in a around 0 86.3%
Taylor expanded in t around 0 65.9%
*-commutative65.9%
Simplified65.9%
Final simplification59.3%
(FPCore (x y z t a b c) :precision binary64 (if (<= c -1.5e+135) c (if (<= c 2.6e+61) (* x y) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (c <= -1.5e+135) {
tmp = c;
} else if (c <= 2.6e+61) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if (c <= (-1.5d+135)) then
tmp = c
else if (c <= 2.6d+61) then
tmp = x * y
else
tmp = c
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (c <= -1.5e+135) {
tmp = c;
} else if (c <= 2.6e+61) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if c <= -1.5e+135: tmp = c elif c <= 2.6e+61: tmp = x * y else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (c <= -1.5e+135) tmp = c; elseif (c <= 2.6e+61) tmp = Float64(x * y); else tmp = c; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if (c <= -1.5e+135) tmp = c; elseif (c <= 2.6e+61) tmp = x * y; else tmp = c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[c, -1.5e+135], c, If[LessEqual[c, 2.6e+61], N[(x * y), $MachinePrecision], c]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.5 \cdot 10^{+135}:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq 2.6 \cdot 10^{+61}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if c < -1.5e135 or 2.59999999999999973e61 < c Initial program 97.3%
Taylor expanded in c around inf 51.5%
if -1.5e135 < c < 2.59999999999999973e61Initial program 95.9%
Taylor expanded in a around 0 68.6%
Taylor expanded in y around inf 61.6%
Taylor expanded in c around 0 54.3%
Taylor expanded in x around inf 38.3%
Final simplification44.0%
(FPCore (x y z t a b c) :precision binary64 c)
double code(double x, double y, double z, double t, double a, double b, double c) {
return c;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
code = c
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c;
}
def code(x, y, z, t, a, b, c): return c
function code(x, y, z, t, a, b, c) return c end
function tmp = code(x, y, z, t, a, b, c) tmp = c; end
code[x_, y_, z_, t_, a_, b_, c_] := c
\begin{array}{l}
\\
c
\end{array}
Initial program 96.5%
Taylor expanded in c around inf 27.3%
herbie shell --seed 2024137
(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))