
(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 17 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}
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (+ (fma x y (/ z (/ 16.0 t))) (- c (/ a (/ 4.0 b)))))
assert(a < 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)));
}
a, b = sort([a, 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
NOTE: a and b should be sorted in increasing order before calling this function. 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}
[a, b] = \mathsf{sort}([a, b])\\
\\
\mathsf{fma}\left(x, y, \frac{z}{\frac{16}{t}}\right) + \left(c - \frac{a}{\frac{4}{b}}\right)
\end{array}
Initial program 98.0%
associate-+l-98.0%
sub-neg98.0%
neg-mul-198.0%
metadata-eval98.0%
metadata-eval98.0%
cancel-sign-sub-inv98.0%
fma-def99.2%
associate-/l*99.1%
metadata-eval99.1%
*-lft-identity99.1%
associate-/l*99.1%
Simplified99.1%
Final simplification99.1%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* z t) 0.0625))
(t_2 (+ c t_1))
(t_3 (+ (* x y) t_1))
(t_4 (- (* x y) (* (* a b) 0.25))))
(if (<= (* a b) -5e+104)
t_4
(if (<= (* a b) -1e-94)
(+ c (* x y))
(if (<= (* a b) 2e-281)
t_3
(if (<= (* a b) 4e-116)
t_2
(if (<= (* a b) 5e-32) t_3 (if (<= (* a b) 1e+20) t_2 t_4))))))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (z * t) * 0.0625;
double t_2 = c + t_1;
double t_3 = (x * y) + t_1;
double t_4 = (x * y) - ((a * b) * 0.25);
double tmp;
if ((a * b) <= -5e+104) {
tmp = t_4;
} else if ((a * b) <= -1e-94) {
tmp = c + (x * y);
} else if ((a * b) <= 2e-281) {
tmp = t_3;
} else if ((a * b) <= 4e-116) {
tmp = t_2;
} else if ((a * b) <= 5e-32) {
tmp = t_3;
} else if ((a * b) <= 1e+20) {
tmp = t_2;
} else {
tmp = t_4;
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
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) :: t_4
real(8) :: tmp
t_1 = (z * t) * 0.0625d0
t_2 = c + t_1
t_3 = (x * y) + t_1
t_4 = (x * y) - ((a * b) * 0.25d0)
if ((a * b) <= (-5d+104)) then
tmp = t_4
else if ((a * b) <= (-1d-94)) then
tmp = c + (x * y)
else if ((a * b) <= 2d-281) then
tmp = t_3
else if ((a * b) <= 4d-116) then
tmp = t_2
else if ((a * b) <= 5d-32) then
tmp = t_3
else if ((a * b) <= 1d+20) then
tmp = t_2
else
tmp = t_4
end if
code = tmp
end function
assert a < b;
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 t_2 = c + t_1;
double t_3 = (x * y) + t_1;
double t_4 = (x * y) - ((a * b) * 0.25);
double tmp;
if ((a * b) <= -5e+104) {
tmp = t_4;
} else if ((a * b) <= -1e-94) {
tmp = c + (x * y);
} else if ((a * b) <= 2e-281) {
tmp = t_3;
} else if ((a * b) <= 4e-116) {
tmp = t_2;
} else if ((a * b) <= 5e-32) {
tmp = t_3;
} else if ((a * b) <= 1e+20) {
tmp = t_2;
} else {
tmp = t_4;
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): t_1 = (z * t) * 0.0625 t_2 = c + t_1 t_3 = (x * y) + t_1 t_4 = (x * y) - ((a * b) * 0.25) tmp = 0 if (a * b) <= -5e+104: tmp = t_4 elif (a * b) <= -1e-94: tmp = c + (x * y) elif (a * b) <= 2e-281: tmp = t_3 elif (a * b) <= 4e-116: tmp = t_2 elif (a * b) <= 5e-32: tmp = t_3 elif (a * b) <= 1e+20: tmp = t_2 else: tmp = t_4 return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(z * t) * 0.0625) t_2 = Float64(c + t_1) t_3 = Float64(Float64(x * y) + t_1) t_4 = Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25)) tmp = 0.0 if (Float64(a * b) <= -5e+104) tmp = t_4; elseif (Float64(a * b) <= -1e-94) tmp = Float64(c + Float64(x * y)); elseif (Float64(a * b) <= 2e-281) tmp = t_3; elseif (Float64(a * b) <= 4e-116) tmp = t_2; elseif (Float64(a * b) <= 5e-32) tmp = t_3; elseif (Float64(a * b) <= 1e+20) tmp = t_2; else tmp = t_4; end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (z * t) * 0.0625;
t_2 = c + t_1;
t_3 = (x * y) + t_1;
t_4 = (x * y) - ((a * b) * 0.25);
tmp = 0.0;
if ((a * b) <= -5e+104)
tmp = t_4;
elseif ((a * b) <= -1e-94)
tmp = c + (x * y);
elseif ((a * b) <= 2e-281)
tmp = t_3;
elseif ((a * b) <= 4e-116)
tmp = t_2;
elseif ((a * b) <= 5e-32)
tmp = t_3;
elseif ((a * b) <= 1e+20)
tmp = t_2;
else
tmp = t_4;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, Block[{t$95$2 = N[(c + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * y), $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+104], t$95$4, If[LessEqual[N[(a * b), $MachinePrecision], -1e-94], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2e-281], t$95$3, If[LessEqual[N[(a * b), $MachinePrecision], 4e-116], t$95$2, If[LessEqual[N[(a * b), $MachinePrecision], 5e-32], t$95$3, If[LessEqual[N[(a * b), $MachinePrecision], 1e+20], t$95$2, t$95$4]]]]]]]]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot t\right) \cdot 0.0625\\
t_2 := c + t_1\\
t_3 := x \cdot y + t_1\\
t_4 := x \cdot y - \left(a \cdot b\right) \cdot 0.25\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+104}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;a \cdot b \leq -1 \cdot 10^{-94}:\\
\;\;\;\;c + x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 2 \cdot 10^{-281}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \cdot b \leq 4 \cdot 10^{-116}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{-32}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;a \cdot b \leq 10^{+20}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
\end{array}
if (*.f64 a b) < -4.9999999999999997e104 or 1e20 < (*.f64 a b) Initial program 98.1%
Taylor expanded in z around 0 86.6%
Taylor expanded in c around 0 82.4%
if -4.9999999999999997e104 < (*.f64 a b) < -9.9999999999999996e-95Initial program 97.5%
Taylor expanded in a around 0 90.2%
Taylor expanded in t around 0 76.2%
if -9.9999999999999996e-95 < (*.f64 a b) < 2e-281 or 4e-116 < (*.f64 a b) < 5e-32Initial program 98.6%
associate-+l-98.6%
sub-neg98.6%
neg-mul-198.6%
metadata-eval98.6%
metadata-eval98.6%
cancel-sign-sub-inv98.6%
fma-def100.0%
associate-/l*99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-/l*99.8%
Simplified99.8%
fma-udef98.5%
associate-/l*98.6%
+-commutative98.6%
div-inv98.6%
metadata-eval98.6%
Applied egg-rr98.6%
Taylor expanded in a around inf 79.6%
Taylor expanded in a around 0 77.3%
if 2e-281 < (*.f64 a b) < 4e-116 or 5e-32 < (*.f64 a b) < 1e20Initial program 97.3%
Taylor expanded in a around 0 91.5%
Taylor expanded in y around 0 83.8%
Final simplification80.2%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* a b) 0.25)))
(if (or (<= (* z t) -1e+111) (not (<= (* z t) 1e-33)))
(- (+ (* x y) (* (* z t) 0.0625)) t_1)
(- (+ c (* x y)) t_1))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) * 0.25;
double tmp;
if (((z * t) <= -1e+111) || !((z * t) <= 1e-33)) {
tmp = ((x * y) + ((z * t) * 0.0625)) - t_1;
} else {
tmp = (c + (x * y)) - t_1;
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = (a * b) * 0.25d0
if (((z * t) <= (-1d+111)) .or. (.not. ((z * t) <= 1d-33))) then
tmp = ((x * y) + ((z * t) * 0.0625d0)) - t_1
else
tmp = (c + (x * y)) - t_1
end if
code = tmp
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) * 0.25;
double tmp;
if (((z * t) <= -1e+111) || !((z * t) <= 1e-33)) {
tmp = ((x * y) + ((z * t) * 0.0625)) - t_1;
} else {
tmp = (c + (x * y)) - t_1;
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): t_1 = (a * b) * 0.25 tmp = 0 if ((z * t) <= -1e+111) or not ((z * t) <= 1e-33): tmp = ((x * y) + ((z * t) * 0.0625)) - t_1 else: tmp = (c + (x * y)) - t_1 return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) * 0.25) tmp = 0.0 if ((Float64(z * t) <= -1e+111) || !(Float64(z * t) <= 1e-33)) tmp = Float64(Float64(Float64(x * y) + Float64(Float64(z * t) * 0.0625)) - t_1); else tmp = Float64(Float64(c + Float64(x * y)) - t_1); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (a * b) * 0.25;
tmp = 0.0;
if (((z * t) <= -1e+111) || ~(((z * t) <= 1e-33)))
tmp = ((x * y) + ((z * t) * 0.0625)) - t_1;
else
tmp = (c + (x * y)) - t_1;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]}, If[Or[LessEqual[N[(z * t), $MachinePrecision], -1e+111], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e-33]], $MachinePrecision]], N[(N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], N[(N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot b\right) \cdot 0.25\\
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+111} \lor \neg \left(z \cdot t \leq 10^{-33}\right):\\
\;\;\;\;\left(x \cdot y + \left(z \cdot t\right) \cdot 0.0625\right) - t_1\\
\mathbf{else}:\\
\;\;\;\;\left(c + x \cdot y\right) - t_1\\
\end{array}
\end{array}
if (*.f64 z t) < -9.99999999999999957e110 or 1.0000000000000001e-33 < (*.f64 z t) Initial program 96.4%
associate-+l-96.4%
sub-neg96.4%
neg-mul-196.4%
metadata-eval96.4%
metadata-eval96.4%
cancel-sign-sub-inv96.4%
fma-def99.1%
associate-/l*99.0%
metadata-eval99.0%
*-lft-identity99.0%
associate-/l*98.9%
Simplified98.9%
fma-udef96.2%
associate-/l*96.3%
+-commutative96.3%
div-inv96.3%
metadata-eval96.3%
Applied egg-rr96.3%
Taylor expanded in a around inf 91.1%
if -9.99999999999999957e110 < (*.f64 z t) < 1.0000000000000001e-33Initial program 99.3%
Taylor expanded in z around 0 96.6%
Final simplification94.2%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (or (<= (* a b) -5e+112) (not (<= (* a b) 1e+20))) (- (* x y) (* (* a b) 0.25)) (+ c (+ (* x y) (* (* z t) 0.0625)))))
assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((a * b) <= -5e+112) || !((a * b) <= 1e+20)) {
tmp = (x * y) - ((a * b) * 0.25);
} else {
tmp = c + ((x * y) + ((z * t) * 0.0625));
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
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+112)) .or. (.not. ((a * b) <= 1d+20))) then
tmp = (x * y) - ((a * b) * 0.25d0)
else
tmp = c + ((x * y) + ((z * t) * 0.0625d0))
end if
code = tmp
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (((a * b) <= -5e+112) || !((a * b) <= 1e+20)) {
tmp = (x * y) - ((a * b) * 0.25);
} else {
tmp = c + ((x * y) + ((z * t) * 0.0625));
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): tmp = 0 if ((a * b) <= -5e+112) or not ((a * b) <= 1e+20): tmp = (x * y) - ((a * b) * 0.25) else: tmp = c + ((x * y) + ((z * t) * 0.0625)) return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) tmp = 0.0 if ((Float64(a * b) <= -5e+112) || !(Float64(a * b) <= 1e+20)) tmp = Float64(Float64(x * y) - Float64(Float64(a * b) * 0.25)); else tmp = Float64(c + Float64(Float64(x * y) + Float64(Float64(z * t) * 0.0625))); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if (((a * b) <= -5e+112) || ~(((a * b) <= 1e+20)))
tmp = (x * y) - ((a * b) * 0.25);
else
tmp = c + ((x * y) + ((z * t) * 0.0625));
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -5e+112], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+20]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+112} \lor \neg \left(a \cdot b \leq 10^{+20}\right):\\
\;\;\;\;x \cdot y - \left(a \cdot b\right) \cdot 0.25\\
\mathbf{else}:\\
\;\;\;\;c + \left(x \cdot y + \left(z \cdot t\right) \cdot 0.0625\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -5e112 or 1e20 < (*.f64 a b) Initial program 98.0%
Taylor expanded in z around 0 86.7%
Taylor expanded in c around 0 82.8%
if -5e112 < (*.f64 a b) < 1e20Initial program 98.0%
Taylor expanded in a around 0 93.0%
Final simplification88.9%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* a b) 0.25)) (t_2 (* (* z t) 0.0625)))
(if (<= (* a b) -5e+112)
(- t_2 t_1)
(if (<= (* a b) 1e+20) (+ c (+ (* x y) t_2)) (- (* x y) t_1)))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) * 0.25;
double t_2 = (z * t) * 0.0625;
double tmp;
if ((a * b) <= -5e+112) {
tmp = t_2 - t_1;
} else if ((a * b) <= 1e+20) {
tmp = c + ((x * y) + t_2);
} else {
tmp = (x * y) - t_1;
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (a * b) * 0.25d0
t_2 = (z * t) * 0.0625d0
if ((a * b) <= (-5d+112)) then
tmp = t_2 - t_1
else if ((a * b) <= 1d+20) then
tmp = c + ((x * y) + t_2)
else
tmp = (x * y) - t_1
end if
code = tmp
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) * 0.25;
double t_2 = (z * t) * 0.0625;
double tmp;
if ((a * b) <= -5e+112) {
tmp = t_2 - t_1;
} else if ((a * b) <= 1e+20) {
tmp = c + ((x * y) + t_2);
} else {
tmp = (x * y) - t_1;
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): t_1 = (a * b) * 0.25 t_2 = (z * t) * 0.0625 tmp = 0 if (a * b) <= -5e+112: tmp = t_2 - t_1 elif (a * b) <= 1e+20: tmp = c + ((x * y) + t_2) else: tmp = (x * y) - t_1 return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) * 0.25) t_2 = Float64(Float64(z * t) * 0.0625) tmp = 0.0 if (Float64(a * b) <= -5e+112) tmp = Float64(t_2 - t_1); elseif (Float64(a * b) <= 1e+20) tmp = Float64(c + Float64(Float64(x * y) + t_2)); else tmp = Float64(Float64(x * y) - t_1); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (a * b) * 0.25;
t_2 = (z * t) * 0.0625;
tmp = 0.0;
if ((a * b) <= -5e+112)
tmp = t_2 - t_1;
elseif ((a * b) <= 1e+20)
tmp = c + ((x * y) + t_2);
else
tmp = (x * y) - t_1;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+112], N[(t$95$2 - t$95$1), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+20], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot b\right) \cdot 0.25\\
t_2 := \left(z \cdot t\right) \cdot 0.0625\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+112}:\\
\;\;\;\;t_2 - t_1\\
\mathbf{elif}\;a \cdot b \leq 10^{+20}:\\
\;\;\;\;c + \left(x \cdot y + t_2\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y - t_1\\
\end{array}
\end{array}
if (*.f64 a b) < -5e112Initial program 100.0%
Taylor expanded in x around 0 91.7%
Taylor expanded in c around 0 87.7%
if -5e112 < (*.f64 a b) < 1e20Initial program 98.0%
Taylor expanded in a around 0 93.0%
if 1e20 < (*.f64 a b) Initial program 95.8%
Taylor expanded in z around 0 89.8%
Taylor expanded in c around 0 85.8%
Final simplification90.5%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* z t) 0.0625)))
(if (<= (* a b) -5e+112)
(- t_1 (* (* a b) 0.25))
(if (<= (* a b) 5e+16)
(+ c (+ (* x y) t_1))
(+ (* x y) (- c (/ a (/ 4.0 b))))))))assert(a < b);
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 ((a * b) <= -5e+112) {
tmp = t_1 - ((a * b) * 0.25);
} else if ((a * b) <= 5e+16) {
tmp = c + ((x * y) + t_1);
} else {
tmp = (x * y) + (c - (a / (4.0 / b)));
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
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 ((a * b) <= (-5d+112)) then
tmp = t_1 - ((a * b) * 0.25d0)
else if ((a * b) <= 5d+16) then
tmp = c + ((x * y) + t_1)
else
tmp = (x * y) + (c - (a / (4.0d0 / b)))
end if
code = tmp
end function
assert a < b;
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 ((a * b) <= -5e+112) {
tmp = t_1 - ((a * b) * 0.25);
} else if ((a * b) <= 5e+16) {
tmp = c + ((x * y) + t_1);
} else {
tmp = (x * y) + (c - (a / (4.0 / b)));
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): t_1 = (z * t) * 0.0625 tmp = 0 if (a * b) <= -5e+112: tmp = t_1 - ((a * b) * 0.25) elif (a * b) <= 5e+16: tmp = c + ((x * y) + t_1) else: tmp = (x * y) + (c - (a / (4.0 / b))) return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(z * t) * 0.0625) tmp = 0.0 if (Float64(a * b) <= -5e+112) tmp = Float64(t_1 - Float64(Float64(a * b) * 0.25)); elseif (Float64(a * b) <= 5e+16) tmp = Float64(c + Float64(Float64(x * y) + t_1)); else tmp = Float64(Float64(x * y) + Float64(c - Float64(a / Float64(4.0 / b)))); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (z * t) * 0.0625;
tmp = 0.0;
if ((a * b) <= -5e+112)
tmp = t_1 - ((a * b) * 0.25);
elseif ((a * b) <= 5e+16)
tmp = c + ((x * y) + t_1);
else
tmp = (x * y) + (c - (a / (4.0 / b)));
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+112], N[(t$95$1 - N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+16], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(c - N[(a / N[(4.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot t\right) \cdot 0.0625\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+112}:\\
\;\;\;\;t_1 - \left(a \cdot b\right) \cdot 0.25\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+16}:\\
\;\;\;\;c + \left(x \cdot y + t_1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + \left(c - \frac{a}{\frac{4}{b}}\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -5e112Initial program 100.0%
Taylor expanded in x around 0 91.7%
Taylor expanded in c around 0 87.7%
if -5e112 < (*.f64 a b) < 5e16Initial program 98.0%
Taylor expanded in a around 0 93.7%
if 5e16 < (*.f64 a b) Initial program 96.0%
associate-+l-96.0%
sub-neg96.0%
neg-mul-196.0%
metadata-eval96.0%
metadata-eval96.0%
cancel-sign-sub-inv96.0%
fma-def97.9%
associate-/l*97.9%
metadata-eval97.9%
*-lft-identity97.9%
associate-/l*97.8%
Simplified97.8%
fma-udef95.8%
associate-/l*95.8%
+-commutative95.8%
div-inv95.8%
metadata-eval95.8%
Applied egg-rr95.8%
Taylor expanded in z around 0 88.3%
Final simplification91.3%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* a b) 0.25)) (t_2 (* (* z t) 0.0625)))
(if (<= (* a b) -5e+112)
(- t_2 t_1)
(if (<= (* a b) 5e+16) (+ c (+ (* x y) t_2)) (- (+ c (* x y)) t_1)))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) * 0.25;
double t_2 = (z * t) * 0.0625;
double tmp;
if ((a * b) <= -5e+112) {
tmp = t_2 - t_1;
} else if ((a * b) <= 5e+16) {
tmp = c + ((x * y) + t_2);
} else {
tmp = (c + (x * y)) - t_1;
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (a * b) * 0.25d0
t_2 = (z * t) * 0.0625d0
if ((a * b) <= (-5d+112)) then
tmp = t_2 - t_1
else if ((a * b) <= 5d+16) then
tmp = c + ((x * y) + t_2)
else
tmp = (c + (x * y)) - t_1
end if
code = tmp
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (a * b) * 0.25;
double t_2 = (z * t) * 0.0625;
double tmp;
if ((a * b) <= -5e+112) {
tmp = t_2 - t_1;
} else if ((a * b) <= 5e+16) {
tmp = c + ((x * y) + t_2);
} else {
tmp = (c + (x * y)) - t_1;
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): t_1 = (a * b) * 0.25 t_2 = (z * t) * 0.0625 tmp = 0 if (a * b) <= -5e+112: tmp = t_2 - t_1 elif (a * b) <= 5e+16: tmp = c + ((x * y) + t_2) else: tmp = (c + (x * y)) - t_1 return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(a * b) * 0.25) t_2 = Float64(Float64(z * t) * 0.0625) tmp = 0.0 if (Float64(a * b) <= -5e+112) tmp = Float64(t_2 - t_1); elseif (Float64(a * b) <= 5e+16) tmp = Float64(c + Float64(Float64(x * y) + t_2)); else tmp = Float64(Float64(c + Float64(x * y)) - t_1); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (a * b) * 0.25;
t_2 = (z * t) * 0.0625;
tmp = 0.0;
if ((a * b) <= -5e+112)
tmp = t_2 - t_1;
elseif ((a * b) <= 5e+16)
tmp = c + ((x * y) + t_2);
else
tmp = (c + (x * y)) - t_1;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+112], N[(t$95$2 - t$95$1), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+16], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot b\right) \cdot 0.25\\
t_2 := \left(z \cdot t\right) \cdot 0.0625\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+112}:\\
\;\;\;\;t_2 - t_1\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+16}:\\
\;\;\;\;c + \left(x \cdot y + t_2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(c + x \cdot y\right) - t_1\\
\end{array}
\end{array}
if (*.f64 a b) < -5e112Initial program 100.0%
Taylor expanded in x around 0 91.7%
Taylor expanded in c around 0 87.7%
if -5e112 < (*.f64 a b) < 5e16Initial program 98.0%
Taylor expanded in a around 0 93.7%
if 5e16 < (*.f64 a b) Initial program 96.0%
Taylor expanded in z around 0 88.4%
Final simplification91.4%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* (* z t) 0.0625)) (t_2 (* (* a b) 0.25)))
(if (<= (* a b) -5e+112)
(- (+ c t_1) t_2)
(if (<= (* a b) 5e+16) (+ c (+ (* x y) t_1)) (- (+ c (* x y)) t_2)))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = (z * t) * 0.0625;
double t_2 = (a * b) * 0.25;
double tmp;
if ((a * b) <= -5e+112) {
tmp = (c + t_1) - t_2;
} else if ((a * b) <= 5e+16) {
tmp = c + ((x * y) + t_1);
} else {
tmp = (c + (x * y)) - t_2;
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
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 = (z * t) * 0.0625d0
t_2 = (a * b) * 0.25d0
if ((a * b) <= (-5d+112)) then
tmp = (c + t_1) - t_2
else if ((a * b) <= 5d+16) then
tmp = c + ((x * y) + t_1)
else
tmp = (c + (x * y)) - t_2
end if
code = tmp
end function
assert a < b;
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 t_2 = (a * b) * 0.25;
double tmp;
if ((a * b) <= -5e+112) {
tmp = (c + t_1) - t_2;
} else if ((a * b) <= 5e+16) {
tmp = c + ((x * y) + t_1);
} else {
tmp = (c + (x * y)) - t_2;
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): t_1 = (z * t) * 0.0625 t_2 = (a * b) * 0.25 tmp = 0 if (a * b) <= -5e+112: tmp = (c + t_1) - t_2 elif (a * b) <= 5e+16: tmp = c + ((x * y) + t_1) else: tmp = (c + (x * y)) - t_2 return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) t_1 = Float64(Float64(z * t) * 0.0625) t_2 = Float64(Float64(a * b) * 0.25) tmp = 0.0 if (Float64(a * b) <= -5e+112) tmp = Float64(Float64(c + t_1) - t_2); elseif (Float64(a * b) <= 5e+16) tmp = Float64(c + Float64(Float64(x * y) + t_1)); else tmp = Float64(Float64(c + Float64(x * y)) - t_2); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = (z * t) * 0.0625;
t_2 = (a * b) * 0.25;
tmp = 0.0;
if ((a * b) <= -5e+112)
tmp = (c + t_1) - t_2;
elseif ((a * b) <= 5e+16)
tmp = c + ((x * y) + t_1);
else
tmp = (c + (x * y)) - t_2;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] * 0.25), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -5e+112], N[(N[(c + t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 5e+16], N[(c + N[(N[(x * y), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot t\right) \cdot 0.0625\\
t_2 := \left(a \cdot b\right) \cdot 0.25\\
\mathbf{if}\;a \cdot b \leq -5 \cdot 10^{+112}:\\
\;\;\;\;\left(c + t_1\right) - t_2\\
\mathbf{elif}\;a \cdot b \leq 5 \cdot 10^{+16}:\\
\;\;\;\;c + \left(x \cdot y + t_1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(c + x \cdot y\right) - t_2\\
\end{array}
\end{array}
if (*.f64 a b) < -5e112Initial program 100.0%
Taylor expanded in x around 0 91.7%
if -5e112 < (*.f64 a b) < 5e16Initial program 98.0%
Taylor expanded in a around 0 93.7%
if 5e16 < (*.f64 a b) Initial program 96.0%
Taylor expanded in z around 0 88.4%
Final simplification92.2%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* x y)))
(t_2 (+ c (* (* z t) 0.0625)))
(t_3 (* a (* b -0.25))))
(if (<= z -1.25e+123)
t_2
(if (<= z -1.95e-204)
t_1
(if (<= z -4.2e-248)
t_3
(if (<= z 9.4e-154) t_1 (if (<= z 5.7e-18) t_3 t_2)))))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (x * y);
double t_2 = c + ((z * t) * 0.0625);
double t_3 = a * (b * -0.25);
double tmp;
if (z <= -1.25e+123) {
tmp = t_2;
} else if (z <= -1.95e-204) {
tmp = t_1;
} else if (z <= -4.2e-248) {
tmp = t_3;
} else if (z <= 9.4e-154) {
tmp = t_1;
} else if (z <= 5.7e-18) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
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 + (x * y)
t_2 = c + ((z * t) * 0.0625d0)
t_3 = a * (b * (-0.25d0))
if (z <= (-1.25d+123)) then
tmp = t_2
else if (z <= (-1.95d-204)) then
tmp = t_1
else if (z <= (-4.2d-248)) then
tmp = t_3
else if (z <= 9.4d-154) then
tmp = t_1
else if (z <= 5.7d-18) then
tmp = t_3
else
tmp = t_2
end if
code = tmp
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + (x * y);
double t_2 = c + ((z * t) * 0.0625);
double t_3 = a * (b * -0.25);
double tmp;
if (z <= -1.25e+123) {
tmp = t_2;
} else if (z <= -1.95e-204) {
tmp = t_1;
} else if (z <= -4.2e-248) {
tmp = t_3;
} else if (z <= 9.4e-154) {
tmp = t_1;
} else if (z <= 5.7e-18) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): t_1 = c + (x * y) t_2 = c + ((z * t) * 0.0625) t_3 = a * (b * -0.25) tmp = 0 if z <= -1.25e+123: tmp = t_2 elif z <= -1.95e-204: tmp = t_1 elif z <= -4.2e-248: tmp = t_3 elif z <= 9.4e-154: tmp = t_1 elif z <= 5.7e-18: tmp = t_3 else: tmp = t_2 return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(x * y)) t_2 = Float64(c + Float64(Float64(z * t) * 0.0625)) t_3 = Float64(a * Float64(b * -0.25)) tmp = 0.0 if (z <= -1.25e+123) tmp = t_2; elseif (z <= -1.95e-204) tmp = t_1; elseif (z <= -4.2e-248) tmp = t_3; elseif (z <= 9.4e-154) tmp = t_1; elseif (z <= 5.7e-18) tmp = t_3; else tmp = t_2; end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = c + (x * y);
t_2 = c + ((z * t) * 0.0625);
t_3 = a * (b * -0.25);
tmp = 0.0;
if (z <= -1.25e+123)
tmp = t_2;
elseif (z <= -1.95e-204)
tmp = t_1;
elseif (z <= -4.2e-248)
tmp = t_3;
elseif (z <= 9.4e-154)
tmp = t_1;
elseif (z <= 5.7e-18)
tmp = t_3;
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e+123], t$95$2, If[LessEqual[z, -1.95e-204], t$95$1, If[LessEqual[z, -4.2e-248], t$95$3, If[LessEqual[z, 9.4e-154], t$95$1, If[LessEqual[z, 5.7e-18], t$95$3, t$95$2]]]]]]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := c + x \cdot y\\
t_2 := c + \left(z \cdot t\right) \cdot 0.0625\\
t_3 := a \cdot \left(b \cdot -0.25\right)\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+123}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.95 \cdot 10^{-204}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-248}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 9.4 \cdot 10^{-154}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-18}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.24999999999999994e123 or 5.69999999999999971e-18 < z Initial program 97.1%
Taylor expanded in a around 0 79.4%
Taylor expanded in y around 0 64.1%
if -1.24999999999999994e123 < z < -1.95e-204 or -4.2e-248 < z < 9.4000000000000003e-154Initial program 98.2%
Taylor expanded in a around 0 68.0%
Taylor expanded in t around 0 55.8%
if -1.95e-204 < z < -4.2e-248 or 9.4000000000000003e-154 < z < 5.69999999999999971e-18Initial 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*100.0%
metadata-eval100.0%
*-lft-identity100.0%
associate-/l*99.8%
Simplified99.8%
fma-udef99.8%
associate-/l*99.8%
+-commutative99.8%
div-inv99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in a around inf 54.8%
*-commutative54.8%
associate-*l*54.8%
Simplified54.8%
Final simplification59.0%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(if (or (<= z -4.4e+158)
(not
(or (<= z -1.12e+104) (and (not (<= z -1.9e-8)) (<= z 2.7e-110)))))
(+ (* x y) (* (* z t) 0.0625))
(+ c (* b (* a -0.25)))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -4.4e+158) || !((z <= -1.12e+104) || (!(z <= -1.9e-8) && (z <= 2.7e-110)))) {
tmp = (x * y) + ((z * t) * 0.0625);
} else {
tmp = c + (b * (a * -0.25));
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
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 <= (-4.4d+158)) .or. (.not. (z <= (-1.12d+104)) .or. (.not. (z <= (-1.9d-8))) .and. (z <= 2.7d-110))) then
tmp = (x * y) + ((z * t) * 0.0625d0)
else
tmp = c + (b * (a * (-0.25d0)))
end if
code = tmp
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((z <= -4.4e+158) || !((z <= -1.12e+104) || (!(z <= -1.9e-8) && (z <= 2.7e-110)))) {
tmp = (x * y) + ((z * t) * 0.0625);
} else {
tmp = c + (b * (a * -0.25));
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): tmp = 0 if (z <= -4.4e+158) or not ((z <= -1.12e+104) or (not (z <= -1.9e-8) and (z <= 2.7e-110))): tmp = (x * y) + ((z * t) * 0.0625) else: tmp = c + (b * (a * -0.25)) return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) tmp = 0.0 if ((z <= -4.4e+158) || !((z <= -1.12e+104) || (!(z <= -1.9e-8) && (z <= 2.7e-110)))) tmp = Float64(Float64(x * y) + Float64(Float64(z * t) * 0.0625)); else tmp = Float64(c + Float64(b * Float64(a * -0.25))); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if ((z <= -4.4e+158) || ~(((z <= -1.12e+104) || (~((z <= -1.9e-8)) && (z <= 2.7e-110)))))
tmp = (x * y) + ((z * t) * 0.0625);
else
tmp = c + (b * (a * -0.25));
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[z, -4.4e+158], N[Not[Or[LessEqual[z, -1.12e+104], And[N[Not[LessEqual[z, -1.9e-8]], $MachinePrecision], LessEqual[z, 2.7e-110]]]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+158} \lor \neg \left(z \leq -1.12 \cdot 10^{+104} \lor \neg \left(z \leq -1.9 \cdot 10^{-8}\right) \land z \leq 2.7 \cdot 10^{-110}\right):\\
\;\;\;\;x \cdot y + \left(z \cdot t\right) \cdot 0.0625\\
\mathbf{else}:\\
\;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\
\end{array}
\end{array}
if z < -4.4000000000000002e158 or -1.12000000000000003e104 < z < -1.90000000000000014e-8 or 2.6999999999999998e-110 < z Initial program 97.9%
associate-+l-97.9%
sub-neg97.9%
neg-mul-197.9%
metadata-eval97.9%
metadata-eval97.9%
cancel-sign-sub-inv97.9%
fma-def100.0%
associate-/l*99.9%
metadata-eval99.9%
*-lft-identity99.9%
associate-/l*99.9%
Simplified99.9%
fma-udef97.7%
associate-/l*97.8%
+-commutative97.8%
div-inv97.8%
metadata-eval97.8%
Applied egg-rr97.8%
Taylor expanded in a around inf 86.5%
Taylor expanded in a around 0 63.9%
if -4.4000000000000002e158 < z < -1.12000000000000003e104 or -1.90000000000000014e-8 < z < 2.6999999999999998e-110Initial program 98.2%
Taylor expanded in a around inf 63.4%
*-commutative63.4%
*-commutative63.4%
associate-*r*63.4%
Simplified63.4%
Final simplification63.7%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (+ c (- (+ (/ (* z t) 16.0) (* x y)) (/ (* a b) 4.0))))
assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
return c + ((((z * t) / 16.0) + (x * y)) - ((a * b) / 4.0));
}
NOTE: a and b should be sorted in increasing order before calling this function.
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 + ((((z * t) / 16.0d0) + (x * y)) - ((a * b) / 4.0d0))
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c + ((((z * t) / 16.0) + (x * y)) - ((a * b) / 4.0));
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): return c + ((((z * t) / 16.0) + (x * y)) - ((a * b) / 4.0))
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) return Float64(c + Float64(Float64(Float64(Float64(z * t) / 16.0) + Float64(x * y)) - Float64(Float64(a * b) / 4.0))) end
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b, c)
tmp = c + ((((z * t) / 16.0) + (x * y)) - ((a * b) / 4.0));
end
NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := N[(c + N[(N[(N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
c + \left(\left(\frac{z \cdot t}{16} + x \cdot y\right) - \frac{a \cdot b}{4}\right)
\end{array}
Initial program 98.0%
Final simplification98.0%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(if (or (<= a -4.8e+179)
(and (not (<= a -1.05e+141))
(or (<= a -4.1e+89) (not (<= a 2.9e-49)))))
(* a (* b -0.25))
(+ c (* x y))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((a <= -4.8e+179) || (!(a <= -1.05e+141) && ((a <= -4.1e+89) || !(a <= 2.9e-49)))) {
tmp = a * (b * -0.25);
} else {
tmp = c + (x * y);
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
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 <= (-4.8d+179)) .or. (.not. (a <= (-1.05d+141))) .and. (a <= (-4.1d+89)) .or. (.not. (a <= 2.9d-49))) then
tmp = a * (b * (-0.25d0))
else
tmp = c + (x * y)
end if
code = tmp
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if ((a <= -4.8e+179) || (!(a <= -1.05e+141) && ((a <= -4.1e+89) || !(a <= 2.9e-49)))) {
tmp = a * (b * -0.25);
} else {
tmp = c + (x * y);
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): tmp = 0 if (a <= -4.8e+179) or (not (a <= -1.05e+141) and ((a <= -4.1e+89) or not (a <= 2.9e-49))): tmp = a * (b * -0.25) else: tmp = c + (x * y) return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) tmp = 0.0 if ((a <= -4.8e+179) || (!(a <= -1.05e+141) && ((a <= -4.1e+89) || !(a <= 2.9e-49)))) tmp = Float64(a * Float64(b * -0.25)); else tmp = Float64(c + Float64(x * y)); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if ((a <= -4.8e+179) || (~((a <= -1.05e+141)) && ((a <= -4.1e+89) || ~((a <= 2.9e-49)))))
tmp = a * (b * -0.25);
else
tmp = c + (x * y);
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[Or[LessEqual[a, -4.8e+179], And[N[Not[LessEqual[a, -1.05e+141]], $MachinePrecision], Or[LessEqual[a, -4.1e+89], N[Not[LessEqual[a, 2.9e-49]], $MachinePrecision]]]], N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \cdot 10^{+179} \lor \neg \left(a \leq -1.05 \cdot 10^{+141}\right) \land \left(a \leq -4.1 \cdot 10^{+89} \lor \neg \left(a \leq 2.9 \cdot 10^{-49}\right)\right):\\
\;\;\;\;a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;c + x \cdot y\\
\end{array}
\end{array}
if a < -4.80000000000000025e179 or -1.0499999999999999e141 < a < -4.09999999999999985e89 or 2.9e-49 < a Initial program 97.5%
associate-+l-97.5%
sub-neg97.5%
neg-mul-197.5%
metadata-eval97.5%
metadata-eval97.5%
cancel-sign-sub-inv97.5%
fma-def99.2%
associate-/l*99.1%
metadata-eval99.1%
*-lft-identity99.1%
associate-/l*99.0%
Simplified99.0%
fma-udef97.4%
associate-/l*97.5%
+-commutative97.5%
div-inv97.5%
metadata-eval97.5%
Applied egg-rr97.5%
Taylor expanded in a around inf 51.4%
*-commutative51.4%
associate-*l*51.4%
Simplified51.4%
if -4.80000000000000025e179 < a < -1.0499999999999999e141 or -4.09999999999999985e89 < a < 2.9e-49Initial program 98.5%
Taylor expanded in a around 0 87.1%
Taylor expanded in t around 0 56.5%
Final simplification54.0%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* a (* b -0.25))))
(if (<= b -3.35e-31)
t_1
(if (<= b -6e-191)
(* x y)
(if (<= b -6.3e-293) c (if (<= b 2.2e+39) (* x y) t_1))))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = a * (b * -0.25);
double tmp;
if (b <= -3.35e-31) {
tmp = t_1;
} else if (b <= -6e-191) {
tmp = x * y;
} else if (b <= -6.3e-293) {
tmp = c;
} else if (b <= 2.2e+39) {
tmp = x * y;
} else {
tmp = t_1;
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = a * (b * (-0.25d0))
if (b <= (-3.35d-31)) then
tmp = t_1
else if (b <= (-6d-191)) then
tmp = x * y
else if (b <= (-6.3d-293)) then
tmp = c
else if (b <= 2.2d+39) then
tmp = x * y
else
tmp = t_1
end if
code = tmp
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = a * (b * -0.25);
double tmp;
if (b <= -3.35e-31) {
tmp = t_1;
} else if (b <= -6e-191) {
tmp = x * y;
} else if (b <= -6.3e-293) {
tmp = c;
} else if (b <= 2.2e+39) {
tmp = x * y;
} else {
tmp = t_1;
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): t_1 = a * (b * -0.25) tmp = 0 if b <= -3.35e-31: tmp = t_1 elif b <= -6e-191: tmp = x * y elif b <= -6.3e-293: tmp = c elif b <= 2.2e+39: tmp = x * y else: tmp = t_1 return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) t_1 = Float64(a * Float64(b * -0.25)) tmp = 0.0 if (b <= -3.35e-31) tmp = t_1; elseif (b <= -6e-191) tmp = Float64(x * y); elseif (b <= -6.3e-293) tmp = c; elseif (b <= 2.2e+39) tmp = Float64(x * y); else tmp = t_1; end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = a * (b * -0.25);
tmp = 0.0;
if (b <= -3.35e-31)
tmp = t_1;
elseif (b <= -6e-191)
tmp = x * y;
elseif (b <= -6.3e-293)
tmp = c;
elseif (b <= 2.2e+39)
tmp = x * y;
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -3.35e-31], t$95$1, If[LessEqual[b, -6e-191], N[(x * y), $MachinePrecision], If[LessEqual[b, -6.3e-293], c, If[LessEqual[b, 2.2e+39], N[(x * y), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(b \cdot -0.25\right)\\
\mathbf{if}\;b \leq -3.35 \cdot 10^{-31}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq -6 \cdot 10^{-191}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;b \leq -6.3 \cdot 10^{-293}:\\
\;\;\;\;c\\
\mathbf{elif}\;b \leq 2.2 \cdot 10^{+39}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if b < -3.35000000000000002e-31 or 2.2000000000000001e39 < b Initial program 96.9%
associate-+l-96.9%
sub-neg96.9%
neg-mul-196.9%
metadata-eval96.9%
metadata-eval96.9%
cancel-sign-sub-inv96.9%
fma-def99.2%
associate-/l*99.2%
metadata-eval99.2%
*-lft-identity99.2%
associate-/l*99.0%
Simplified99.0%
fma-udef96.7%
associate-/l*96.7%
+-commutative96.7%
div-inv96.7%
metadata-eval96.7%
Applied egg-rr96.7%
Taylor expanded in a around inf 51.3%
*-commutative51.3%
associate-*l*51.3%
Simplified51.3%
if -3.35000000000000002e-31 < b < -6.0000000000000001e-191 or -6.29999999999999988e-293 < b < 2.2000000000000001e39Initial program 99.0%
associate-+l-99.0%
sub-neg99.0%
neg-mul-199.0%
metadata-eval99.0%
metadata-eval99.0%
cancel-sign-sub-inv99.0%
fma-def99.0%
associate-/l*98.9%
metadata-eval98.9%
*-lft-identity98.9%
associate-/l*98.9%
Simplified98.9%
fma-udef98.9%
associate-/l*99.0%
+-commutative99.0%
div-inv99.0%
metadata-eval99.0%
Applied egg-rr99.0%
Taylor expanded in a around inf 82.7%
Taylor expanded in x around inf 44.4%
if -6.0000000000000001e-191 < b < -6.29999999999999988e-293Initial program 99.9%
Taylor expanded in c around inf 46.2%
Final simplification48.1%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (* t (* z 0.0625))))
(if (<= z -6.5e+122)
t_1
(if (<= z -2.4e-86)
(* x y)
(if (<= z -2.8e-203) c (if (<= z 4.5e-13) (* a (* b -0.25)) t_1))))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = t * (z * 0.0625);
double tmp;
if (z <= -6.5e+122) {
tmp = t_1;
} else if (z <= -2.4e-86) {
tmp = x * y;
} else if (z <= -2.8e-203) {
tmp = c;
} else if (z <= 4.5e-13) {
tmp = a * (b * -0.25);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
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)
if (z <= (-6.5d+122)) then
tmp = t_1
else if (z <= (-2.4d-86)) then
tmp = x * y
else if (z <= (-2.8d-203)) then
tmp = c
else if (z <= 4.5d-13) then
tmp = a * (b * (-0.25d0))
else
tmp = t_1
end if
code = tmp
end function
assert a < b;
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);
double tmp;
if (z <= -6.5e+122) {
tmp = t_1;
} else if (z <= -2.4e-86) {
tmp = x * y;
} else if (z <= -2.8e-203) {
tmp = c;
} else if (z <= 4.5e-13) {
tmp = a * (b * -0.25);
} else {
tmp = t_1;
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): t_1 = t * (z * 0.0625) tmp = 0 if z <= -6.5e+122: tmp = t_1 elif z <= -2.4e-86: tmp = x * y elif z <= -2.8e-203: tmp = c elif z <= 4.5e-13: tmp = a * (b * -0.25) else: tmp = t_1 return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) t_1 = Float64(t * Float64(z * 0.0625)) tmp = 0.0 if (z <= -6.5e+122) tmp = t_1; elseif (z <= -2.4e-86) tmp = Float64(x * y); elseif (z <= -2.8e-203) tmp = c; elseif (z <= 4.5e-13) tmp = Float64(a * Float64(b * -0.25)); else tmp = t_1; end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = t * (z * 0.0625);
tmp = 0.0;
if (z <= -6.5e+122)
tmp = t_1;
elseif (z <= -2.4e-86)
tmp = x * y;
elseif (z <= -2.8e-203)
tmp = c;
elseif (z <= 4.5e-13)
tmp = a * (b * -0.25);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(t * N[(z * 0.0625), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.5e+122], t$95$1, If[LessEqual[z, -2.4e-86], N[(x * y), $MachinePrecision], If[LessEqual[z, -2.8e-203], c, If[LessEqual[z, 4.5e-13], N[(a * N[(b * -0.25), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(z \cdot 0.0625\right)\\
\mathbf{if}\;z \leq -6.5 \cdot 10^{+122}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{-86}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-203}:\\
\;\;\;\;c\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-13}:\\
\;\;\;\;a \cdot \left(b \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -6.49999999999999963e122 or 4.5e-13 < z Initial program 97.0%
associate-+l-97.0%
sub-neg97.0%
neg-mul-197.0%
metadata-eval97.0%
metadata-eval97.0%
cancel-sign-sub-inv97.0%
fma-def100.0%
associate-/l*99.9%
metadata-eval99.9%
*-lft-identity99.9%
associate-/l*99.9%
Simplified99.9%
fma-udef96.9%
associate-/l*97.0%
+-commutative97.0%
div-inv97.0%
metadata-eval97.0%
Applied egg-rr97.0%
Taylor expanded in a around inf 85.5%
Taylor expanded in z around inf 52.9%
associate-*r*52.9%
*-commutative52.9%
associate-*l*52.9%
Simplified52.9%
if -6.49999999999999963e122 < z < -2.40000000000000013e-86Initial program 98.0%
associate-+l-98.0%
sub-neg98.0%
neg-mul-198.0%
metadata-eval98.0%
metadata-eval98.0%
cancel-sign-sub-inv98.0%
fma-def98.0%
associate-/l*98.0%
metadata-eval98.0%
*-lft-identity98.0%
associate-/l*97.9%
Simplified97.9%
fma-udef97.9%
associate-/l*98.0%
+-commutative98.0%
div-inv98.0%
metadata-eval98.0%
Applied egg-rr98.0%
Taylor expanded in a around inf 82.5%
Taylor expanded in x around inf 38.5%
if -2.40000000000000013e-86 < z < -2.80000000000000022e-203Initial program 99.8%
Taylor expanded in c around inf 41.7%
if -2.80000000000000022e-203 < z < 4.5e-13Initial program 98.8%
associate-+l-98.8%
sub-neg98.8%
neg-mul-198.8%
metadata-eval98.8%
metadata-eval98.8%
cancel-sign-sub-inv98.8%
fma-def98.8%
associate-/l*98.8%
metadata-eval98.8%
*-lft-identity98.8%
associate-/l*98.6%
Simplified98.6%
fma-udef98.6%
associate-/l*98.6%
+-commutative98.6%
div-inv98.6%
metadata-eval98.6%
Applied egg-rr98.6%
Taylor expanded in a around inf 47.5%
*-commutative47.5%
associate-*l*47.5%
Simplified47.5%
Final simplification47.3%
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (+ c (* (* z t) 0.0625))))
(if (<= z -6.6e+122)
t_1
(if (<= z -7.2e-8)
(+ c (* x y))
(if (<= z 9.8e-8) (+ c (* b (* a -0.25))) t_1)))))assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + ((z * t) * 0.0625);
double tmp;
if (z <= -6.6e+122) {
tmp = t_1;
} else if (z <= -7.2e-8) {
tmp = c + (x * y);
} else if (z <= 9.8e-8) {
tmp = c + (b * (a * -0.25));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8) :: t_1
real(8) :: tmp
t_1 = c + ((z * t) * 0.0625d0)
if (z <= (-6.6d+122)) then
tmp = t_1
else if (z <= (-7.2d-8)) then
tmp = c + (x * y)
else if (z <= 9.8d-8) then
tmp = c + (b * (a * (-0.25d0)))
else
tmp = t_1
end if
code = tmp
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double t_1 = c + ((z * t) * 0.0625);
double tmp;
if (z <= -6.6e+122) {
tmp = t_1;
} else if (z <= -7.2e-8) {
tmp = c + (x * y);
} else if (z <= 9.8e-8) {
tmp = c + (b * (a * -0.25));
} else {
tmp = t_1;
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): t_1 = c + ((z * t) * 0.0625) tmp = 0 if z <= -6.6e+122: tmp = t_1 elif z <= -7.2e-8: tmp = c + (x * y) elif z <= 9.8e-8: tmp = c + (b * (a * -0.25)) else: tmp = t_1 return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) t_1 = Float64(c + Float64(Float64(z * t) * 0.0625)) tmp = 0.0 if (z <= -6.6e+122) tmp = t_1; elseif (z <= -7.2e-8) tmp = Float64(c + Float64(x * y)); elseif (z <= 9.8e-8) tmp = Float64(c + Float64(b * Float64(a * -0.25))); else tmp = t_1; end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
t_1 = c + ((z * t) * 0.0625);
tmp = 0.0;
if (z <= -6.6e+122)
tmp = t_1;
elseif (z <= -7.2e-8)
tmp = c + (x * y);
elseif (z <= 9.8e-8)
tmp = c + (b * (a * -0.25));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_] := Block[{t$95$1 = N[(c + N[(N[(z * t), $MachinePrecision] * 0.0625), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.6e+122], t$95$1, If[LessEqual[z, -7.2e-8], N[(c + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.8e-8], N[(c + N[(b * N[(a * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := c + \left(z \cdot t\right) \cdot 0.0625\\
\mathbf{if}\;z \leq -6.6 \cdot 10^{+122}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -7.2 \cdot 10^{-8}:\\
\;\;\;\;c + x \cdot y\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{-8}:\\
\;\;\;\;c + b \cdot \left(a \cdot -0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -6.5999999999999998e122 or 9.8000000000000004e-8 < z Initial program 97.0%
Taylor expanded in a around 0 79.6%
Taylor expanded in y around 0 64.0%
if -6.5999999999999998e122 < z < -7.19999999999999962e-8Initial program 96.9%
Taylor expanded in a around 0 75.3%
Taylor expanded in t around 0 53.2%
if -7.19999999999999962e-8 < z < 9.8000000000000004e-8Initial program 99.1%
Taylor expanded in a around inf 65.3%
*-commutative65.3%
*-commutative65.3%
associate-*r*65.3%
Simplified65.3%
Final simplification63.3%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 (if (<= x -2.3e+92) (* x y) (if (<= x 2.3e-79) c (* x y))))
assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (x <= -2.3e+92) {
tmp = x * y;
} else if (x <= 2.3e-79) {
tmp = c;
} else {
tmp = x * y;
}
return tmp;
}
NOTE: a and b should be sorted in increasing order before calling this function.
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 <= (-2.3d+92)) then
tmp = x * y
else if (x <= 2.3d-79) then
tmp = c
else
tmp = x * y
end if
code = tmp
end function
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
double tmp;
if (x <= -2.3e+92) {
tmp = x * y;
} else if (x <= 2.3e-79) {
tmp = c;
} else {
tmp = x * y;
}
return tmp;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): tmp = 0 if x <= -2.3e+92: tmp = x * y elif x <= 2.3e-79: tmp = c else: tmp = x * y return tmp
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) tmp = 0.0 if (x <= -2.3e+92) tmp = Float64(x * y); elseif (x <= 2.3e-79) tmp = c; else tmp = Float64(x * y); end return tmp end
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b, c)
tmp = 0.0;
if (x <= -2.3e+92)
tmp = x * y;
elseif (x <= 2.3e-79)
tmp = c;
else
tmp = x * y;
end
tmp_2 = tmp;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := If[LessEqual[x, -2.3e+92], N[(x * y), $MachinePrecision], If[LessEqual[x, 2.3e-79], c, N[(x * y), $MachinePrecision]]]
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+92}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-79}:\\
\;\;\;\;c\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -2.29999999999999998e92 or 2.30000000000000012e-79 < x Initial program 96.2%
associate-+l-96.2%
sub-neg96.2%
neg-mul-196.2%
metadata-eval96.2%
metadata-eval96.2%
cancel-sign-sub-inv96.2%
fma-def98.4%
associate-/l*98.4%
metadata-eval98.4%
*-lft-identity98.4%
associate-/l*98.4%
Simplified98.4%
fma-udef96.1%
associate-/l*96.1%
+-commutative96.1%
div-inv96.1%
metadata-eval96.1%
Applied egg-rr96.1%
Taylor expanded in a around inf 82.9%
Taylor expanded in x around inf 42.3%
if -2.29999999999999998e92 < x < 2.30000000000000012e-79Initial program 100.0%
Taylor expanded in c around inf 25.1%
Final simplification34.1%
NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b c) :precision binary64 c)
assert(a < b);
double code(double x, double y, double z, double t, double a, double b, double c) {
return c;
}
NOTE: a and b should be sorted in increasing order before calling this function.
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
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b, double c) {
return c;
}
[a, b] = sort([a, b]) def code(x, y, z, t, a, b, c): return c
a, b = sort([a, b]) function code(x, y, z, t, a, b, c) return c end
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b, c)
tmp = c;
end
NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_] := c
\begin{array}{l}
[a, b] = \mathsf{sort}([a, b])\\
\\
c
\end{array}
Initial program 98.0%
Taylor expanded in c around inf 20.0%
Final simplification20.0%
herbie shell --seed 2023221
(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))