
(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 10 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 (/ t (/ a z))) (t_2 (- (* x y) (* z t))))
(if (<= t_2 -5e+272)
(fma -1.0 t_1 (/ y (/ a x)))
(if (<= t_2 1e+288)
(* (fma x y (* t (- z))) (/ 1.0 a))
(- (* x (/ y a)) t_1)))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = t / (a / z);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -5e+272) {
tmp = fma(-1.0, t_1, (y / (a / x)));
} else if (t_2 <= 1e+288) {
tmp = fma(x, y, (t * -z)) * (1.0 / a);
} else {
tmp = (x * (y / a)) - t_1;
}
return tmp;
}
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(t / Float64(a / z)) t_2 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_2 <= -5e+272) tmp = fma(-1.0, t_1, Float64(y / Float64(a / x))); elseif (t_2 <= 1e+288) tmp = Float64(fma(x, y, Float64(t * Float64(-z))) * Float64(1.0 / a)); else tmp = Float64(Float64(x * Float64(y / a)) - t_1); 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[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+272], N[(-1.0 * t$95$1 + N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+288], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] * N[(1.0 / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{t}{\frac{a}{z}}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_2 \leq -5 \cdot 10^{+272}:\\
\;\;\;\;\mathsf{fma}\left(-1, t_1, \frac{y}{\frac{a}{x}}\right)\\
\mathbf{elif}\;t_2 \leq 10^{+288}:\\
\;\;\;\;\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right) \cdot \frac{1}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a} - t_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.99999999999999973e272Initial program 69.6%
Taylor expanded in x around 0 69.6%
fma-def69.6%
associate-/l*82.2%
associate-/l*99.8%
Simplified99.8%
if -4.99999999999999973e272 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288Initial program 99.1%
div-inv99.2%
fma-neg99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
Applied egg-rr99.2%
if 1e288 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 71.6%
div-inv71.6%
fma-neg71.6%
*-commutative71.6%
distribute-rgt-neg-in71.6%
Applied egg-rr71.6%
*-commutative71.6%
fma-udef71.6%
*-commutative71.6%
distribute-rgt-neg-out71.6%
distribute-lft-neg-out71.6%
distribute-rgt-in68.9%
div-inv68.8%
distribute-lft-neg-out68.8%
distribute-lft-neg-in68.8%
div-inv68.8%
unsub-neg68.8%
associate-/l*89.4%
associate-/r/86.7%
associate-/l*91.7%
Applied egg-rr91.7%
Final simplification98.2%
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 -5e+274) (not (<= t_1 1e+288)))
(- (* x (/ y a)) (/ t (/ a z)))
(* (fma x y (* t (- z))) (/ 1.0 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 <= -5e+274) || !(t_1 <= 1e+288)) {
tmp = (x * (y / a)) - (t / (a / z));
} else {
tmp = fma(x, y, (t * -z)) * (1.0 / 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 <= -5e+274) || !(t_1 <= 1e+288)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(t / Float64(a / z))); else tmp = Float64(fma(x, y, Float64(t * Float64(-z))) * Float64(1.0 / 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, -5e+274], N[Not[LessEqual[t$95$1, 1e+288]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * y + N[(t * (-z)), $MachinePrecision]), $MachinePrecision] * N[(1.0 / a), $MachinePrecision]), $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 -5 \cdot 10^{+274} \lor \neg \left(t_1 \leq 10^{+288}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, t \cdot \left(-z\right)\right) \cdot \frac{1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999998e274 or 1e288 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 70.2%
div-inv70.2%
fma-neg70.2%
*-commutative70.2%
distribute-rgt-neg-in70.2%
Applied egg-rr70.2%
*-commutative70.2%
fma-udef70.2%
*-commutative70.2%
distribute-rgt-neg-out70.2%
distribute-lft-neg-out70.2%
distribute-rgt-in68.8%
div-inv68.8%
distribute-lft-neg-out68.8%
distribute-lft-neg-in68.8%
div-inv68.8%
unsub-neg68.8%
associate-/l*88.1%
associate-/r/85.4%
associate-/l*94.3%
Applied egg-rr94.3%
if -4.9999999999999998e274 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288Initial program 99.1%
div-inv99.2%
fma-neg99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
Applied egg-rr99.2%
Final simplification97.8%
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 -5e+274) (not (<= t_1 1e+288)))
(- (* x (/ y a)) (/ t (/ a z)))
(/ 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 <= -5e+274) || !(t_1 <= 1e+288)) {
tmp = (x * (y / a)) - (t / (a / z));
} else {
tmp = t_1 / 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) :: t_1
real(8) :: tmp
t_1 = (x * y) - (z * t)
if ((t_1 <= (-5d+274)) .or. (.not. (t_1 <= 1d+288))) then
tmp = (x * (y / a)) - (t / (a / z))
else
tmp = t_1 / 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 t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -5e+274) || !(t_1 <= 1e+288)) {
tmp = (x * (y / a)) - (t / (a / z));
} 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 <= -5e+274) or not (t_1 <= 1e+288): tmp = (x * (y / a)) - (t / (a / z)) 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 <= -5e+274) || !(t_1 <= 1e+288)) tmp = Float64(Float64(x * Float64(y / a)) - Float64(t / Float64(a / z))); 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 <= -5e+274) || ~((t_1 <= 1e+288)))
tmp = (x * (y / a)) - (t / (a / z));
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, -5e+274], N[Not[LessEqual[t$95$1, 1e+288]], $MachinePrecision]], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a / z), $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 -5 \cdot 10^{+274} \lor \neg \left(t_1 \leq 10^{+288}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999998e274 or 1e288 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 70.2%
div-inv70.2%
fma-neg70.2%
*-commutative70.2%
distribute-rgt-neg-in70.2%
Applied egg-rr70.2%
*-commutative70.2%
fma-udef70.2%
*-commutative70.2%
distribute-rgt-neg-out70.2%
distribute-lft-neg-out70.2%
distribute-rgt-in68.8%
div-inv68.8%
distribute-lft-neg-out68.8%
distribute-lft-neg-in68.8%
div-inv68.8%
unsub-neg68.8%
associate-/l*88.1%
associate-/r/85.4%
associate-/l*94.3%
Applied egg-rr94.3%
if -4.9999999999999998e274 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288Initial program 99.1%
Final simplification97.8%
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 (<= t_1 -5e+255)
(- (/ x (/ a y)) (/ z (/ a t)))
(if (<= t_1 1e+288) (/ t_1 a) (- (* x (/ y a)) (/ t (/ a z)))))))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 <= -5e+255) {
tmp = (x / (a / y)) - (z / (a / t));
} else if (t_1 <= 1e+288) {
tmp = t_1 / a;
} else {
tmp = (x * (y / a)) - (t / (a / z));
}
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 = (x * y) - (z * t)
if (t_1 <= (-5d+255)) then
tmp = (x / (a / y)) - (z / (a / t))
else if (t_1 <= 1d+288) then
tmp = t_1 / a
else
tmp = (x * (y / a)) - (t / (a / z))
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 = (x * y) - (z * t);
double tmp;
if (t_1 <= -5e+255) {
tmp = (x / (a / y)) - (z / (a / t));
} else if (t_1 <= 1e+288) {
tmp = t_1 / a;
} else {
tmp = (x * (y / a)) - (t / (a / z));
}
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 <= -5e+255: tmp = (x / (a / y)) - (z / (a / t)) elif t_1 <= 1e+288: tmp = t_1 / a else: tmp = (x * (y / a)) - (t / (a / z)) 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 <= -5e+255) tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); elseif (t_1 <= 1e+288) tmp = Float64(t_1 / a); else tmp = Float64(Float64(x * Float64(y / a)) - Float64(t / Float64(a / z))); 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 <= -5e+255)
tmp = (x / (a / y)) - (z / (a / t));
elseif (t_1 <= 1e+288)
tmp = t_1 / a;
else
tmp = (x * (y / a)) - (t / (a / z));
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[LessEqual[t$95$1, -5e+255], N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+288], N[(t$95$1 / a), $MachinePrecision], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision]), $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 -5 \cdot 10^{+255}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{elif}\;t_1 \leq 10^{+288}:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -5.0000000000000002e255Initial program 72.5%
div-sub72.5%
associate-/l*85.9%
associate-/l*97.4%
Applied egg-rr97.4%
if -5.0000000000000002e255 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e288Initial program 99.1%
if 1e288 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 71.6%
div-inv71.6%
fma-neg71.6%
*-commutative71.6%
distribute-rgt-neg-in71.6%
Applied egg-rr71.6%
*-commutative71.6%
fma-udef71.6%
*-commutative71.6%
distribute-rgt-neg-out71.6%
distribute-lft-neg-out71.6%
distribute-rgt-in68.9%
div-inv68.8%
distribute-lft-neg-out68.8%
distribute-lft-neg-in68.8%
div-inv68.8%
unsub-neg68.8%
associate-/l*89.4%
associate-/r/86.7%
associate-/l*91.7%
Applied egg-rr91.7%
Final simplification97.8%
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) -2e+269) (/ y (/ a x)) (if (<= (* x y) 5e+207) (/ (- (* x y) (* z t)) 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 ((x * y) <= -2e+269) {
tmp = y / (a / x);
} else if ((x * y) <= 5e+207) {
tmp = ((x * y) - (z * t)) / 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 ((x * y) <= (-2d+269)) then
tmp = y / (a / x)
else if ((x * y) <= 5d+207) then
tmp = ((x * y) - (z * t)) / 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 ((x * y) <= -2e+269) {
tmp = y / (a / x);
} else if ((x * y) <= 5e+207) {
tmp = ((x * y) - (z * t)) / 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 (x * y) <= -2e+269: tmp = y / (a / x) elif (x * y) <= 5e+207: tmp = ((x * y) - (z * t)) / 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 (Float64(x * y) <= -2e+269) tmp = Float64(y / Float64(a / x)); elseif (Float64(x * y) <= 5e+207) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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 ((x * y) <= -2e+269)
tmp = y / (a / x);
elseif ((x * y) <= 5e+207)
tmp = ((x * y) - (z * t)) / 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[N[(x * y), $MachinePrecision], -2e+269], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+207], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $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}\;x \cdot y \leq -2 \cdot 10^{+269}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+207}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e269Initial program 70.2%
Taylor expanded in x around inf 70.2%
associate-/l*99.8%
Simplified99.8%
if -2.0000000000000001e269 < (*.f64 x y) < 4.9999999999999999e207Initial program 95.6%
if 4.9999999999999999e207 < (*.f64 x y) Initial program 70.5%
div-inv70.6%
fma-neg70.6%
*-commutative70.6%
distribute-rgt-neg-in70.6%
Applied egg-rr70.6%
Taylor expanded in x around inf 70.5%
*-commutative70.5%
associate-/l*99.9%
Simplified99.9%
Final simplification96.4%
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.3e-67) (/ x (/ a y)) (if (<= y 5.8e+39) (/ (- t) (/ a z)) (* x (/ y a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.3e-67) {
tmp = x / (a / y);
} else if (y <= 5.8e+39) {
tmp = -t / (a / z);
} 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 (y <= (-1.3d-67)) then
tmp = x / (a / y)
else if (y <= 5.8d+39) then
tmp = -t / (a / z)
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 (y <= -1.3e-67) {
tmp = x / (a / y);
} else if (y <= 5.8e+39) {
tmp = -t / (a / z);
} 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 y <= -1.3e-67: tmp = x / (a / y) elif y <= 5.8e+39: tmp = -t / (a / z) 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 (y <= -1.3e-67) tmp = Float64(x / Float64(a / y)); elseif (y <= 5.8e+39) tmp = Float64(Float64(-t) / Float64(a / z)); 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 (y <= -1.3e-67)
tmp = x / (a / y);
elseif (y <= 5.8e+39)
tmp = -t / (a / z);
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[y, -1.3e-67], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+39], N[((-t) / N[(a / z), $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}\;y \leq -1.3 \cdot 10^{-67}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+39}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < -1.2999999999999999e-67Initial program 86.7%
div-inv86.8%
fma-neg86.8%
*-commutative86.8%
distribute-rgt-neg-in86.8%
Applied egg-rr86.8%
Taylor expanded in x around inf 58.0%
*-commutative58.0%
associate-/l*64.5%
Simplified64.5%
if -1.2999999999999999e-67 < y < 5.80000000000000059e39Initial program 95.8%
Taylor expanded in x around 0 73.0%
associate-*r/73.0%
associate-*r*73.0%
neg-mul-173.0%
Simplified73.0%
associate-/l*73.2%
distribute-frac-neg73.2%
Applied egg-rr73.2%
if 5.80000000000000059e39 < y Initial program 85.8%
Taylor expanded in x around inf 62.2%
associate-/l*72.3%
associate-/r/74.3%
Applied egg-rr74.3%
Final simplification70.4%
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.3e-67) (/ x (/ a y)) (if (<= y 1.35e+40) (* z (/ (- t) 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 (y <= -1.3e-67) {
tmp = x / (a / y);
} else if (y <= 1.35e+40) {
tmp = z * (-t / 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 (y <= (-1.3d-67)) then
tmp = x / (a / y)
else if (y <= 1.35d+40) then
tmp = z * (-t / 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 (y <= -1.3e-67) {
tmp = x / (a / y);
} else if (y <= 1.35e+40) {
tmp = z * (-t / 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 y <= -1.3e-67: tmp = x / (a / y) elif y <= 1.35e+40: tmp = z * (-t / 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 (y <= -1.3e-67) tmp = Float64(x / Float64(a / y)); elseif (y <= 1.35e+40) tmp = Float64(z * Float64(Float64(-t) / 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 (y <= -1.3e-67)
tmp = x / (a / y);
elseif (y <= 1.35e+40)
tmp = z * (-t / 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[y, -1.3e-67], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+40], N[(z * N[((-t) / 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}\;y \leq -1.3 \cdot 10^{-67}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+40}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < -1.2999999999999999e-67Initial program 86.7%
div-inv86.8%
fma-neg86.8%
*-commutative86.8%
distribute-rgt-neg-in86.8%
Applied egg-rr86.8%
Taylor expanded in x around inf 58.0%
*-commutative58.0%
associate-/l*64.5%
Simplified64.5%
if -1.2999999999999999e-67 < y < 1.35000000000000005e40Initial program 95.8%
div-sub95.0%
associate-/l*91.9%
associate-/l*88.8%
Applied egg-rr88.8%
add-sqr-sqrt47.9%
sqrt-unprod49.0%
sqr-neg49.0%
sqrt-unprod14.6%
add-sqr-sqrt32.4%
distribute-neg-frac32.4%
associate-/r/33.2%
distribute-lft-neg-in33.2%
distribute-frac-neg33.2%
div-inv33.2%
associate-*l*32.4%
add-sqr-sqrt14.6%
sqrt-unprod49.0%
sqr-neg49.0%
sqrt-unprod47.9%
add-sqr-sqrt88.7%
Applied egg-rr88.7%
Taylor expanded in x around 0 73.0%
mul-1-neg73.0%
associate-*l/70.7%
distribute-rgt-neg-in70.7%
Simplified70.7%
if 1.35000000000000005e40 < y Initial program 85.8%
Taylor expanded in x around inf 62.2%
associate-/l*72.3%
associate-/r/74.3%
Applied egg-rr74.3%
Final simplification69.3%
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 (<= z -5.2e-72) (* x (/ y a)) (* y (/ x a))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.2e-72) {
tmp = x * (y / a);
} else {
tmp = y * (x / 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 (z <= (-5.2d-72)) then
tmp = x * (y / a)
else
tmp = y * (x / 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 (z <= -5.2e-72) {
tmp = x * (y / a);
} else {
tmp = y * (x / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if z <= -5.2e-72: tmp = x * (y / a) else: tmp = y * (x / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.2e-72) tmp = Float64(x * Float64(y / a)); else tmp = Float64(y * Float64(x / 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 (z <= -5.2e-72)
tmp = x * (y / a);
else
tmp = y * (x / 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[z, -5.2e-72], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{-72}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if z < -5.19999999999999992e-72Initial program 88.8%
Taylor expanded in x around inf 33.5%
associate-/l*42.0%
associate-/r/35.9%
Applied egg-rr35.9%
if -5.19999999999999992e-72 < z Initial program 91.8%
Taylor expanded in x around inf 56.9%
associate-*r/58.4%
Simplified58.4%
Final simplification51.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 (<= z -5e-68) (* x (/ y 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 (z <= -5e-68) {
tmp = x * (y / 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 (z <= (-5d-68)) then
tmp = x * (y / 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 (z <= -5e-68) {
tmp = x * (y / 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 z <= -5e-68: tmp = x * (y / 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 (z <= -5e-68) tmp = Float64(x * Float64(y / 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 (z <= -5e-68)
tmp = x * (y / 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[z, -5e-68], N[(x * N[(y / a), $MachinePrecision]), $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}\;z \leq -5 \cdot 10^{-68}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if z < -4.99999999999999971e-68Initial program 88.6%
Taylor expanded in x around inf 32.6%
associate-/l*41.2%
associate-/r/35.1%
Applied egg-rr35.1%
if -4.99999999999999971e-68 < z Initial program 91.8%
Taylor expanded in x around inf 57.1%
associate-/l*58.8%
Simplified58.8%
Final simplification51.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 (* 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.9%
Taylor expanded in x around inf 49.9%
associate-*r/53.5%
Simplified53.5%
Final simplification53.5%
(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 2023200
(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))