\[\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -2 \cdot 10^{+251} \lor \neg \left(t_1 \leq 10^{+266}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\]
(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* z t)) a))
↓
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (or (<= t_1 -2e+251) (not (<= t_1 1e+266)))
(- (/ x (/ a y)) (/ z (/ a t)))
(/ t_1 a))))
double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * 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 <= -2e+251) || !(t_1 <= 1e+266)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
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
code = ((x * y) - (z * t)) / a
end 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 <= (-2d+251)) .or. (.not. (t_1 <= 1d+266))) then
tmp = (x / (a / y)) - (z / (a / t))
else
tmp = t_1 / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - (z * 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 <= -2e+251) || !(t_1 <= 1e+266)) {
tmp = (x / (a / y)) - (z / (a / t));
} else {
tmp = t_1 / a;
}
return tmp;
}
def code(x, y, z, t, a):
return ((x * y) - (z * t)) / a
↓
def code(x, y, z, t, a):
t_1 = (x * y) - (z * t)
tmp = 0
if (t_1 <= -2e+251) or not (t_1 <= 1e+266):
tmp = (x / (a / y)) - (z / (a / t))
else:
tmp = t_1 / a
return tmp
function code(x, y, z, t, a)
return Float64(Float64(Float64(x * y) - Float64(z * t)) / a)
end
↓
function code(x, y, z, t, a)
t_1 = Float64(Float64(x * y) - Float64(z * t))
tmp = 0.0
if ((t_1 <= -2e+251) || !(t_1 <= 1e+266))
tmp = Float64(Float64(x / Float64(a / y)) - Float64(z / Float64(a / t)));
else
tmp = Float64(t_1 / a);
end
return tmp
end
function tmp = code(x, y, z, t, a)
tmp = ((x * y) - (z * t)) / a;
end
↓
function tmp_2 = code(x, y, z, t, a)
t_1 = (x * y) - (z * t);
tmp = 0.0;
if ((t_1 <= -2e+251) || ~((t_1 <= 1e+266)))
tmp = (x / (a / y)) - (z / (a / t));
else
tmp = t_1 / a;
end
tmp_2 = tmp;
end
if -2.0000000000000001e251 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e266
Initial program 1.11
\[\frac{x \cdot y - z \cdot t}{a}
\]
Recombined 2 regimes into one program.
Final simplification1.02
\[\leadsto \begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \leq -2 \cdot 10^{+251} \lor \neg \left(x \cdot y - z \cdot t \leq 10^{+266}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{z}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\]
Alternatives
Alternative 1
Error
6.77%
Cost
1608
\[\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+306}:\\
\;\;\;\;z \cdot \frac{-t}{a}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+299}:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\]
herbie shell --seed 2023090
(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))