
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
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
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
real(8) function code(x, y, z, t, a)
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
code = ((x * y) - (z * t)) / a
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * t)) / a;
}
def code(x, y, z, t, a): return ((x * y) - (z * t)) / a
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(z * t)) / a) end
function tmp = code(x, y, z, t, a) tmp = ((x * y) - (z * t)) / a; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot y - z \cdot t}{a}
\end{array}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (or (<= t_1 -2e+207) (not (<= t_1 5e+166)))
(fma -1.0 (/ t (/ a z)) (/ y (/ a x)))
(/ t_1 a))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -2e+207) || !(t_1 <= 5e+166)) {
tmp = fma(-1.0, (t / (a / z)), (y / (a / x)));
} else {
tmp = t_1 / a;
}
return tmp;
}
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if ((t_1 <= -2e+207) || !(t_1 <= 5e+166)) tmp = fma(-1.0, Float64(t / Float64(a / z)), Float64(y / Float64(a / x))); else tmp = Float64(t_1 / a); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e+207], N[Not[LessEqual[t$95$1, 5e+166]], $MachinePrecision]], N[(-1.0 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+207} \lor \neg \left(t_1 \leq 5 \cdot 10^{+166}\right):\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{t}{\frac{a}{z}}, \frac{y}{\frac{a}{x}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -2.0000000000000001e207 or 5.0000000000000002e166 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 80.5%
Taylor expanded in x around 0 78.0%
fma-def78.0%
associate-/l*83.5%
associate-/l*93.1%
Simplified93.1%
if -2.0000000000000001e207 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000002e166Initial program 98.3%
Final simplification95.9%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+248)))
(- (/ x (/ a y)) (/ z (/ a t)))
(/ (fma y x (* z (- t))) a))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+248)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = fma(y, x, (z * -t)) / a;
}
return tmp;
}
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+248)) tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); else tmp = Float64(fma(y, x, Float64(z * Float64(-t))) / a); end return tmp end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+248]], $MachinePrecision]], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * x + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+248}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, x, z \cdot \left(-t\right)\right)}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 2.00000000000000009e248 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 70.3%
div-sub66.4%
associate-/l*78.8%
associate-/l*93.4%
Applied egg-rr93.4%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 2.00000000000000009e248Initial program 98.6%
Taylor expanded in x around 0 98.6%
+-commutative98.6%
mul-1-neg98.6%
sub-neg98.6%
div-sub98.6%
fma-neg98.6%
distribute-rgt-neg-out98.6%
Simplified98.6%
Final simplification97.1%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+248)))
(- (/ x (/ a y)) (/ z (/ a t)))
(/ t_1 a))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+248)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+248)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+248): tmp = (x / (a / y)) - (z / (a / t)) else: tmp = t_1 / a return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+248)) tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); else tmp = Float64(t_1 / a); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if ((t_1 <= -Inf) || ~((t_1 <= 2e+248)))
tmp = (x / (a / y)) - (z / (a / t));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+248]], $MachinePrecision]], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+248}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 2.00000000000000009e248 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 70.3%
div-sub66.4%
associate-/l*78.8%
associate-/l*93.4%
Applied egg-rr93.4%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 2.00000000000000009e248Initial program 98.6%
Final simplification97.1%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -2.95e-56)
(/ y (/ a x))
(if (<= y 4.3e+16)
(* z (/ t (- a)))
(if (<= y 3.4e+62)
(* x (/ y a))
(if (<= y 1e+88) (/ 1.0 (/ (/ a (- t)) z)) (/ x (/ a y)))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.95e-56) {
tmp = y / (a / x);
} else if (y <= 4.3e+16) {
tmp = z * (t / -a);
} else if (y <= 3.4e+62) {
tmp = x * (y / a);
} else if (y <= 1e+88) {
tmp = 1.0 / ((a / -t) / z);
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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) :: tmp
if (y <= (-2.95d-56)) then
tmp = y / (a / x)
else if (y <= 4.3d+16) then
tmp = z * (t / -a)
else if (y <= 3.4d+62) then
tmp = x * (y / a)
else if (y <= 1d+88) then
tmp = 1.0d0 / ((a / -t) / z)
else
tmp = x / (a / y)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.95e-56) {
tmp = y / (a / x);
} else if (y <= 4.3e+16) {
tmp = z * (t / -a);
} else if (y <= 3.4e+62) {
tmp = x * (y / a);
} else if (y <= 1e+88) {
tmp = 1.0 / ((a / -t) / z);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -2.95e-56: tmp = y / (a / x) elif y <= 4.3e+16: tmp = z * (t / -a) elif y <= 3.4e+62: tmp = x * (y / a) elif y <= 1e+88: tmp = 1.0 / ((a / -t) / z) else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.95e-56) tmp = Float64(y / Float64(a / x)); elseif (y <= 4.3e+16) tmp = Float64(z * Float64(t / Float64(-a))); elseif (y <= 3.4e+62) tmp = Float64(x * Float64(y / a)); elseif (y <= 1e+88) tmp = Float64(1.0 / Float64(Float64(a / Float64(-t)) / z)); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -2.95e-56)
tmp = y / (a / x);
elseif (y <= 4.3e+16)
tmp = z * (t / -a);
elseif (y <= 3.4e+62)
tmp = x * (y / a);
elseif (y <= 1e+88)
tmp = 1.0 / ((a / -t) / z);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.95e-56], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.3e+16], N[(z * N[(t / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e+62], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+88], N[(1.0 / N[(N[(a / (-t)), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.95 \cdot 10^{-56}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;y \leq 4.3 \cdot 10^{+16}:\\
\;\;\;\;z \cdot \frac{t}{-a}\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+62}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;y \leq 10^{+88}:\\
\;\;\;\;\frac{1}{\frac{\frac{a}{-t}}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -2.9499999999999999e-56Initial program 85.6%
Taylor expanded in x around inf 59.4%
associate-/l*63.9%
Simplified63.9%
if -2.9499999999999999e-56 < y < 4.3e16Initial program 94.6%
Taylor expanded in x around 0 69.1%
associate-*r/69.1%
mul-1-neg69.1%
distribute-rgt-neg-out69.1%
*-commutative69.1%
associate-/l*66.8%
associate-/r/70.1%
Simplified70.1%
*-commutative70.1%
frac-2neg70.1%
remove-double-neg70.1%
associate-*r/69.1%
Applied egg-rr69.1%
associate-/l*70.0%
associate-/r/67.8%
Simplified67.8%
if 4.3e16 < y < 3.40000000000000014e62Initial program 99.1%
Taylor expanded in x around 0 99.1%
+-commutative99.1%
mul-1-neg99.1%
sub-neg99.1%
div-sub99.1%
fma-neg99.2%
distribute-rgt-neg-out99.2%
Simplified99.2%
Taylor expanded in y around inf 72.2%
associate-*l/72.7%
Simplified72.7%
if 3.40000000000000014e62 < y < 9.99999999999999959e87Initial program 71.9%
Taylor expanded in x around 0 44.8%
associate-*r/44.8%
mul-1-neg44.8%
distribute-rgt-neg-out44.8%
*-commutative44.8%
associate-/l*71.6%
associate-/r/71.8%
Simplified71.8%
associate-*l/44.8%
associate-/l*71.6%
add-sqr-sqrt42.6%
sqrt-unprod29.8%
sqr-neg29.8%
sqrt-unprod0.7%
add-sqr-sqrt0.8%
Applied egg-rr0.8%
*-un-lft-identity0.8%
div-inv0.8%
times-frac0.7%
frac-2neg0.7%
metadata-eval0.7%
add-sqr-sqrt0.4%
sqrt-unprod2.1%
sqr-neg2.1%
sqrt-unprod1.8%
add-sqr-sqrt44.3%
Applied egg-rr44.3%
frac-times71.6%
*-un-lft-identity71.6%
clear-num71.6%
frac-2neg71.6%
metadata-eval71.6%
un-div-inv71.6%
Applied egg-rr71.6%
if 9.99999999999999959e87 < y Initial program 88.0%
Taylor expanded in x around inf 76.3%
associate-*r/78.3%
Simplified78.3%
associate-*r/76.3%
*-commutative76.3%
associate-/l*84.3%
Applied egg-rr84.3%
Final simplification70.0%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ t (- a)))))
(if (<= y -1.9e-55)
(/ y (/ a x))
(if (<= y 4.4e+15)
t_1
(if (<= y 5e+61)
(* x (/ y a))
(if (<= y 1.28e+91) t_1 (/ x (/ a y))))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (t / -a);
double tmp;
if (y <= -1.9e-55) {
tmp = y / (a / x);
} else if (y <= 4.4e+15) {
tmp = t_1;
} else if (y <= 5e+61) {
tmp = x * (y / a);
} else if (y <= 1.28e+91) {
tmp = t_1;
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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) :: t_1
real(8) :: tmp
t_1 = z * (t / -a)
if (y <= (-1.9d-55)) then
tmp = y / (a / x)
else if (y <= 4.4d+15) then
tmp = t_1
else if (y <= 5d+61) then
tmp = x * (y / a)
else if (y <= 1.28d+91) then
tmp = t_1
else
tmp = x / (a / y)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = z * (t / -a);
double tmp;
if (y <= -1.9e-55) {
tmp = y / (a / x);
} else if (y <= 4.4e+15) {
tmp = t_1;
} else if (y <= 5e+61) {
tmp = x * (y / a);
} else if (y <= 1.28e+91) {
tmp = t_1;
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = z * (t / -a) tmp = 0 if y <= -1.9e-55: tmp = y / (a / x) elif y <= 4.4e+15: tmp = t_1 elif y <= 5e+61: tmp = x * (y / a) elif y <= 1.28e+91: tmp = t_1 else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(z * Float64(t / Float64(-a))) tmp = 0.0 if (y <= -1.9e-55) tmp = Float64(y / Float64(a / x)); elseif (y <= 4.4e+15) tmp = t_1; elseif (y <= 5e+61) tmp = Float64(x * Float64(y / a)); elseif (y <= 1.28e+91) tmp = t_1; else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = z * (t / -a);
tmp = 0.0;
if (y <= -1.9e-55)
tmp = y / (a / x);
elseif (y <= 4.4e+15)
tmp = t_1;
elseif (y <= 5e+61)
tmp = x * (y / a);
elseif (y <= 1.28e+91)
tmp = t_1;
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(t / (-a)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.9e-55], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e+15], t$95$1, If[LessEqual[y, 5e+61], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.28e+91], t$95$1, N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := z \cdot \frac{t}{-a}\\
\mathbf{if}\;y \leq -1.9 \cdot 10^{-55}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+15}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+61}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;y \leq 1.28 \cdot 10^{+91}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -1.8999999999999998e-55Initial program 85.6%
Taylor expanded in x around inf 59.4%
associate-/l*63.9%
Simplified63.9%
if -1.8999999999999998e-55 < y < 4.4e15 or 5.00000000000000018e61 < y < 1.27999999999999999e91Initial program 93.2%
Taylor expanded in x around 0 67.7%
associate-*r/67.7%
mul-1-neg67.7%
distribute-rgt-neg-out67.7%
*-commutative67.7%
associate-/l*67.1%
associate-/r/70.2%
Simplified70.2%
*-commutative70.2%
frac-2neg70.2%
remove-double-neg70.2%
associate-*r/67.7%
Applied egg-rr67.7%
associate-/l*70.1%
associate-/r/68.0%
Simplified68.0%
if 4.4e15 < y < 5.00000000000000018e61Initial program 99.1%
Taylor expanded in x around 0 99.1%
+-commutative99.1%
mul-1-neg99.1%
sub-neg99.1%
div-sub99.1%
fma-neg99.2%
distribute-rgt-neg-out99.2%
Simplified99.2%
Taylor expanded in y around inf 72.2%
associate-*l/72.7%
Simplified72.7%
if 1.27999999999999999e91 < y Initial program 88.0%
Taylor expanded in x around inf 76.3%
associate-*r/78.3%
Simplified78.3%
associate-*r/76.3%
*-commutative76.3%
associate-/l*84.3%
Applied egg-rr84.3%
Final simplification70.0%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.2e-70)
(/ y (/ a x))
(if (<= y 1.05e+16)
(* z (/ t (- a)))
(if (<= y 5.1e+61)
(* x (/ y a))
(if (<= y 1e+88) (* t (- (/ z a))) (/ x (/ a y)))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.2e-70) {
tmp = y / (a / x);
} else if (y <= 1.05e+16) {
tmp = z * (t / -a);
} else if (y <= 5.1e+61) {
tmp = x * (y / a);
} else if (y <= 1e+88) {
tmp = t * -(z / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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) :: tmp
if (y <= (-1.2d-70)) then
tmp = y / (a / x)
else if (y <= 1.05d+16) then
tmp = z * (t / -a)
else if (y <= 5.1d+61) then
tmp = x * (y / a)
else if (y <= 1d+88) then
tmp = t * -(z / a)
else
tmp = x / (a / y)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.2e-70) {
tmp = y / (a / x);
} else if (y <= 1.05e+16) {
tmp = z * (t / -a);
} else if (y <= 5.1e+61) {
tmp = x * (y / a);
} else if (y <= 1e+88) {
tmp = t * -(z / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -1.2e-70: tmp = y / (a / x) elif y <= 1.05e+16: tmp = z * (t / -a) elif y <= 5.1e+61: tmp = x * (y / a) elif y <= 1e+88: tmp = t * -(z / a) else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.2e-70) tmp = Float64(y / Float64(a / x)); elseif (y <= 1.05e+16) tmp = Float64(z * Float64(t / Float64(-a))); elseif (y <= 5.1e+61) tmp = Float64(x * Float64(y / a)); elseif (y <= 1e+88) tmp = Float64(t * Float64(-Float64(z / a))); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -1.2e-70)
tmp = y / (a / x);
elseif (y <= 1.05e+16)
tmp = z * (t / -a);
elseif (y <= 5.1e+61)
tmp = x * (y / a);
elseif (y <= 1e+88)
tmp = t * -(z / a);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.2e-70], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e+16], N[(z * N[(t / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.1e+61], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+88], N[(t * (-N[(z / a), $MachinePrecision])), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{-70}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+16}:\\
\;\;\;\;z \cdot \frac{t}{-a}\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+61}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;y \leq 10^{+88}:\\
\;\;\;\;t \cdot \left(-\frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -1.2000000000000001e-70Initial program 86.0%
Taylor expanded in x around inf 60.4%
associate-/l*64.8%
Simplified64.8%
if -1.2000000000000001e-70 < y < 1.05e16Initial program 94.5%
Taylor expanded in x around 0 70.3%
associate-*r/70.3%
mul-1-neg70.3%
distribute-rgt-neg-out70.3%
*-commutative70.3%
associate-/l*67.9%
associate-/r/71.3%
Simplified71.3%
*-commutative71.3%
frac-2neg71.3%
remove-double-neg71.3%
associate-*r/70.3%
Applied egg-rr70.3%
associate-/l*71.2%
associate-/r/69.0%
Simplified69.0%
if 1.05e16 < y < 5.1000000000000001e61Initial program 99.1%
Taylor expanded in x around 0 99.1%
+-commutative99.1%
mul-1-neg99.1%
sub-neg99.1%
div-sub99.1%
fma-neg99.2%
distribute-rgt-neg-out99.2%
Simplified99.2%
Taylor expanded in y around inf 72.2%
associate-*l/72.7%
Simplified72.7%
if 5.1000000000000001e61 < y < 9.99999999999999959e87Initial program 71.9%
Taylor expanded in x around 0 44.8%
associate-*r/44.8%
mul-1-neg44.8%
distribute-rgt-neg-out44.8%
*-commutative44.8%
associate-/l*71.6%
associate-/r/71.8%
Simplified71.8%
if 9.99999999999999959e87 < y Initial program 88.0%
Taylor expanded in x around inf 76.3%
associate-*r/78.3%
Simplified78.3%
associate-*r/76.3%
*-commutative76.3%
associate-/l*84.3%
Applied egg-rr84.3%
Final simplification70.7%
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.8e-55)
(/ y (/ a x))
(if (<= y 7.5e+16)
(* z (/ t (- a)))
(if (<= y 2.6e+62)
(* x (/ y a))
(if (<= y 2.8e+88) (/ z (/ (- a) t)) (/ x (/ a y)))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.8e-55) {
tmp = y / (a / x);
} else if (y <= 7.5e+16) {
tmp = z * (t / -a);
} else if (y <= 2.6e+62) {
tmp = x * (y / a);
} else if (y <= 2.8e+88) {
tmp = z / (-a / t);
} else {
tmp = x / (a / y);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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) :: tmp
if (y <= (-1.8d-55)) then
tmp = y / (a / x)
else if (y <= 7.5d+16) then
tmp = z * (t / -a)
else if (y <= 2.6d+62) then
tmp = x * (y / a)
else if (y <= 2.8d+88) then
tmp = z / (-a / t)
else
tmp = x / (a / y)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.8e-55) {
tmp = y / (a / x);
} else if (y <= 7.5e+16) {
tmp = z * (t / -a);
} else if (y <= 2.6e+62) {
tmp = x * (y / a);
} else if (y <= 2.8e+88) {
tmp = z / (-a / t);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if y <= -1.8e-55: tmp = y / (a / x) elif y <= 7.5e+16: tmp = z * (t / -a) elif y <= 2.6e+62: tmp = x * (y / a) elif y <= 2.8e+88: tmp = z / (-a / t) else: tmp = x / (a / y) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.8e-55) tmp = Float64(y / Float64(a / x)); elseif (y <= 7.5e+16) tmp = Float64(z * Float64(t / Float64(-a))); elseif (y <= 2.6e+62) tmp = Float64(x * Float64(y / a)); elseif (y <= 2.8e+88) tmp = Float64(z / Float64(Float64(-a) / t)); else tmp = Float64(x / Float64(a / y)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (y <= -1.8e-55)
tmp = y / (a / x);
elseif (y <= 7.5e+16)
tmp = z * (t / -a);
elseif (y <= 2.6e+62)
tmp = x * (y / a);
elseif (y <= 2.8e+88)
tmp = z / (-a / t);
else
tmp = x / (a / y);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.8e-55], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+16], N[(z * N[(t / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+62], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.8e+88], N[(z / N[((-a) / t), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-55}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+16}:\\
\;\;\;\;z \cdot \frac{t}{-a}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+62}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{+88}:\\
\;\;\;\;\frac{z}{\frac{-a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -1.8e-55Initial program 85.6%
Taylor expanded in x around inf 59.4%
associate-/l*63.9%
Simplified63.9%
if -1.8e-55 < y < 7.5e16Initial program 94.6%
Taylor expanded in x around 0 69.1%
associate-*r/69.1%
mul-1-neg69.1%
distribute-rgt-neg-out69.1%
*-commutative69.1%
associate-/l*66.8%
associate-/r/70.1%
Simplified70.1%
*-commutative70.1%
frac-2neg70.1%
remove-double-neg70.1%
associate-*r/69.1%
Applied egg-rr69.1%
associate-/l*70.0%
associate-/r/67.8%
Simplified67.8%
if 7.5e16 < y < 2.59999999999999984e62Initial program 99.1%
Taylor expanded in x around 0 99.1%
+-commutative99.1%
mul-1-neg99.1%
sub-neg99.1%
div-sub99.1%
fma-neg99.2%
distribute-rgt-neg-out99.2%
Simplified99.2%
Taylor expanded in y around inf 72.2%
associate-*l/72.7%
Simplified72.7%
if 2.59999999999999984e62 < y < 2.79999999999999989e88Initial program 71.9%
Taylor expanded in x around 0 44.8%
associate-*r/44.8%
mul-1-neg44.8%
distribute-rgt-neg-out44.8%
*-commutative44.8%
associate-/l*71.6%
associate-/r/71.8%
Simplified71.8%
associate-*l/44.8%
associate-/l*71.6%
add-sqr-sqrt42.6%
sqrt-unprod29.8%
sqr-neg29.8%
sqrt-unprod0.7%
add-sqr-sqrt0.8%
Applied egg-rr0.8%
*-un-lft-identity0.8%
div-inv0.8%
times-frac0.7%
frac-2neg0.7%
metadata-eval0.7%
add-sqr-sqrt0.4%
sqrt-unprod2.1%
sqr-neg2.1%
sqrt-unprod1.8%
add-sqr-sqrt44.3%
Applied egg-rr44.3%
clear-num44.3%
frac-times71.6%
*-un-lft-identity71.6%
div-inv71.6%
metadata-eval71.6%
Applied egg-rr71.6%
*-rgt-identity71.6%
*-commutative71.6%
associate-*l/71.6%
neg-mul-171.6%
Simplified71.6%
if 2.79999999999999989e88 < y Initial program 88.0%
Taylor expanded in x around inf 76.3%
associate-*r/78.3%
Simplified78.3%
associate-*r/76.3%
*-commutative76.3%
associate-/l*84.3%
Applied egg-rr84.3%
Final simplification70.0%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) 5e+248) (/ (- (* x y) (* z t)) a) (/ y (/ a x))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 5e+248) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = y / (a / x);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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) :: tmp
if ((x * y) <= 5d+248) then
tmp = ((x * y) - (z * t)) / a
else
tmp = y / (a / x)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 5e+248) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = y / (a / x);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= 5e+248: tmp = ((x * y) - (z * t)) / a else: tmp = y / (a / x) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 5e+248) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(y / Float64(a / x)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= 5e+248)
tmp = ((x * y) - (z * t)) / a;
else
tmp = y / (a / x);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], 5e+248], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 5 \cdot 10^{+248}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if (*.f64 x y) < 4.9999999999999996e248Initial program 92.7%
if 4.9999999999999996e248 < (*.f64 x y) Initial program 69.4%
Taylor expanded in x around inf 69.4%
associate-/l*96.3%
Simplified96.3%
Final simplification93.1%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= x -8.4e+218) (* y (/ x a)) (* x (/ y a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8.4e+218) {
tmp = y * (x / a);
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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) :: tmp
if (x <= (-8.4d+218)) then
tmp = y * (x / a)
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8.4e+218) {
tmp = y * (x / a);
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if x <= -8.4e+218: tmp = y * (x / a) else: tmp = x * (y / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (x <= -8.4e+218) tmp = Float64(y * Float64(x / a)); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (x <= -8.4e+218)
tmp = y * (x / a);
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[x, -8.4e+218], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.4 \cdot 10^{+218}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if x < -8.3999999999999995e218Initial program 89.4%
Taylor expanded in x around inf 76.0%
associate-*r/89.4%
Simplified89.4%
if -8.3999999999999995e218 < x Initial program 90.2%
Taylor expanded in x around 0 89.3%
+-commutative89.3%
mul-1-neg89.3%
sub-neg89.3%
div-sub90.2%
fma-neg90.2%
distribute-rgt-neg-out90.2%
Simplified90.2%
Taylor expanded in y around inf 47.4%
associate-*l/49.6%
Simplified49.6%
Final simplification54.0%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= x -1.35e+219) (/ y (/ a x)) (* x (/ y a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.35e+219) {
tmp = y / (a / x);
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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) :: tmp
if (x <= (-1.35d+219)) then
tmp = y / (a / x)
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.35e+219) {
tmp = y / (a / x);
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if x <= -1.35e+219: tmp = y / (a / x) else: tmp = x * (y / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.35e+219) tmp = Float64(y / Float64(a / x)); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (x <= -1.35e+219)
tmp = y / (a / x);
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.35e+219], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+219}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if x < -1.3499999999999999e219Initial program 89.4%
Taylor expanded in x around inf 76.0%
associate-/l*89.4%
Simplified89.4%
if -1.3499999999999999e219 < x Initial program 90.2%
Taylor expanded in x around 0 89.3%
+-commutative89.3%
mul-1-neg89.3%
sub-neg89.3%
div-sub90.2%
fma-neg90.2%
distribute-rgt-neg-out90.2%
Simplified90.2%
Taylor expanded in y around inf 47.4%
associate-*l/49.6%
Simplified49.6%
Final simplification54.0%
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* y (/ x a)))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
NOTE: x and y should be sorted in increasing order before calling this function.
NOTE: z and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a)
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
code = y * (x / a)
end function
assert x < y;
assert z < t;
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): return y * (x / a)
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y = num2cell(sort([x, y])){:}
z, t = num2cell(sort([z, t])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / a);
end
NOTE: x and y should be sorted in increasing order before calling this function. NOTE: z and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 90.1%
Taylor expanded in x around inf 50.6%
associate-*r/53.1%
Simplified53.1%
Final simplification53.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* (/ y a) x) (* (/ t a) z))))
(if (< z -2.468684968699548e+170)
t_1
(if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
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) :: t_1
real(8) :: tmp
t_1 = ((y / a) * x) - ((t / a) * z)
if (z < (-2.468684968699548d+170)) then
tmp = t_1
else if (z < 6.309831121978371d-71) then
tmp = ((x * y) - (z * t)) / a
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 t_1 = ((y / a) * x) - ((t / a) * z);
double tmp;
if (z < -2.468684968699548e+170) {
tmp = t_1;
} else if (z < 6.309831121978371e-71) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y / a) * x) - ((t / a) * z) tmp = 0 if z < -2.468684968699548e+170: tmp = t_1 elif z < 6.309831121978371e-71: tmp = ((x * y) - (z * t)) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y / a) * x) - Float64(Float64(t / a) * z)) tmp = 0.0 if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y / a) * x) - ((t / a) * z); tmp = 0.0; if (z < -2.468684968699548e+170) tmp = t_1; elseif (z < 6.309831121978371e-71) tmp = ((x * y) - (z * t)) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y / a), $MachinePrecision] * x), $MachinePrecision] - N[(N[(t / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -2.468684968699548e+170], t$95$1, If[Less[z, 6.309831121978371e-71], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\
\mathbf{if}\;z < -2.468684968699548 \cdot 10^{+170}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z < 6.309831121978371 \cdot 10^{-71}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023229
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:herbie-target
(if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))
(/ (- (* x y) (* z t)) a))