
(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 9 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)) a))) (if (<= t_1 2e+283) t_1 (fma -1.0 (/ t (/ a z)) (/ y (/ a x))))))
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)) / a;
double tmp;
if (t_1 <= 2e+283) {
tmp = t_1;
} else {
tmp = fma(-1.0, (t / (a / z)), (y / (a / x)));
}
return tmp;
}
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a) tmp = 0.0 if (t_1 <= 2e+283) tmp = t_1; else tmp = fma(-1.0, Float64(t / Float64(a / z)), Float64(y / Float64(a / x))); 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[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+283], t$95$1, N[(-1.0 * N[(t / N[(a / z), $MachinePrecision]), $MachinePrecision] + N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y - z \cdot t}{a}\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+283}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-1, \frac{t}{\frac{a}{z}}, \frac{y}{\frac{a}{x}}\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 1.99999999999999991e283Initial program 98.8%
if 1.99999999999999991e283 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 72.5%
Taylor expanded in x around 0 68.3%
fma-def68.3%
associate-/l*78.0%
associate-/l*91.5%
Simplified91.5%
Final simplification97.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 (<= (* x y) -5e-114)
(* y (/ x a))
(if (or (<= (* x y) 1e-152)
(and (not (<= (* x y) 5e-43)) (<= (* x y) 5000.0)))
(/ (* 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) <= -5e-114) {
tmp = y * (x / a);
} else if (((x * y) <= 1e-152) || (!((x * y) <= 5e-43) && ((x * y) <= 5000.0))) {
tmp = (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) <= (-5d-114)) then
tmp = y * (x / a)
else if (((x * y) <= 1d-152) .or. (.not. ((x * y) <= 5d-43)) .and. ((x * y) <= 5000.0d0)) then
tmp = (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) <= -5e-114) {
tmp = y * (x / a);
} else if (((x * y) <= 1e-152) || (!((x * y) <= 5e-43) && ((x * y) <= 5000.0))) {
tmp = (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) <= -5e-114: tmp = y * (x / a) elif ((x * y) <= 1e-152) or (not ((x * y) <= 5e-43) and ((x * y) <= 5000.0)): tmp = (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) <= -5e-114) tmp = Float64(y * Float64(x / a)); elseif ((Float64(x * y) <= 1e-152) || (!(Float64(x * y) <= 5e-43) && (Float64(x * y) <= 5000.0))) tmp = Float64(Float64(z * Float64(-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) <= -5e-114)
tmp = y * (x / a);
elseif (((x * y) <= 1e-152) || (~(((x * y) <= 5e-43)) && ((x * y) <= 5000.0)))
tmp = (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], -5e-114], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], 1e-152], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e-43]], $MachinePrecision], LessEqual[N[(x * y), $MachinePrecision], 5000.0]]], N[(N[(z * (-t)), $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 -5 \cdot 10^{-114}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{-152} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{-43}\right) \land x \cdot y \leq 5000:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999989e-114Initial program 91.2%
Taylor expanded in x around inf 75.9%
associate-*r/77.0%
Simplified77.0%
if -4.99999999999999989e-114 < (*.f64 x y) < 1.00000000000000007e-152 or 5.00000000000000019e-43 < (*.f64 x y) < 5e3Initial program 97.8%
Taylor expanded in x around 0 87.6%
associate-*r/87.6%
associate-*r*87.6%
neg-mul-187.6%
Simplified87.6%
if 1.00000000000000007e-152 < (*.f64 x y) < 5.00000000000000019e-43 or 5e3 < (*.f64 x y) Initial program 91.9%
Taylor expanded in x around inf 81.2%
associate-*r/78.3%
Simplified78.3%
associate-*r/81.2%
*-commutative81.2%
associate-/l*82.3%
Applied egg-rr82.3%
Final simplification82.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 (let* ((t_1 (/ (- (* x y) (* z t)) a))) (if (<= t_1 4e+260) t_1 (- (/ x (/ a y)) (/ z (/ a t))))))
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)) / a;
double tmp;
if (t_1 <= 4e+260) {
tmp = t_1;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
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)) / a
if (t_1 <= 4d+260) then
tmp = t_1
else
tmp = (x / (a / y)) - (z / (a / t))
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)) / a;
double tmp;
if (t_1 <= 4e+260) {
tmp = t_1;
} else {
tmp = (x / (a / y)) - (z / (a / t));
}
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)) / a tmp = 0 if t_1 <= 4e+260: tmp = t_1 else: tmp = (x / (a / y)) - (z / (a / t)) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(x * y) - Float64(z * t)) / a) tmp = 0.0 if (t_1 <= 4e+260) tmp = t_1; else tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t))); 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)) / a;
tmp = 0.0;
if (t_1 <= 4e+260)
tmp = t_1;
else
tmp = (x / (a / y)) - (z / (a / t));
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[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$1, 4e+260], t$95$1, N[(N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \frac{x \cdot y - z \cdot t}{a}\\
\mathbf{if}\;t_1 \leq 4 \cdot 10^{+260}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) < 4.00000000000000026e260Initial program 98.8%
if 4.00000000000000026e260 < (/.f64 (-.f64 (*.f64 x y) (*.f64 z t)) a) Initial program 74.1%
div-sub70.1%
associate-/l*82.9%
associate-/l*90.2%
Applied egg-rr90.2%
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 (* (- z) (/ t a))))
(if (<= z -1e+158)
t_1
(if (<= z -7e+122)
(/ y (/ a x))
(if (or (<= z -225.0) (not (<= z 5.7e-21))) t_1 (/ (* x y) a))))))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 (z <= -1e+158) {
tmp = t_1;
} else if (z <= -7e+122) {
tmp = y / (a / x);
} else if ((z <= -225.0) || !(z <= 5.7e-21)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -z * (t / a)
if (z <= (-1d+158)) then
tmp = t_1
else if (z <= (-7d+122)) then
tmp = y / (a / x)
else if ((z <= (-225.0d0)) .or. (.not. (z <= 5.7d-21))) then
tmp = t_1
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 t_1 = -z * (t / a);
double tmp;
if (z <= -1e+158) {
tmp = t_1;
} else if (z <= -7e+122) {
tmp = y / (a / x);
} else if ((z <= -225.0) || !(z <= 5.7e-21)) {
tmp = t_1;
} else {
tmp = (x * y) / a;
}
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 z <= -1e+158: tmp = t_1 elif z <= -7e+122: tmp = y / (a / x) elif (z <= -225.0) or not (z <= 5.7e-21): tmp = t_1 else: tmp = (x * y) / a return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(-z) * Float64(t / a)) tmp = 0.0 if (z <= -1e+158) tmp = t_1; elseif (z <= -7e+122) tmp = Float64(y / Float64(a / x)); elseif ((z <= -225.0) || !(z <= 5.7e-21)) tmp = t_1; else tmp = Float64(Float64(x * 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)
t_1 = -z * (t / a);
tmp = 0.0;
if (z <= -1e+158)
tmp = t_1;
elseif (z <= -7e+122)
tmp = y / (a / x);
elseif ((z <= -225.0) || ~((z <= 5.7e-21)))
tmp = t_1;
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_] := Block[{t$95$1 = N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1e+158], t$95$1, If[LessEqual[z, -7e+122], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -225.0], N[Not[LessEqual[z, 5.7e-21]], $MachinePrecision]], t$95$1, N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \left(-z\right) \cdot \frac{t}{a}\\
\mathbf{if}\;z \leq -1 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -7 \cdot 10^{+122}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;z \leq -225 \lor \neg \left(z \leq 5.7 \cdot 10^{-21}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if z < -9.99999999999999953e157 or -7.00000000000000028e122 < z < -225 or 5.6999999999999996e-21 < z Initial program 90.9%
div-sub86.9%
associate-/l*86.0%
associate-/l*86.8%
Applied egg-rr86.8%
Taylor expanded in x around 0 64.4%
associate-*l/64.7%
associate-*r*64.7%
neg-mul-164.7%
*-commutative64.7%
Simplified64.7%
if -9.99999999999999953e157 < z < -7.00000000000000028e122Initial program 99.8%
Taylor expanded in x around inf 75.6%
associate-/l*75.6%
Simplified75.6%
if -225 < z < 5.6999999999999996e-21Initial program 96.6%
Taylor expanded in x around inf 77.2%
Final simplification71.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 (* (- t) (/ z a))))
(if (<= z -9.8e+157)
t_1
(if (<= z -2.2e+122)
(/ y (/ a x))
(if (or (<= z -0.41) (not (<= z 2.55e-104))) t_1 (/ (* x y) a))))))assert(x < y);
assert(z < t);
double code(double x, double y, double z, double t, double a) {
double t_1 = -t * (z / a);
double tmp;
if (z <= -9.8e+157) {
tmp = t_1;
} else if (z <= -2.2e+122) {
tmp = y / (a / x);
} else if ((z <= -0.41) || !(z <= 2.55e-104)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = -t * (z / a)
if (z <= (-9.8d+157)) then
tmp = t_1
else if (z <= (-2.2d+122)) then
tmp = y / (a / x)
else if ((z <= (-0.41d0)) .or. (.not. (z <= 2.55d-104))) then
tmp = t_1
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 t_1 = -t * (z / a);
double tmp;
if (z <= -9.8e+157) {
tmp = t_1;
} else if (z <= -2.2e+122) {
tmp = y / (a / x);
} else if ((z <= -0.41) || !(z <= 2.55e-104)) {
tmp = t_1;
} else {
tmp = (x * y) / a;
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = -t * (z / a) tmp = 0 if z <= -9.8e+157: tmp = t_1 elif z <= -2.2e+122: tmp = y / (a / x) elif (z <= -0.41) or not (z <= 2.55e-104): tmp = t_1 else: tmp = (x * y) / a return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(Float64(-t) * Float64(z / a)) tmp = 0.0 if (z <= -9.8e+157) tmp = t_1; elseif (z <= -2.2e+122) tmp = Float64(y / Float64(a / x)); elseif ((z <= -0.41) || !(z <= 2.55e-104)) tmp = t_1; else tmp = Float64(Float64(x * 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)
t_1 = -t * (z / a);
tmp = 0.0;
if (z <= -9.8e+157)
tmp = t_1;
elseif (z <= -2.2e+122)
tmp = y / (a / x);
elseif ((z <= -0.41) || ~((z <= 2.55e-104)))
tmp = t_1;
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_] := Block[{t$95$1 = N[((-t) * N[(z / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.8e+157], t$95$1, If[LessEqual[z, -2.2e+122], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -0.41], N[Not[LessEqual[z, 2.55e-104]], $MachinePrecision]], t$95$1, N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
t_1 := \left(-t\right) \cdot \frac{z}{a}\\
\mathbf{if}\;z \leq -9.8 \cdot 10^{+157}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{+122}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;z \leq -0.41 \lor \neg \left(z \leq 2.55 \cdot 10^{-104}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if z < -9.8000000000000003e157 or -2.1999999999999999e122 < z < -0.409999999999999976 or 2.54999999999999996e-104 < z Initial program 92.0%
Taylor expanded in x around 0 63.5%
associate-*r/63.5%
mul-1-neg63.5%
distribute-rgt-neg-out63.5%
*-commutative63.5%
associate-/l*63.0%
associate-/r/65.1%
Simplified65.1%
if -9.8000000000000003e157 < z < -2.1999999999999999e122Initial program 99.8%
Taylor expanded in x around inf 75.6%
associate-/l*75.6%
Simplified75.6%
if -0.409999999999999976 < z < 2.54999999999999996e-104Initial program 96.1%
Taylor expanded in x around inf 80.6%
Final simplification71.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
(let* ((t_1 (/ t (/ (- a) z))))
(if (<= z -1.2e+158)
t_1
(if (<= z -7.5e+122)
(/ y (/ a x))
(if (<= z -355.0)
t_1
(if (<= z 1.44e-98) (/ (* x y) a) (* (- t) (/ z a))))))))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 tmp;
if (z <= -1.2e+158) {
tmp = t_1;
} else if (z <= -7.5e+122) {
tmp = y / (a / x);
} else if (z <= -355.0) {
tmp = t_1;
} else if (z <= 1.44e-98) {
tmp = (x * y) / a;
} else {
tmp = -t * (z / 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 = t / (-a / z)
if (z <= (-1.2d+158)) then
tmp = t_1
else if (z <= (-7.5d+122)) then
tmp = y / (a / x)
else if (z <= (-355.0d0)) then
tmp = t_1
else if (z <= 1.44d-98) then
tmp = (x * y) / a
else
tmp = -t * (z / 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 = t / (-a / z);
double tmp;
if (z <= -1.2e+158) {
tmp = t_1;
} else if (z <= -7.5e+122) {
tmp = y / (a / x);
} else if (z <= -355.0) {
tmp = t_1;
} else if (z <= 1.44e-98) {
tmp = (x * y) / a;
} else {
tmp = -t * (z / a);
}
return tmp;
}
[x, y] = sort([x, y]) [z, t] = sort([z, t]) def code(x, y, z, t, a): t_1 = t / (-a / z) tmp = 0 if z <= -1.2e+158: tmp = t_1 elif z <= -7.5e+122: tmp = y / (a / x) elif z <= -355.0: tmp = t_1 elif z <= 1.44e-98: tmp = (x * y) / a else: tmp = -t * (z / a) return tmp
x, y = sort([x, y]) z, t = sort([z, t]) function code(x, y, z, t, a) t_1 = Float64(t / Float64(Float64(-a) / z)) tmp = 0.0 if (z <= -1.2e+158) tmp = t_1; elseif (z <= -7.5e+122) tmp = Float64(y / Float64(a / x)); elseif (z <= -355.0) tmp = t_1; elseif (z <= 1.44e-98) tmp = Float64(Float64(x * y) / a); else tmp = Float64(Float64(-t) * Float64(z / 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 = t / (-a / z);
tmp = 0.0;
if (z <= -1.2e+158)
tmp = t_1;
elseif (z <= -7.5e+122)
tmp = y / (a / x);
elseif (z <= -355.0)
tmp = t_1;
elseif (z <= 1.44e-98)
tmp = (x * y) / a;
else
tmp = -t * (z / 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[(t / N[((-a) / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.2e+158], t$95$1, If[LessEqual[z, -7.5e+122], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -355.0], t$95$1, If[LessEqual[z, 1.44e-98], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[((-t) * N[(z / a), $MachinePrecision]), $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}}\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{+122}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{elif}\;z \leq -355:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.44 \cdot 10^{-98}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) \cdot \frac{z}{a}\\
\end{array}
\end{array}
if z < -1.20000000000000004e158 or -7.5000000000000002e122 < z < -355Initial program 88.5%
div-sub86.8%
associate-/l*88.2%
associate-/l*93.1%
Applied egg-rr93.1%
Taylor expanded in x around 0 71.1%
associate-*l/74.4%
associate-*r*74.4%
neg-mul-174.4%
*-commutative74.4%
Simplified74.4%
Taylor expanded in z around 0 71.1%
associate-*r/71.1%
*-commutative71.1%
neg-mul-171.1%
distribute-rgt-neg-out71.1%
associate-/l*74.3%
remove-double-neg74.3%
distribute-frac-neg74.3%
neg-mul-174.3%
neg-mul-174.3%
times-frac74.3%
metadata-eval74.3%
*-lft-identity74.3%
distribute-frac-neg74.3%
associate-/l*71.1%
*-commutative71.1%
associate-/l*75.2%
Simplified75.2%
if -1.20000000000000004e158 < z < -7.5000000000000002e122Initial program 99.8%
Taylor expanded in x around inf 75.6%
associate-/l*75.6%
Simplified75.6%
if -355 < z < 1.44e-98Initial program 96.1%
Taylor expanded in x around inf 79.8%
if 1.44e-98 < z Initial program 94.3%
Taylor expanded in x around 0 57.7%
associate-*r/57.7%
mul-1-neg57.7%
distribute-rgt-neg-out57.7%
*-commutative57.7%
associate-/l*54.7%
associate-/r/58.4%
Simplified58.4%
Final simplification71.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 (if (<= (* x y) -2e+294) (/ y (/ a x)) (/ (- (* 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 ((x * y) <= -2e+294) {
tmp = y / (a / x);
} 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 ((x * y) <= (-2d+294)) then
tmp = y / (a / x)
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 ((x * y) <= -2e+294) {
tmp = y / (a / x);
} 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 (x * y) <= -2e+294: tmp = y / (a / x) 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(x * y) <= -2e+294) tmp = Float64(y / Float64(a / x)); 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 ((x * y) <= -2e+294)
tmp = y / (a / x);
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[(x * y), $MachinePrecision], -2e+294], N[(y / N[(a / x), $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}\;x \cdot y \leq -2 \cdot 10^{+294}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.00000000000000013e294Initial program 69.6%
Taylor expanded in x around inf 78.7%
associate-/l*95.7%
Simplified95.7%
if -2.00000000000000013e294 < (*.f64 x y) Initial program 96.2%
Final simplification96.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 (<= z -0.007) (* x (/ y 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 (z <= -0.007) {
tmp = x * (y / 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 (z <= (-0.007d0)) then
tmp = x * (y / 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 (z <= -0.007) {
tmp = x * (y / 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 z <= -0.007: tmp = x * (y / 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 (z <= -0.007) tmp = Float64(x * Float64(y / a)); else tmp = Float64(Float64(x * 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 (z <= -0.007)
tmp = x * (y / 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[z, -0.007], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
[z, t] = \mathsf{sort}([z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.007:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if z < -0.00700000000000000015Initial program 90.0%
Taylor expanded in x around inf 33.0%
associate-*l/34.2%
Applied egg-rr34.2%
if -0.00700000000000000015 < z Initial program 95.3%
Taylor expanded in x around inf 66.2%
Final simplification57.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 93.9%
Taylor expanded in x around inf 57.4%
associate-*r/57.4%
Simplified57.4%
Final simplification57.4%
(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 2023195
(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))