
(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, y, z, t, and a 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 (- INFINITY))
(* t (- (* (/ x a) (/ y t)) (/ z a)))
(if (<= t_1 2e+291)
(/ t_1 a)
(* t (fma -1.0 (/ z a) (* x (/ y (* t a)))))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t * (((x / a) * (y / t)) - (z / a));
} else if (t_1 <= 2e+291) {
tmp = t_1 / a;
} else {
tmp = t * fma(-1.0, (z / a), (x * (y / (t * a))));
}
return tmp;
}
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(t * Float64(Float64(Float64(x / a) * Float64(y / t)) - Float64(z / a))); elseif (t_1 <= 2e+291) tmp = Float64(t_1 / a); else tmp = Float64(t * fma(-1.0, Float64(z / a), Float64(x * Float64(y / Float64(t * a))))); end return tmp end
NOTE: x, y, z, t, and a 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, (-Infinity)], N[(t * N[(N[(N[(x / a), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision] - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+291], N[(t$95$1 / a), $MachinePrecision], N[(t * N[(-1.0 * N[(z / a), $MachinePrecision] + N[(x * N[(y / N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t \cdot \left(\frac{x}{a} \cdot \frac{y}{t} - \frac{z}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+291}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \mathsf{fma}\left(-1, \frac{z}{a}, x \cdot \frac{y}{t \cdot a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 72.5%
Taylor expanded in t around inf 89.1%
+-commutative89.1%
mul-1-neg89.1%
unsub-neg89.1%
times-frac89.0%
Simplified89.0%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1.9999999999999999e291Initial program 99.6%
if 1.9999999999999999e291 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 57.6%
Taylor expanded in t around inf 73.4%
fma-define73.4%
associate-/l*86.4%
*-commutative86.4%
Simplified86.4%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+291)))
(* t (- (* (/ x a) (/ y t)) (/ z a)))
(/ t_1 a))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+291)) {
tmp = t * (((x / a) * (y / t)) - (z / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+291)) {
tmp = t * (((x / a) * (y / t)) - (z / a));
} else {
tmp = t_1 / a;
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 5e+291): tmp = t * (((x / a) * (y / t)) - (z / a)) else: tmp = t_1 / a return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+291)) tmp = Float64(t * Float64(Float64(Float64(x / a) * Float64(y / t)) - Float64(z / a))); else tmp = Float64(t_1 / a); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if ((t_1 <= -Inf) || ~((t_1 <= 5e+291)))
tmp = t * (((x / a) * (y / t)) - (z / a));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+291]], $MachinePrecision]], N[(t * N[(N[(N[(x / a), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision] - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / a), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+291}\right):\\
\;\;\;\;t \cdot \left(\frac{x}{a} \cdot \frac{y}{t} - \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0 or 5.0000000000000001e291 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 64.1%
Taylor expanded in t around inf 80.6%
+-commutative80.6%
mul-1-neg80.6%
unsub-neg80.6%
times-frac83.9%
Simplified83.9%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 5.0000000000000001e291Initial program 99.6%
Final simplification96.2%
NOTE: x, y, z, t, and a 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 (- INFINITY))
(* t (- (* (/ x a) (/ y t)) (/ z a)))
(if (<= t_1 4e+298) (/ t_1 a) (* y (- (/ x a) (/ t (/ (* y a) z))))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t * (((x / a) * (y / t)) - (z / a));
} else if (t_1 <= 4e+298) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - (t / ((y * a) / z)));
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t * (((x / a) * (y / t)) - (z / a));
} else if (t_1 <= 4e+298) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - (t / ((y * a) / z)));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= -math.inf: tmp = t * (((x / a) * (y / t)) - (z / a)) elif t_1 <= 4e+298: tmp = t_1 / a else: tmp = y * ((x / a) - (t / ((y * a) / z))) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(t * Float64(Float64(Float64(x / a) * Float64(y / t)) - Float64(z / a))); elseif (t_1 <= 4e+298) tmp = Float64(t_1 / a); else tmp = Float64(y * Float64(Float64(x / a) - Float64(t / Float64(Float64(y * a) / z)))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -Inf)
tmp = t * (((x / a) * (y / t)) - (z / a));
elseif (t_1 <= 4e+298)
tmp = t_1 / a;
else
tmp = y * ((x / a) - (t / ((y * a) / z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a 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, (-Infinity)], N[(t * N[(N[(N[(x / a), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision] - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+298], N[(t$95$1 / a), $MachinePrecision], N[(y * N[(N[(x / a), $MachinePrecision] - N[(t / N[(N[(y * a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t \cdot \left(\frac{x}{a} \cdot \frac{y}{t} - \frac{z}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+298}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - \frac{t}{\frac{y \cdot a}{z}}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 72.5%
Taylor expanded in t around inf 89.1%
+-commutative89.1%
mul-1-neg89.1%
unsub-neg89.1%
times-frac89.0%
Simplified89.0%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 3.9999999999999998e298Initial program 99.6%
if 3.9999999999999998e298 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 52.7%
Taylor expanded in y around inf 73.7%
+-commutative73.7%
mul-1-neg73.7%
unsub-neg73.7%
associate-/l*81.0%
Simplified81.0%
clear-num81.0%
un-div-inv81.0%
Applied egg-rr81.0%
Final simplification96.6%
NOTE: x, y, z, t, and a 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 (- INFINITY))
(* t (- (* (/ x a) (/ y t)) (/ z a)))
(if (<= t_1 4e+298) (/ t_1 a) (* y (- (/ x a) (* t (/ z (* y a)))))))))assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t * (((x / a) * (y / t)) - (z / a));
} else if (t_1 <= 4e+298) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - (t * (z / (y * a))));
}
return tmp;
}
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) - (z * t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = t * (((x / a) * (y / t)) - (z / a));
} else if (t_1 <= 4e+298) {
tmp = t_1 / a;
} else {
tmp = y * ((x / a) - (t * (z / (y * a))));
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= -math.inf: tmp = t * (((x / a) * (y / t)) - (z / a)) elif t_1 <= 4e+298: tmp = t_1 / a else: tmp = y * ((x / a) - (t * (z / (y * a)))) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) - Float64(z * t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(t * Float64(Float64(Float64(x / a) * Float64(y / t)) - Float64(z / a))); elseif (t_1 <= 4e+298) tmp = Float64(t_1 / a); else tmp = Float64(y * Float64(Float64(x / a) - Float64(t * Float64(z / Float64(y * a))))); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if (t_1 <= -Inf)
tmp = t * (((x / a) * (y / t)) - (z / a));
elseif (t_1 <= 4e+298)
tmp = t_1 / a;
else
tmp = y * ((x / a) - (t * (z / (y * a))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a 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, (-Infinity)], N[(t * N[(N[(N[(x / a), $MachinePrecision] * N[(y / t), $MachinePrecision]), $MachinePrecision] - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+298], N[(t$95$1 / a), $MachinePrecision], N[(y * N[(N[(x / a), $MachinePrecision] - N[(t * N[(z / N[(y * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t \cdot \left(\frac{x}{a} \cdot \frac{y}{t} - \frac{z}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+298}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - t \cdot \frac{z}{y \cdot a}\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 72.5%
Taylor expanded in t around inf 89.1%
+-commutative89.1%
mul-1-neg89.1%
unsub-neg89.1%
times-frac89.0%
Simplified89.0%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 3.9999999999999998e298Initial program 99.6%
if 3.9999999999999998e298 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 52.7%
Taylor expanded in y around inf 73.7%
+-commutative73.7%
mul-1-neg73.7%
unsub-neg73.7%
associate-/l*81.0%
Simplified81.0%
Final simplification96.6%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -1e+89) (* x (/ y a)) (if (<= (* x y) 6e+116) (* z (/ t (- a))) (* y (/ x a)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e+89) {
tmp = x * (y / a);
} else if ((x * y) <= 6e+116) {
tmp = z * (t / -a);
} else {
tmp = y * (x / a);
}
return tmp;
}
NOTE: x, y, z, t, and a 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) <= (-1d+89)) then
tmp = x * (y / a)
else if ((x * y) <= 6d+116) then
tmp = z * (t / -a)
else
tmp = y * (x / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -1e+89) {
tmp = x * (y / a);
} else if ((x * y) <= 6e+116) {
tmp = z * (t / -a);
} else {
tmp = y * (x / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -1e+89: tmp = x * (y / a) elif (x * y) <= 6e+116: tmp = z * (t / -a) else: tmp = y * (x / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -1e+89) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= 6e+116) tmp = Float64(z * Float64(t / Float64(-a))); else tmp = Float64(y * Float64(x / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -1e+89)
tmp = x * (y / a);
elseif ((x * y) <= 6e+116)
tmp = z * (t / -a);
else
tmp = y * (x / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+89], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 6e+116], N[(z * N[(t / (-a)), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+89}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq 6 \cdot 10^{+116}:\\
\;\;\;\;z \cdot \frac{t}{-a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -9.99999999999999995e88Initial program 93.0%
Taylor expanded in x around inf 85.6%
associate-*r/88.0%
Simplified88.0%
if -9.99999999999999995e88 < (*.f64 x y) < 5.9999999999999997e116Initial program 93.8%
Taylor expanded in x around 0 72.9%
associate-*r/72.9%
mul-1-neg72.9%
*-commutative72.9%
distribute-rgt-neg-in72.9%
associate-*r/71.3%
Simplified71.3%
if 5.9999999999999997e116 < (*.f64 x y) Initial program 85.4%
Taylor expanded in x around inf 77.8%
*-commutative77.8%
associate-*r/90.3%
Simplified90.3%
Final simplification77.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) -5e-81) (* x (/ y a)) (if (<= (* x y) 6e+116) (* t (/ z (- a))) (* y (/ x a)))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-81) {
tmp = x * (y / a);
} else if ((x * y) <= 6e+116) {
tmp = t * (z / -a);
} else {
tmp = y * (x / a);
}
return tmp;
}
NOTE: x, y, z, t, and a 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-81)) then
tmp = x * (y / a)
else if ((x * y) <= 6d+116) then
tmp = t * (z / -a)
else
tmp = y * (x / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-81) {
tmp = x * (y / a);
} else if ((x * y) <= 6e+116) {
tmp = t * (z / -a);
} else {
tmp = y * (x / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e-81: tmp = x * (y / a) elif (x * y) <= 6e+116: tmp = t * (z / -a) else: tmp = y * (x / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e-81) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= 6e+116) tmp = Float64(t * Float64(z / Float64(-a))); else tmp = Float64(y * Float64(x / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= -5e-81)
tmp = x * (y / a);
elseif ((x * y) <= 6e+116)
tmp = t * (z / -a);
else
tmp = y * (x / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e-81], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 6e+116], N[(t * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-81}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq 6 \cdot 10^{+116}:\\
\;\;\;\;t \cdot \frac{z}{-a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999981e-81Initial program 95.5%
Taylor expanded in x around inf 72.0%
associate-*r/70.5%
Simplified70.5%
if -4.99999999999999981e-81 < (*.f64 x y) < 5.9999999999999997e116Initial program 92.8%
Taylor expanded in x around 0 75.6%
associate-*r/75.6%
mul-1-neg75.6%
distribute-rgt-neg-out75.6%
associate-*r/77.2%
Simplified77.2%
if 5.9999999999999997e116 < (*.f64 x y) Initial program 85.4%
Taylor expanded in x around inf 77.8%
*-commutative77.8%
associate-*r/90.3%
Simplified90.3%
Final simplification78.2%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) 1e+255) (/ (- (* x y) (* z t)) a) (* x (/ y a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 1e+255) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x, y, z, t, and a 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) <= 1d+255) then
tmp = ((x * y) - (z * t)) / a
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 1e+255) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= 1e+255: tmp = ((x * y) - (z * t)) / a else: tmp = x * (y / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 1e+255) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= 1e+255)
tmp = ((x * y) - (z * t)) / a;
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], 1e+255], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 10^{+255}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < 9.99999999999999988e254Initial program 94.5%
if 9.99999999999999988e254 < (*.f64 x y) Initial program 65.5%
Taylor expanded in x around inf 65.5%
associate-*r/100.0%
Simplified100.0%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (if (<= (* x y) 2e+211) (/ (* x y) a) (* x (/ y a))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 2e+211) {
tmp = (x * y) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
NOTE: x, y, z, t, and a 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+211) then
tmp = (x * y) / a
else
tmp = x * (y / a)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= 2e+211) {
tmp = (x * y) / a;
} else {
tmp = x * (y / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (x * y) <= 2e+211: tmp = (x * y) / a else: tmp = x * (y / a) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= 2e+211) tmp = Float64(Float64(x * y) / a); else tmp = Float64(x * Float64(y / a)); end return tmp end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if ((x * y) <= 2e+211)
tmp = (x * y) / a;
else
tmp = x * (y / a);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], 2e+211], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 2 \cdot 10^{+211}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < 1.9999999999999999e211Initial program 94.2%
Taylor expanded in x around inf 47.1%
if 1.9999999999999999e211 < (*.f64 x y) Initial program 75.5%
Taylor expanded in x around inf 72.4%
associate-*r/96.8%
Simplified96.8%
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. (FPCore (x y z t a) :precision binary64 (* x (/ y a)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
NOTE: x, y, z, t, and a 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 = x * (y / a)
end function
assert x < y && y < z && z < t && t < a;
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return x * (y / a)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = x * (y / a);
end
NOTE: x, y, z, t, and a should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_] := N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 92.0%
Taylor expanded in x around inf 50.1%
associate-*r/51.3%
Simplified51.3%
(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 2024152
(FPCore (x y z t a)
:name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
:precision binary64
:alt
(! :herbie-platform default (if (< z -246868496869954800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6309831121978371/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z)))))
(/ (- (* x y) (* z t)) a))