
(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 (fma t (/ z 16.0) (fma x y (- c (* b (/ a 4.0))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return fma(t, (z / 16.0), fma(x, y, (c - (b * (a / 4.0)))));
}
function code(x, y, z, t, a, b, c) return fma(t, Float64(z / 16.0), fma(x, y, Float64(c - Float64(b * Float64(a / 4.0))))) end
code[x_, y_, z_, t_, a_, b_, c_] := N[(t * N[(z / 16.0), $MachinePrecision] + N[(x * y + N[(c - N[(b * N[(a / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(t, \frac{z}{16}, \mathsf{fma}\left(x, y, c - b \cdot \frac{a}{4}\right)\right)
\end{array}
Initial program 97.7%
associate-+l-97.7%
+-commutative97.7%
associate--l+97.7%
associate-*l/97.7%
*-commutative97.7%
fma-def98.8%
fma-neg99.2%
neg-sub099.2%
associate-+l-99.2%
neg-sub099.2%
+-commutative99.2%
unsub-neg99.2%
*-commutative99.2%
associate-*r/99.2%
Simplified99.2%
Final simplification99.2%
(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(z / Float64(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[(z / N[(16.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(c - N[(a / N[(4.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \frac{z}{\frac{16}{t}}\right) + \left(c - \frac{a}{\frac{4}{b}}\right)
\end{array}
Initial program 97.7%
associate-+l-97.7%
sub-neg97.7%
neg-mul-197.7%
metadata-eval97.7%
metadata-eval97.7%
cancel-sign-sub-inv97.7%
fma-def98.0%
associate-/l*98.0%
metadata-eval98.0%
*-lft-identity98.0%
associate-/l*98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (- (* (* t z) 0.0625) (* (* b a) 0.25))))
(if (<= (* b a) -2e+87)
t_1
(if (<= (* b a) 2e-45)
(+ c (* x y))
(if (<= (* b a) 5e+164) (+ c (* z (* t 0.0625))) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = ((t * z) * 0.0625) - ((b * a) * 0.25);
double tmp;
if ((b * a) <= -2e+87) {
tmp = t_1;
} else if ((b * a) <= 2e-45) {
tmp = c + (x * y);
} else if ((b * a) <= 5e+164) {
tmp = c + (z * (t * 0.0625));
} 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 = ((t * z) * 0.0625d0) - ((b * a) * 0.25d0)
if ((b * a) <= (-2d+87)) then
tmp = t_1
else if ((b * a) <= 2d-45) then
tmp = c + (x * y)
else if ((b * a) <= 5d+164) then
tmp = c + (z * (t * 0.0625d0))
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 = ((t * z) * 0.0625) - ((b * a) * 0.25);
double tmp;
if ((b * a) <= -2e+87) {
tmp = t_1;
} else if ((b * a) <= 2e-45) {
tmp = c + (x * y);
} else if ((b * a) <= 5e+164) {
tmp = c + (z * (t * 0.0625));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = ((t * z) * 0.0625) - ((b * a) * 0.25) tmp = 0 if (b * a) <= -2e+87: tmp = t_1 elif (b * a) <= 2e-45: tmp = c + (x * y) elif (b * a) <= 5e+164: tmp = c + (z * (t * 0.0625)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(Float64(t * z) * 0.0625) - Float64(Float64(b * a) * 0.25)) tmp = 0.0 if (Float64(b * a) <= -2e+87) tmp = t_1; elseif (Float64(b * a) <= 2e-45) tmp = Float64(c + Float64(x * y)); elseif (Float64(b * a) <= 5e+164) tmp = Float64(c + Float64(z * Float64(t * 0.0625))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = ((t * z) * 0.0625) - ((b * a) * 0.25); tmp = 0.0; if ((b * a) <= -2e+87) tmp = t_1; elseif ((b * a) <= 2e-45) tmp = c + (x * y); elseif ((b * a) <= 5e+164) tmp = c + (z * (t * 0.0625)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(N[(t * z), $MachinePrecision] * 0.0625), $MachinePrecision] - N[(N[(b * a), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -2e+87], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], 2e-45], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 5e+164], N[(c + N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t \cdot z\right) \cdot 0.0625 - \left(b \cdot a\right) \cdot 0.25\\
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{-45}:\\
\;\;\;\;c + x \cdot y\\
\mathbf{elif}\;b \cdot a \leq 5 \cdot 10^{+164}:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.9999999999999999e87 or 4.9999999999999995e164 < (*.f64 a b) Initial program 94.0%
associate-+l-94.0%
sub-neg94.0%
neg-mul-194.0%
metadata-eval94.0%
metadata-eval94.0%
cancel-sign-sub-inv94.0%
fma-def94.0%
associate-/l*94.0%
metadata-eval94.0%
*-lft-identity94.0%
associate-/l*93.9%
Simplified93.9%
Taylor expanded in x around 0 89.7%
Taylor expanded in c around 0 85.6%
if -1.9999999999999999e87 < (*.f64 a b) < 1.99999999999999997e-45Initial program 99.3%
Taylor expanded in x around inf 72.4%
if 1.99999999999999997e-45 < (*.f64 a b) < 4.9999999999999995e164Initial program 97.4%
Taylor expanded in z around inf 66.6%
*-commutative66.6%
associate-*r*66.6%
*-commutative66.6%
associate-*l*66.6%
Simplified66.6%
Final simplification74.9%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* z (* t 0.0625))))
(if (<= x -1.8e+95)
(* x y)
(if (<= x -5.4e+19)
t_1
(if (<= x -9e-23)
(* (* b a) -0.25)
(if (<= x -1.02e-107)
t_1
(if (<= x 2e-118) c (if (<= x 4.6e-32) t_1 (* x y)))))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = z * (t * 0.0625);
double tmp;
if (x <= -1.8e+95) {
tmp = x * y;
} else if (x <= -5.4e+19) {
tmp = t_1;
} else if (x <= -9e-23) {
tmp = (b * a) * -0.25;
} else if (x <= -1.02e-107) {
tmp = t_1;
} else if (x <= 2e-118) {
tmp = c;
} else if (x <= 4.6e-32) {
tmp = t_1;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = z * (t * 0.0625d0)
if (x <= (-1.8d+95)) then
tmp = x * y
else if (x <= (-5.4d+19)) then
tmp = t_1
else if (x <= (-9d-23)) then
tmp = (b * a) * (-0.25d0)
else if (x <= (-1.02d-107)) then
tmp = t_1
else if (x <= 2d-118) then
tmp = c
else if (x <= 4.6d-32) then
tmp = t_1
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = z * (t * 0.0625);
double tmp;
if (x <= -1.8e+95) {
tmp = x * y;
} else if (x <= -5.4e+19) {
tmp = t_1;
} else if (x <= -9e-23) {
tmp = (b * a) * -0.25;
} else if (x <= -1.02e-107) {
tmp = t_1;
} else if (x <= 2e-118) {
tmp = c;
} else if (x <= 4.6e-32) {
tmp = t_1;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = z * (t * 0.0625) tmp = 0 if x <= -1.8e+95: tmp = x * y elif x <= -5.4e+19: tmp = t_1 elif x <= -9e-23: tmp = (b * a) * -0.25 elif x <= -1.02e-107: tmp = t_1 elif x <= 2e-118: tmp = c elif x <= 4.6e-32: tmp = t_1 else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(z * Float64(t * 0.0625)) tmp = 0.0 if (x <= -1.8e+95) tmp = Float64(x * y); elseif (x <= -5.4e+19) tmp = t_1; elseif (x <= -9e-23) tmp = Float64(Float64(b * a) * -0.25); elseif (x <= -1.02e-107) tmp = t_1; elseif (x <= 2e-118) tmp = c; elseif (x <= 4.6e-32) tmp = t_1; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = z * (t * 0.0625); tmp = 0.0; if (x <= -1.8e+95) tmp = x * y; elseif (x <= -5.4e+19) tmp = t_1; elseif (x <= -9e-23) tmp = (b * a) * -0.25; elseif (x <= -1.02e-107) tmp = t_1; elseif (x <= 2e-118) tmp = c; elseif (x <= 4.6e-32) tmp = t_1; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.8e+95], N[(x * y), $MachinePrecision], If[LessEqual[x, -5.4e+19], t$95$1, If[LessEqual[x, -9e-23], N[(N[(b * a), $MachinePrecision] * -0.25), $MachinePrecision], If[LessEqual[x, -1.02e-107], t$95$1, If[LessEqual[x, 2e-118], c, If[LessEqual[x, 4.6e-32], t$95$1, N[(x * y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+95}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -5.4 \cdot 10^{+19}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -9 \cdot 10^{-23}:\\
\;\;\;\;\left(b \cdot a\right) \cdot -0.25\\
\mathbf{elif}\;x \leq -1.02 \cdot 10^{-107}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-118}:\\
\;\;\;\;c\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -1.79999999999999989e95 or 4.6000000000000001e-32 < x Initial program 96.0%
Taylor expanded in x around inf 68.9%
Taylor expanded in y around inf 51.7%
if -1.79999999999999989e95 < x < -5.4e19 or -8.9999999999999995e-23 < x < -1.02e-107 or 1.99999999999999997e-118 < x < 4.6000000000000001e-32Initial program 100.0%
Taylor expanded in z around inf 66.5%
*-commutative66.5%
associate-*r*66.5%
*-commutative66.5%
associate-*l*66.5%
Simplified66.5%
Taylor expanded in z around inf 45.9%
associate-*r*45.9%
*-commutative45.9%
Simplified45.9%
if -5.4e19 < x < -8.9999999999999995e-23Initial program 83.3%
associate-+l-83.3%
sub-neg83.3%
neg-mul-183.3%
metadata-eval83.3%
metadata-eval83.3%
cancel-sign-sub-inv83.3%
fma-def83.3%
associate-/l*83.3%
metadata-eval83.3%
*-lft-identity83.3%
associate-/l*83.1%
Simplified83.1%
Taylor expanded in x around 0 67.0%
Taylor expanded in a around inf 67.4%
*-commutative67.4%
Simplified67.4%
if -1.02e-107 < x < 1.99999999999999997e-118Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
neg-mul-1100.0%
metadata-eval100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
fma-def100.0%
associate-/l*99.9%
metadata-eval99.9%
*-lft-identity99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in c around inf 41.7%
Final simplification47.9%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= y -1.5e-72) (not (<= y 1.4e+175))) (+ c (* x y)) (- (+ c (* (* t z) 0.0625)) (* (* b a) 0.25))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((y <= -1.5e-72) || !(y <= 1.4e+175)) {
tmp = c + (x * y);
} else {
tmp = (c + ((t * z) * 0.0625)) - ((b * a) * 0.25);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: tmp
if ((y <= (-1.5d-72)) .or. (.not. (y <= 1.4d+175))) then
tmp = c + (x * y)
else
tmp = (c + ((t * z) * 0.0625d0)) - ((b * a) * 0.25d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((y <= -1.5e-72) || !(y <= 1.4e+175)) {
tmp = c + (x * y);
} else {
tmp = (c + ((t * z) * 0.0625)) - ((b * a) * 0.25);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if (y <= -1.5e-72) or not (y <= 1.4e+175): tmp = c + (x * y) else: tmp = (c + ((t * z) * 0.0625)) - ((b * a) * 0.25) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((y <= -1.5e-72) || !(y <= 1.4e+175)) tmp = Float64(c + Float64(x * y)); else tmp = Float64(Float64(c + Float64(Float64(t * z) * 0.0625)) - Float64(Float64(b * a) * 0.25)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) tmp = 0.0; if ((y <= -1.5e-72) || ~((y <= 1.4e+175))) tmp = c + (x * y); else tmp = (c + ((t * z) * 0.0625)) - ((b * a) * 0.25); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[y, -1.5e-72], N[Not[LessEqual[y, 1.4e+175]], $MachinePrecision]], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(c + N[(N[(t * z), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision] - N[(N[(b * a), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{-72} \lor \neg \left(y \leq 1.4 \cdot 10^{+175}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(c + \left(t \cdot z\right) \cdot 0.0625\right) - \left(b \cdot a\right) \cdot 0.25\\
\end{array}
\end{array}
if y < -1.5e-72 or 1.4000000000000001e175 < y Initial program 97.5%
Taylor expanded in x around inf 66.0%
if -1.5e-72 < y < 1.4000000000000001e175Initial program 97.8%
associate-+l-97.8%
sub-neg97.8%
neg-mul-197.8%
metadata-eval97.8%
metadata-eval97.8%
cancel-sign-sub-inv97.8%
fma-def98.5%
associate-/l*98.5%
metadata-eval98.5%
*-lft-identity98.5%
associate-/l*98.4%
Simplified98.4%
Taylor expanded in x around 0 86.2%
Final simplification76.5%
(FPCore (x y z t a b c) :precision binary64 (+ c (- (+ (/ (* t z) 16.0) (* x y)) (/ (* b a) 4.0))))
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + ((((t * z) / 16.0) + (x * y)) - ((b * a) / 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 + ((((t * z) / 16.0d0) + (x * y)) - ((b * a) / 4.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c + ((((t * z) / 16.0) + (x * y)) - ((b * a) / 4.0));
}
def code(x, y, z, t, a, b, c): return c + ((((t * z) / 16.0) + (x * y)) - ((b * a) / 4.0))
function code(x, y, z, t, a, b, c) return Float64(c + Float64(Float64(Float64(Float64(t * z) / 16.0) + Float64(x * y)) - Float64(Float64(b * a) / 4.0))) end
function tmp = code(x, y, z, t, a, b, c) tmp = c + ((((t * z) / 16.0) + (x * y)) - ((b * a) / 4.0)); end
code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(N[(N[(N[(t * z), $MachinePrecision] / 16.0), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(b * a), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c + \left(\left(\frac{t \cdot z}{16} + x \cdot y\right) - \frac{b \cdot a}{4}\right)
\end{array}
Initial program 97.7%
Final simplification97.7%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* b a) -2e+87) (not (<= (* b a) 2e+138))) (+ c (* 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 (((b * a) <= -2e+87) || !((b * a) <= 2e+138)) {
tmp = c + (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 (((b * a) <= (-2d+87)) .or. (.not. ((b * a) <= 2d+138))) then
tmp = c + (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 (((b * a) <= -2e+87) || !((b * a) <= 2e+138)) {
tmp = c + (b * (a * -0.25));
} else {
tmp = c + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((b * a) <= -2e+87) or not ((b * a) <= 2e+138): tmp = c + (b * (a * -0.25)) else: tmp = c + (x * y) return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(b * a) <= -2e+87) || !(Float64(b * a) <= 2e+138)) tmp = Float64(c + 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 (((b * a) <= -2e+87) || ~(((b * a) <= 2e+138))) tmp = c + (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[N[(b * a), $MachinePrecision], -2e+87], N[Not[LessEqual[N[(b * a), $MachinePrecision], 2e+138]], $MachinePrecision]], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+87} \lor \neg \left(b \cdot a \leq 2 \cdot 10^{+138}\right):\\
\;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -1.9999999999999999e87 or 2.0000000000000001e138 < (*.f64 a b) Initial program 94.4%
Taylor expanded in a around inf 74.0%
*-commutative74.0%
*-commutative74.0%
associate-*r*74.0%
Simplified74.0%
if -1.9999999999999999e87 < (*.f64 a b) < 2.0000000000000001e138Initial program 98.9%
Taylor expanded in x around inf 69.2%
Final simplification70.5%
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* z (* t 0.0625))))
(if (<= x -1.15e+95)
(* x y)
(if (<= x -2.4e-102)
t_1
(if (<= x 5.5e-120) c (if (<= x 1.55e-32) t_1 (* x y)))))))
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = z * (t * 0.0625);
double tmp;
if (x <= -1.15e+95) {
tmp = x * y;
} else if (x <= -2.4e-102) {
tmp = t_1;
} else if (x <= 5.5e-120) {
tmp = c;
} else if (x <= 1.55e-32) {
tmp = t_1;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = z * (t * 0.0625d0)
if (x <= (-1.15d+95)) then
tmp = x * y
else if (x <= (-2.4d-102)) then
tmp = t_1
else if (x <= 5.5d-120) then
tmp = c
else if (x <= 1.55d-32) then
tmp = t_1
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = z * (t * 0.0625);
double tmp;
if (x <= -1.15e+95) {
tmp = x * y;
} else if (x <= -2.4e-102) {
tmp = t_1;
} else if (x <= 5.5e-120) {
tmp = c;
} else if (x <= 1.55e-32) {
tmp = t_1;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c): t_1 = z * (t * 0.0625) tmp = 0 if x <= -1.15e+95: tmp = x * y elif x <= -2.4e-102: tmp = t_1 elif x <= 5.5e-120: tmp = c elif x <= 1.55e-32: tmp = t_1 else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c) t_1 = Float64(z * Float64(t * 0.0625)) tmp = 0.0 if (x <= -1.15e+95) tmp = Float64(x * y); elseif (x <= -2.4e-102) tmp = t_1; elseif (x <= 5.5e-120) tmp = c; elseif (x <= 1.55e-32) tmp = t_1; else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c) t_1 = z * (t * 0.0625); tmp = 0.0; if (x <= -1.15e+95) tmp = x * y; elseif (x <= -2.4e-102) tmp = t_1; elseif (x <= 5.5e-120) tmp = c; elseif (x <= 1.55e-32) tmp = t_1; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.15e+95], N[(x * y), $MachinePrecision], If[LessEqual[x, -2.4e-102], t$95$1, If[LessEqual[x, 5.5e-120], c, If[LessEqual[x, 1.55e-32], t$95$1, N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(t \cdot 0.0625\right)\\
\mathbf{if}\;x \leq -1.15 \cdot 10^{+95}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -2.4 \cdot 10^{-102}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-120}:\\
\;\;\;\;c\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -1.14999999999999999e95 or 1.55000000000000005e-32 < x Initial program 96.0%
Taylor expanded in x around inf 68.9%
Taylor expanded in y around inf 51.7%
if -1.14999999999999999e95 < x < -2.4e-102 or 5.5000000000000001e-120 < x < 1.55000000000000005e-32Initial program 98.0%
Taylor expanded in z around inf 62.6%
*-commutative62.6%
associate-*r*62.6%
*-commutative62.6%
associate-*l*62.6%
Simplified62.6%
Taylor expanded in z around inf 40.7%
associate-*r*40.7%
*-commutative40.7%
Simplified40.7%
if -2.4e-102 < x < 5.5000000000000001e-120Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
neg-mul-1100.0%
metadata-eval100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
fma-def100.0%
associate-/l*99.9%
metadata-eval99.9%
*-lft-identity99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in c around inf 40.4%
Final simplification46.0%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= (* b a) -2.3e+87) (not (<= (* b a) 2.4e+165))) (* (* 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 (((b * a) <= -2.3e+87) || !((b * a) <= 2.4e+165)) {
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 (((b * a) <= (-2.3d+87)) .or. (.not. ((b * a) <= 2.4d+165))) 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 (((b * a) <= -2.3e+87) || !((b * a) <= 2.4e+165)) {
tmp = (b * a) * -0.25;
} else {
tmp = c + (x * y);
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if ((b * a) <= -2.3e+87) or not ((b * a) <= 2.4e+165): 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 ((Float64(b * a) <= -2.3e+87) || !(Float64(b * a) <= 2.4e+165)) tmp = Float64(Float64(b * 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 (((b * a) <= -2.3e+87) || ~(((b * a) <= 2.4e+165))) 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[N[(b * a), $MachinePrecision], -2.3e+87], N[Not[LessEqual[N[(b * a), $MachinePrecision], 2.4e+165]], $MachinePrecision]], N[(N[(b * a), $MachinePrecision] * -0.25), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -2.3 \cdot 10^{+87} \lor \neg \left(b \cdot a \leq 2.4 \cdot 10^{+165}\right):\\
\;\;\;\;\left(b \cdot a\right) \cdot -0.25\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if (*.f64 a b) < -2.3000000000000002e87 or 2.4e165 < (*.f64 a b) Initial program 94.0%
associate-+l-94.0%
sub-neg94.0%
neg-mul-194.0%
metadata-eval94.0%
metadata-eval94.0%
cancel-sign-sub-inv94.0%
fma-def94.0%
associate-/l*94.0%
metadata-eval94.0%
*-lft-identity94.0%
associate-/l*93.9%
Simplified93.9%
Taylor expanded in x around 0 89.7%
Taylor expanded in a around inf 69.7%
*-commutative69.7%
Simplified69.7%
if -2.3000000000000002e87 < (*.f64 a b) < 2.4e165Initial program 98.9%
Taylor expanded in x around inf 68.9%
Final simplification69.1%
(FPCore (x y z t a b c) :precision binary64 (if (or (<= x -1.25e+95) (not (<= x 5.5e-33))) (+ 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 <= -1.25e+95) || !(x <= 5.5e-33)) {
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 <= (-1.25d+95)) .or. (.not. (x <= 5.5d-33))) 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 <= -1.25e+95) || !(x <= 5.5e-33)) {
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 <= -1.25e+95) or not (x <= 5.5e-33): 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 ((x <= -1.25e+95) || !(x <= 5.5e-33)) 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 <= -1.25e+95) || ~((x <= 5.5e-33))) 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[x, -1.25e+95], N[Not[LessEqual[x, 5.5e-33]], $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 \leq -1.25 \cdot 10^{+95} \lor \neg \left(x \leq 5.5 \cdot 10^{-33}\right):\\
\;\;\;\;c + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c + z \cdot \left(t \cdot 0.0625\right)\\
\end{array}
\end{array}
if x < -1.25000000000000006e95 or 5.5e-33 < x Initial program 96.0%
Taylor expanded in x around inf 69.2%
if -1.25000000000000006e95 < x < 5.5e-33Initial program 99.2%
Taylor expanded in z around inf 70.6%
*-commutative70.6%
associate-*r*70.6%
*-commutative70.6%
associate-*l*70.6%
Simplified70.6%
Final simplification69.9%
(FPCore (x y z t a b c) :precision binary64 (if (<= c -3.5e+85) c (if (<= c 2.6e+45) (* x y) c)))
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (c <= -3.5e+85) {
tmp = c;
} else if (c <= 2.6e+45) {
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 <= (-3.5d+85)) then
tmp = c
else if (c <= 2.6d+45) 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 <= -3.5e+85) {
tmp = c;
} else if (c <= 2.6e+45) {
tmp = x * y;
} else {
tmp = c;
}
return tmp;
}
def code(x, y, z, t, a, b, c): tmp = 0 if c <= -3.5e+85: tmp = c elif c <= 2.6e+45: tmp = x * y else: tmp = c return tmp
function code(x, y, z, t, a, b, c) tmp = 0.0 if (c <= -3.5e+85) tmp = c; elseif (c <= 2.6e+45) 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 <= -3.5e+85) tmp = c; elseif (c <= 2.6e+45) tmp = x * y; else tmp = c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[c, -3.5e+85], c, If[LessEqual[c, 2.6e+45], N[(x * y), $MachinePrecision], c]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -3.5 \cdot 10^{+85}:\\
\;\;\;\;c\\
\mathbf{elif}\;c \leq 2.6 \cdot 10^{+45}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c\\
\end{array}
\end{array}
if c < -3.50000000000000005e85 or 2.60000000000000007e45 < c Initial program 98.2%
associate-+l-98.2%
sub-neg98.2%
neg-mul-198.2%
metadata-eval98.2%
metadata-eval98.2%
cancel-sign-sub-inv98.2%
fma-def98.2%
associate-/l*98.2%
metadata-eval98.2%
*-lft-identity98.2%
associate-/l*98.2%
Simplified98.2%
Taylor expanded in c around inf 54.6%
if -3.50000000000000005e85 < c < 2.60000000000000007e45Initial program 97.2%
Taylor expanded in x around inf 46.7%
Taylor expanded in y around inf 43.2%
Final simplification48.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.7%
associate-+l-97.7%
sub-neg97.7%
neg-mul-197.7%
metadata-eval97.7%
metadata-eval97.7%
cancel-sign-sub-inv97.7%
fma-def98.0%
associate-/l*98.0%
metadata-eval98.0%
*-lft-identity98.0%
associate-/l*98.0%
Simplified98.0%
Taylor expanded in c around inf 27.1%
Final simplification27.1%
herbie shell --seed 2023199
(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))