
(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 8 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 (<= t_1 -1e+295)
(fma x (/ y a) (- (/ z (/ a t))))
(if (<= t_1 5e+140) (/ t_1 a) (fma x (/ y a) (/ -1.0 (/ (/ a t) 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 <= -1e+295) {
tmp = fma(x, (y / a), -(z / (a / t)));
} else if (t_1 <= 5e+140) {
tmp = t_1 / a;
} else {
tmp = fma(x, (y / a), (-1.0 / ((a / t) / 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 <= -1e+295) tmp = fma(x, Float64(y / a), Float64(-Float64(z / Float64(a / t)))); elseif (t_1 <= 5e+140) tmp = Float64(t_1 / a); else tmp = fma(x, Float64(y / a), Float64(-1.0 / Float64(Float64(a / t) / z))); 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[LessEqual[t$95$1, -1e+295], N[(x * N[(y / a), $MachinePrecision] + (-N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$1, 5e+140], N[(t$95$1 / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision] + N[(-1.0 / N[(N[(a / t), $MachinePrecision] / 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 -1 \cdot 10^{+295}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{a}, -\frac{z}{\frac{a}{t}}\right)\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+140}:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{a}, \frac{-1}{\frac{\frac{a}{t}}{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999998e294Initial program 72.5%
div-sub63.7%
*-un-lft-identity63.7%
times-frac76.9%
fma-neg76.9%
associate-/l*88.1%
Applied egg-rr88.1%
if -9.9999999999999998e294 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000008e140Initial program 99.0%
if 5.00000000000000008e140 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 85.0%
div-sub82.3%
*-un-lft-identity82.3%
times-frac88.5%
fma-neg89.8%
associate-/l*97.3%
Applied egg-rr97.3%
clear-num97.3%
inv-pow97.3%
associate-/l/89.8%
Applied egg-rr89.8%
unpow-189.8%
*-commutative89.8%
associate-/r*97.3%
Simplified97.3%
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 -1e+295) (not (<= t_1 5e+140)))
(fma x (/ y a) (- (/ 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 <= -1e+295) || !(t_1 <= 5e+140)) {
tmp = fma(x, (y / a), -(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 <= -1e+295) || !(t_1 <= 5e+140)) tmp = fma(x, Float64(y / a), Float64(-Float64(z / Float64(a / t)))); 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, -1e+295], N[Not[LessEqual[t$95$1, 5e+140]], $MachinePrecision]], N[(x * N[(y / a), $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 -1 \cdot 10^{+295} \lor \neg \left(t_1 \leq 5 \cdot 10^{+140}\right):\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{a}, -\frac{z}{\frac{a}{t}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999998e294 or 5.00000000000000008e140 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 81.1%
div-sub76.6%
*-un-lft-identity76.6%
times-frac84.9%
fma-neg85.8%
associate-/l*94.4%
Applied egg-rr94.4%
if -9.9999999999999998e294 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.00000000000000008e140Initial program 99.0%
Final simplification97.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 (/ x (/ a y))) (t_2 (- (* x y) (* z t))))
(if (<= t_2 -1e+295)
(- t_1 (/ z (/ a t)))
(if (<= t_2 5e+188) (/ t_2 a) (+ (/ -1.0 (/ (/ a t) z)) t_1)))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = x / (a / y);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -1e+295) {
tmp = t_1 - (z / (a / t));
} else if (t_2 <= 5e+188) {
tmp = t_2 / a;
} else {
tmp = (-1.0 / ((a / t) / z)) + t_1;
}
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) :: t_2
real(8) :: tmp
t_1 = x / (a / y)
t_2 = (x * y) - (z * t)
if (t_2 <= (-1d+295)) then
tmp = t_1 - (z / (a / t))
else if (t_2 <= 5d+188) then
tmp = t_2 / a
else
tmp = ((-1.0d0) / ((a / t) / z)) + t_1
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 / (a / y);
double t_2 = (x * y) - (z * t);
double tmp;
if (t_2 <= -1e+295) {
tmp = t_1 - (z / (a / t));
} else if (t_2 <= 5e+188) {
tmp = t_2 / a;
} else {
tmp = (-1.0 / ((a / t) / z)) + t_1;
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = x / (a / y) t_2 = (x * y) - (z * t) tmp = 0 if t_2 <= -1e+295: tmp = t_1 - (z / (a / t)) elif t_2 <= 5e+188: tmp = t_2 / a else: tmp = (-1.0 / ((a / t) / z)) + t_1 return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(x / Float64(a / y)) t_2 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_2 <= -1e+295) tmp = Float64(t_1 - Float64(z / Float64(a / t))); elseif (t_2 <= 5e+188) tmp = Float64(t_2 / a); else tmp = Float64(Float64(-1.0 / Float64(Float64(a / t) / z)) + t_1); 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 / (a / y);
t_2 = (x * y) - (z * t);
tmp = 0.0;
if (t_2 <= -1e+295)
tmp = t_1 - (z / (a / t));
elseif (t_2 <= 5e+188)
tmp = t_2 / a;
else
tmp = (-1.0 / ((a / t) / z)) + t_1;
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[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+295], N[(t$95$1 - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+188], N[(t$95$2 / a), $MachinePrecision], N[(N[(-1.0 / N[(N[(a / t), $MachinePrecision] / z), $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{x}{\frac{a}{y}}\\
t_2 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_2 \leq -1 \cdot 10^{+295}:\\
\;\;\;\;t_1 - \frac{z}{\frac{a}{t}}\\
\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+188}:\\
\;\;\;\;\frac{t_2}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{\frac{a}{t}}{z}} + t_1\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -9.9999999999999998e294Initial program 72.5%
div-sub63.7%
associate-/l*77.0%
associate-/l*88.1%
Applied egg-rr88.1%
if -9.9999999999999998e294 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000001e188Initial program 99.1%
if 5.0000000000000001e188 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 83.0%
div-sub80.0%
associate-/l*87.0%
associate-/l*96.8%
Applied egg-rr96.8%
clear-num98.3%
inv-pow98.3%
associate-/l/88.4%
Applied egg-rr86.9%
unpow-188.4%
*-commutative88.4%
associate-/r*98.3%
Simplified96.8%
Final simplification97.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 (- (* x y) (* z t))))
(if (or (<= t_1 -1e+295) (not (<= t_1 5e+188)))
(- (/ 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 <= -1e+295) || !(t_1 <= 5e+188)) {
tmp = (x / (a / y)) - (z / (a / t));
} 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 <= (-1d+295)) .or. (.not. (t_1 <= 5d+188))) then
tmp = (x / (a / y)) - (z / (a / t))
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 <= -1e+295) || !(t_1 <= 5e+188)) {
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 <= -1e+295) or not (t_1 <= 5e+188): 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 <= -1e+295) || !(t_1 <= 5e+188)) 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 <= -1e+295) || ~((t_1 <= 5e+188)))
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, -1e+295], N[Not[LessEqual[t$95$1, 5e+188]], $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 -1 \cdot 10^{+295} \lor \neg \left(t_1 \leq 5 \cdot 10^{+188}\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)) < -9.9999999999999998e294 or 5.0000000000000001e188 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 79.4%
div-sub74.5%
associate-/l*83.6%
associate-/l*93.9%
Applied egg-rr93.9%
if -9.9999999999999998e294 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000001e188Initial program 99.1%
Final simplification97.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 (<= (* z t) -1e+299) (* z (/ (- t) a)) (/ (- (* x y) (* z t)) a)))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -1e+299) {
tmp = z * (-t / a);
} else {
tmp = ((x * y) - (z * t)) / 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 * t) <= (-1d+299)) then
tmp = z * (-t / a)
else
tmp = ((x * y) - (z * t)) / 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 * t) <= -1e+299) {
tmp = z * (-t / a);
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -1e+299: tmp = z * (-t / a) else: tmp = ((x * y) - (z * t)) / a return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= -1e+299) tmp = Float64(z * Float64(Float64(-t) / a)); else tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / 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 * t) <= -1e+299)
tmp = z * (-t / a);
else
tmp = ((x * y) - (z * t)) / 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[N[(z * t), $MachinePrecision], -1e+299], N[(z * N[((-t) / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - 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}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+299}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -1.0000000000000001e299Initial program 69.7%
div-sub60.6%
*-un-lft-identity60.6%
times-frac60.6%
fma-neg65.2%
associate-/l*95.2%
Applied egg-rr95.2%
Taylor expanded in x around 0 69.7%
associate-*l/99.8%
associate-*r*99.8%
neg-mul-199.8%
*-commutative99.8%
distribute-neg-frac99.8%
Simplified99.8%
if -1.0000000000000001e299 < (*.f64 z t) Initial program 93.3%
Final simplification93.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 (if (<= y -1.6e-90) (/ x (/ a y)) (if (<= y 6.6e+63) (* z (/ (- t) 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 (y <= -1.6e-90) {
tmp = x / (a / y);
} else if (y <= 6.6e+63) {
tmp = z * (-t / 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 (y <= (-1.6d-90)) then
tmp = x / (a / y)
else if (y <= 6.6d+63) then
tmp = z * (-t / 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 (y <= -1.6e-90) {
tmp = x / (a / y);
} else if (y <= 6.6e+63) {
tmp = z * (-t / 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 y <= -1.6e-90: tmp = x / (a / y) elif y <= 6.6e+63: tmp = z * (-t / 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 (y <= -1.6e-90) tmp = Float64(x / Float64(a / y)); elseif (y <= 6.6e+63) tmp = Float64(z * Float64(Float64(-t) / 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 (y <= -1.6e-90)
tmp = x / (a / y);
elseif (y <= 6.6e+63)
tmp = z * (-t / 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[y, -1.6e-90], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.6e+63], N[(z * N[((-t) / 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}\;y \leq -1.6 \cdot 10^{-90}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+63}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if y < -1.60000000000000004e-90Initial program 94.4%
Taylor expanded in x around inf 54.1%
associate-*r/56.4%
Simplified56.4%
*-commutative56.4%
associate-*l/54.1%
associate-/l*56.2%
Applied egg-rr56.2%
if -1.60000000000000004e-90 < y < 6.6000000000000003e63Initial program 92.2%
div-sub92.2%
*-un-lft-identity92.2%
times-frac89.4%
fma-neg89.4%
associate-/l*91.3%
Applied egg-rr91.3%
Taylor expanded in x around 0 67.4%
associate-*l/71.3%
associate-*r*71.3%
neg-mul-171.3%
*-commutative71.3%
distribute-neg-frac71.3%
Simplified71.3%
if 6.6000000000000003e63 < y Initial program 84.7%
Taylor expanded in x around inf 65.6%
associate-*r/73.6%
Simplified73.6%
Final simplification66.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.7e-90) (/ x (/ a y)) (if (<= y 1.4e+64) (/ z (/ (- a) t)) (* y (/ x a)))))
assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.7e-90) {
tmp = x / (a / y);
} else if (y <= 1.4e+64) {
tmp = z / (-a / t);
} 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 (y <= (-1.7d-90)) then
tmp = x / (a / y)
else if (y <= 1.4d+64) then
tmp = z / (-a / t)
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 (y <= -1.7e-90) {
tmp = x / (a / y);
} else if (y <= 1.4e+64) {
tmp = z / (-a / t);
} 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 y <= -1.7e-90: tmp = x / (a / y) elif y <= 1.4e+64: tmp = z / (-a / t) 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 (y <= -1.7e-90) tmp = Float64(x / Float64(a / y)); elseif (y <= 1.4e+64) tmp = Float64(z / Float64(Float64(-a) / t)); 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 (y <= -1.7e-90)
tmp = x / (a / y);
elseif (y <= 1.4e+64)
tmp = z / (-a / t);
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[y, -1.7e-90], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+64], N[(z / N[((-a) / t), $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}\;y \leq -1.7 \cdot 10^{-90}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+64}:\\
\;\;\;\;\frac{z}{\frac{-a}{t}}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if y < -1.69999999999999997e-90Initial program 94.4%
Taylor expanded in x around inf 54.1%
associate-*r/56.4%
Simplified56.4%
*-commutative56.4%
associate-*l/54.1%
associate-/l*56.2%
Applied egg-rr56.2%
if -1.69999999999999997e-90 < y < 1.40000000000000012e64Initial program 92.2%
Taylor expanded in x around 0 67.4%
associate-*r/67.4%
mul-1-neg67.4%
distribute-rgt-neg-out67.4%
*-commutative67.4%
associate-/l*70.8%
associate-/r/70.2%
Simplified70.2%
associate-*l/67.4%
associate-/l*70.8%
add-sqr-sqrt41.7%
sqrt-unprod36.6%
sqr-neg36.6%
sqrt-unprod5.1%
add-sqr-sqrt11.4%
frac-2neg11.4%
add-sqr-sqrt6.3%
sqrt-unprod30.0%
sqr-neg30.0%
sqrt-unprod28.9%
add-sqr-sqrt70.8%
distribute-neg-frac70.8%
Applied egg-rr70.8%
if 1.40000000000000012e64 < y Initial program 84.7%
Taylor expanded in x around inf 65.6%
associate-*r/73.6%
Simplified73.6%
Final simplification66.5%
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 91.3%
Taylor expanded in x around inf 48.9%
associate-*r/49.9%
Simplified49.9%
Final simplification49.9%
(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 2023185
(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))