\[\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+304} \lor \neg \left(t_1 \leq 5 \cdot 10^{+223}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - t \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot t + \left(t_1 - z \cdot t\right)}{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 -5e+304) (not (<= t_1 5e+223)))
(- (/ x (/ a y)) (* t (/ z a)))
(/ (+ (* z t) (- t_1 (* z t))) 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 <= -5e+304) || !(t_1 <= 5e+223)) {
tmp = (x / (a / y)) - (t * (z / a));
} else {
tmp = ((z * t) + (t_1 - (z * t))) / 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 <= (-5d+304)) .or. (.not. (t_1 <= 5d+223))) then
tmp = (x / (a / y)) - (t * (z / a))
else
tmp = ((z * t) + (t_1 - (z * t))) / 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 <= -5e+304) || !(t_1 <= 5e+223)) {
tmp = (x / (a / y)) - (t * (z / a));
} else {
tmp = ((z * t) + (t_1 - (z * t))) / 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 <= -5e+304) or not (t_1 <= 5e+223):
tmp = (x / (a / y)) - (t * (z / a))
else:
tmp = ((z * t) + (t_1 - (z * t))) / 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 <= -5e+304) || !(t_1 <= 5e+223))
tmp = Float64(Float64(x / Float64(a / y)) - Float64(t * Float64(z / a)));
else
tmp = Float64(Float64(Float64(z * t) + Float64(t_1 - Float64(z * t))) / 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 <= -5e+304) || ~((t_1 <= 5e+223)))
tmp = (x / (a / y)) - (t * (z / a));
else
tmp = ((z * t) + (t_1 - (z * t))) / a;
end
tmp_2 = tmp;
end
if -4.9999999999999997e304 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.99999999999999985e223
Initial program 1.26
\[\frac{x \cdot y - z \cdot t}{a}
\]
Applied egg-rr1.27
\[\leadsto \frac{\color{blue}{\left(\left(x \cdot y - z \cdot t\right) + z \cdot \left(-t\right)\right) + z \cdot t}}{a}
\]
Recombined 2 regimes into one program.
Final simplification1.23
\[\leadsto \begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \leq -5 \cdot 10^{+304} \lor \neg \left(x \cdot y - z \cdot t \leq 5 \cdot 10^{+223}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - t \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot t + \left(\left(x \cdot y - z \cdot t\right) - z \cdot t\right)}{a}\\
\end{array}
\]
Alternatives
Alternative 1
Error
1.22%
Cost
1737
\[\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+304} \lor \neg \left(t_1 \leq 5 \cdot 10^{+223}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - t \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{a}\\
\end{array}
\]
Alternative 2
Error
6.47%
Cost
1608
\[\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;t_1 \leq 10^{+307}:\\
\;\;\;\;\frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-\frac{z}{a}\right)\\
\end{array}
\]
Alternative 3
Error
29.42%
Cost
1292
\[\begin{array}{l}
t_1 := t \cdot \left(-\frac{z}{a}\right)\\
\mathbf{if}\;z \cdot t \leq -6 \cdot 10^{-124}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \cdot t \leq 10^{-31}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+166}:\\
\;\;\;\;\left(z \cdot t\right) \cdot \frac{1}{-a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
herbie shell --seed 2023115
(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))