
(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 11 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}
(FPCore (x y z t a) :precision binary64 (if (<= (* z t) (- INFINITY)) (* t (/ (- z) a)) (/ (- (* x y) (* z t)) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = t * (-z / a);
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = t * (-z / a);
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z * t) <= -math.inf: tmp = t * (-z / a) else: tmp = ((x * y) - (z * t)) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = Float64(t * Float64(Float64(-z) / a)); else tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z * t) <= -Inf) tmp = t * (-z / a); else tmp = ((x * y) - (z * t)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 63.8%
Taylor expanded in x around 0 70.0%
mul-1-neg70.0%
*-commutative70.0%
associate-*l/93.8%
distribute-rgt-neg-in93.8%
Simplified93.8%
if -inf.0 < (*.f64 z t) Initial program 96.1%
Final simplification96.0%
(FPCore (x y z t a) :precision binary64 (/ (fma x y (* z (- t))) a))
double code(double x, double y, double z, double t, double a) {
return fma(x, y, (z * -t)) / a;
}
function code(x, y, z, t, a) return Float64(fma(x, y, Float64(z * Float64(-t))) / a) end
code[x_, y_, z_, t_, a_] := N[(N[(x * y + N[(z * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(x, y, z \cdot \left(-t\right)\right)}{a}
\end{array}
Initial program 94.1%
div-sub91.7%
*-commutative91.7%
div-sub94.1%
fma-neg94.5%
*-commutative94.5%
distribute-rgt-neg-out94.5%
Simplified94.5%
Final simplification94.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) a)))
(if (<= (* x y) -2e+87)
t_1
(if (<= (* x y) -4e+55)
(/ (- z) (/ a t))
(if (<= (* x y) -2e+35)
t_1
(if (<= (* x y) 5e-27)
(- (/ (* z t) a))
(if (<= (* x y) 1e+59)
t_1
(if (<= (* x y) 2e+70) (/ (- t) (/ a z)) (/ x (/ a y))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -2e+87) {
tmp = t_1;
} else if ((x * y) <= -4e+55) {
tmp = -z / (a / t);
} else if ((x * y) <= -2e+35) {
tmp = t_1;
} else if ((x * y) <= 5e-27) {
tmp = -((z * t) / a);
} else if ((x * y) <= 1e+59) {
tmp = t_1;
} else if ((x * y) <= 2e+70) {
tmp = -t / (a / z);
} else {
tmp = x / (a / y);
}
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 = (x * y) / a
if ((x * y) <= (-2d+87)) then
tmp = t_1
else if ((x * y) <= (-4d+55)) then
tmp = -z / (a / t)
else if ((x * y) <= (-2d+35)) then
tmp = t_1
else if ((x * y) <= 5d-27) then
tmp = -((z * t) / a)
else if ((x * y) <= 1d+59) then
tmp = t_1
else if ((x * y) <= 2d+70) then
tmp = -t / (a / z)
else
tmp = x / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -2e+87) {
tmp = t_1;
} else if ((x * y) <= -4e+55) {
tmp = -z / (a / t);
} else if ((x * y) <= -2e+35) {
tmp = t_1;
} else if ((x * y) <= 5e-27) {
tmp = -((z * t) / a);
} else if ((x * y) <= 1e+59) {
tmp = t_1;
} else if ((x * y) <= 2e+70) {
tmp = -t / (a / z);
} else {
tmp = x / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if (x * y) <= -2e+87: tmp = t_1 elif (x * y) <= -4e+55: tmp = -z / (a / t) elif (x * y) <= -2e+35: tmp = t_1 elif (x * y) <= 5e-27: tmp = -((z * t) / a) elif (x * y) <= 1e+59: tmp = t_1 elif (x * y) <= 2e+70: tmp = -t / (a / z) else: tmp = x / (a / y) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) tmp = 0.0 if (Float64(x * y) <= -2e+87) tmp = t_1; elseif (Float64(x * y) <= -4e+55) tmp = Float64(Float64(-z) / Float64(a / t)); elseif (Float64(x * y) <= -2e+35) tmp = t_1; elseif (Float64(x * y) <= 5e-27) tmp = Float64(-Float64(Float64(z * t) / a)); elseif (Float64(x * y) <= 1e+59) tmp = t_1; elseif (Float64(x * y) <= 2e+70) tmp = Float64(Float64(-t) / Float64(a / z)); else tmp = Float64(x / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * y) / a; tmp = 0.0; if ((x * y) <= -2e+87) tmp = t_1; elseif ((x * y) <= -4e+55) tmp = -z / (a / t); elseif ((x * y) <= -2e+35) tmp = t_1; elseif ((x * y) <= 5e-27) tmp = -((z * t) / a); elseif ((x * y) <= 1e+59) tmp = t_1; elseif ((x * y) <= 2e+70) tmp = -t / (a / z); else tmp = x / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+87], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -4e+55], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e+35], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-27], (-N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), If[LessEqual[N[(x * y), $MachinePrecision], 1e+59], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+70], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{+55}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-27}:\\
\;\;\;\;-\frac{z \cdot t}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+70}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e87 or -4.00000000000000004e55 < (*.f64 x y) < -1.9999999999999999e35 or 5.0000000000000002e-27 < (*.f64 x y) < 9.99999999999999972e58Initial program 92.3%
Taylor expanded in x around inf 80.4%
if -1.9999999999999999e87 < (*.f64 x y) < -4.00000000000000004e55Initial program 99.3%
Taylor expanded in x around 0 74.7%
mul-1-neg74.7%
*-commutative74.7%
associate-*l/72.7%
distribute-rgt-neg-in72.7%
Simplified72.7%
distribute-rgt-neg-out72.7%
associate-/r/74.7%
distribute-neg-frac74.7%
Applied egg-rr74.7%
if -1.9999999999999999e35 < (*.f64 x y) < 5.0000000000000002e-27Initial program 95.9%
Taylor expanded in x around 0 79.2%
mul-1-neg79.2%
distribute-rgt-neg-in79.2%
Simplified79.2%
if 9.99999999999999972e58 < (*.f64 x y) < 2.00000000000000015e70Initial program 100.0%
Taylor expanded in x around 0 100.0%
mul-1-neg100.0%
associate-/l*100.0%
Simplified100.0%
if 2.00000000000000015e70 < (*.f64 x y) Initial program 91.1%
Taylor expanded in x around inf 78.4%
associate-*l/80.7%
Simplified80.7%
associate-/r/76.5%
Applied egg-rr76.5%
Final simplification79.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ 1.0 (/ a (* x y)))))
(if (<= (* x y) -2e+87)
(/ (* x y) a)
(if (<= (* x y) -4e+55)
(/ (- z) (/ a t))
(if (<= (* x y) -2e+35)
t_1
(if (<= (* x y) 5e-27)
(- (/ (* z t) a))
(if (<= (* x y) 1e+59)
t_1
(if (<= (* x y) 2e+70) (/ (- t) (/ a z)) (/ x (/ a y))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = 1.0 / (a / (x * y));
double tmp;
if ((x * y) <= -2e+87) {
tmp = (x * y) / a;
} else if ((x * y) <= -4e+55) {
tmp = -z / (a / t);
} else if ((x * y) <= -2e+35) {
tmp = t_1;
} else if ((x * y) <= 5e-27) {
tmp = -((z * t) / a);
} else if ((x * y) <= 1e+59) {
tmp = t_1;
} else if ((x * y) <= 2e+70) {
tmp = -t / (a / z);
} else {
tmp = x / (a / y);
}
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 = 1.0d0 / (a / (x * y))
if ((x * y) <= (-2d+87)) then
tmp = (x * y) / a
else if ((x * y) <= (-4d+55)) then
tmp = -z / (a / t)
else if ((x * y) <= (-2d+35)) then
tmp = t_1
else if ((x * y) <= 5d-27) then
tmp = -((z * t) / a)
else if ((x * y) <= 1d+59) then
tmp = t_1
else if ((x * y) <= 2d+70) then
tmp = -t / (a / z)
else
tmp = x / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = 1.0 / (a / (x * y));
double tmp;
if ((x * y) <= -2e+87) {
tmp = (x * y) / a;
} else if ((x * y) <= -4e+55) {
tmp = -z / (a / t);
} else if ((x * y) <= -2e+35) {
tmp = t_1;
} else if ((x * y) <= 5e-27) {
tmp = -((z * t) / a);
} else if ((x * y) <= 1e+59) {
tmp = t_1;
} else if ((x * y) <= 2e+70) {
tmp = -t / (a / z);
} else {
tmp = x / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = 1.0 / (a / (x * y)) tmp = 0 if (x * y) <= -2e+87: tmp = (x * y) / a elif (x * y) <= -4e+55: tmp = -z / (a / t) elif (x * y) <= -2e+35: tmp = t_1 elif (x * y) <= 5e-27: tmp = -((z * t) / a) elif (x * y) <= 1e+59: tmp = t_1 elif (x * y) <= 2e+70: tmp = -t / (a / z) else: tmp = x / (a / y) return tmp
function code(x, y, z, t, a) t_1 = Float64(1.0 / Float64(a / Float64(x * y))) tmp = 0.0 if (Float64(x * y) <= -2e+87) tmp = Float64(Float64(x * y) / a); elseif (Float64(x * y) <= -4e+55) tmp = Float64(Float64(-z) / Float64(a / t)); elseif (Float64(x * y) <= -2e+35) tmp = t_1; elseif (Float64(x * y) <= 5e-27) tmp = Float64(-Float64(Float64(z * t) / a)); elseif (Float64(x * y) <= 1e+59) tmp = t_1; elseif (Float64(x * y) <= 2e+70) tmp = Float64(Float64(-t) / Float64(a / z)); else tmp = Float64(x / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = 1.0 / (a / (x * y)); tmp = 0.0; if ((x * y) <= -2e+87) tmp = (x * y) / a; elseif ((x * y) <= -4e+55) tmp = -z / (a / t); elseif ((x * y) <= -2e+35) tmp = t_1; elseif ((x * y) <= 5e-27) tmp = -((z * t) / a); elseif ((x * y) <= 1e+59) tmp = t_1; elseif ((x * y) <= 2e+70) tmp = -t / (a / z); else tmp = x / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 / N[(a / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+87], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -4e+55], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e+35], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-27], (-N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), If[LessEqual[N[(x * y), $MachinePrecision], 1e+59], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+70], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{1}{\frac{a}{x \cdot y}}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+87}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{+55}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-27}:\\
\;\;\;\;-\frac{z \cdot t}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+70}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e87Initial program 91.1%
Taylor expanded in x around inf 84.0%
if -1.9999999999999999e87 < (*.f64 x y) < -4.00000000000000004e55Initial program 99.3%
Taylor expanded in x around 0 74.7%
mul-1-neg74.7%
*-commutative74.7%
associate-*l/72.7%
distribute-rgt-neg-in72.7%
Simplified72.7%
distribute-rgt-neg-out72.7%
associate-/r/74.7%
distribute-neg-frac74.7%
Applied egg-rr74.7%
if -4.00000000000000004e55 < (*.f64 x y) < -1.9999999999999999e35 or 5.0000000000000002e-27 < (*.f64 x y) < 9.99999999999999972e58Initial program 95.3%
Taylor expanded in x around inf 71.1%
associate-*l/62.4%
Simplified62.4%
associate-*l/71.1%
clear-num71.3%
Applied egg-rr71.3%
if -1.9999999999999999e35 < (*.f64 x y) < 5.0000000000000002e-27Initial program 95.9%
Taylor expanded in x around 0 79.2%
mul-1-neg79.2%
distribute-rgt-neg-in79.2%
Simplified79.2%
if 9.99999999999999972e58 < (*.f64 x y) < 2.00000000000000015e70Initial program 100.0%
Taylor expanded in x around 0 100.0%
mul-1-neg100.0%
associate-/l*100.0%
Simplified100.0%
if 2.00000000000000015e70 < (*.f64 x y) Initial program 91.1%
Taylor expanded in x around inf 78.4%
associate-*l/80.7%
Simplified80.7%
associate-/r/76.5%
Applied egg-rr76.5%
Final simplification79.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ 1.0 (/ a (* x y)))))
(if (<= (* x y) -2e+87)
(* (/ 1.0 a) (/ x (/ 1.0 y)))
(if (<= (* x y) -4e+55)
(/ (- z) (/ a t))
(if (<= (* x y) -2e+35)
t_1
(if (<= (* x y) 5e-27)
(- (/ (* z t) a))
(if (<= (* x y) 1e+59)
t_1
(if (<= (* x y) 2e+70) (/ (- t) (/ a z)) (/ x (/ a y))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = 1.0 / (a / (x * y));
double tmp;
if ((x * y) <= -2e+87) {
tmp = (1.0 / a) * (x / (1.0 / y));
} else if ((x * y) <= -4e+55) {
tmp = -z / (a / t);
} else if ((x * y) <= -2e+35) {
tmp = t_1;
} else if ((x * y) <= 5e-27) {
tmp = -((z * t) / a);
} else if ((x * y) <= 1e+59) {
tmp = t_1;
} else if ((x * y) <= 2e+70) {
tmp = -t / (a / z);
} else {
tmp = x / (a / y);
}
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 = 1.0d0 / (a / (x * y))
if ((x * y) <= (-2d+87)) then
tmp = (1.0d0 / a) * (x / (1.0d0 / y))
else if ((x * y) <= (-4d+55)) then
tmp = -z / (a / t)
else if ((x * y) <= (-2d+35)) then
tmp = t_1
else if ((x * y) <= 5d-27) then
tmp = -((z * t) / a)
else if ((x * y) <= 1d+59) then
tmp = t_1
else if ((x * y) <= 2d+70) then
tmp = -t / (a / z)
else
tmp = x / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = 1.0 / (a / (x * y));
double tmp;
if ((x * y) <= -2e+87) {
tmp = (1.0 / a) * (x / (1.0 / y));
} else if ((x * y) <= -4e+55) {
tmp = -z / (a / t);
} else if ((x * y) <= -2e+35) {
tmp = t_1;
} else if ((x * y) <= 5e-27) {
tmp = -((z * t) / a);
} else if ((x * y) <= 1e+59) {
tmp = t_1;
} else if ((x * y) <= 2e+70) {
tmp = -t / (a / z);
} else {
tmp = x / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = 1.0 / (a / (x * y)) tmp = 0 if (x * y) <= -2e+87: tmp = (1.0 / a) * (x / (1.0 / y)) elif (x * y) <= -4e+55: tmp = -z / (a / t) elif (x * y) <= -2e+35: tmp = t_1 elif (x * y) <= 5e-27: tmp = -((z * t) / a) elif (x * y) <= 1e+59: tmp = t_1 elif (x * y) <= 2e+70: tmp = -t / (a / z) else: tmp = x / (a / y) return tmp
function code(x, y, z, t, a) t_1 = Float64(1.0 / Float64(a / Float64(x * y))) tmp = 0.0 if (Float64(x * y) <= -2e+87) tmp = Float64(Float64(1.0 / a) * Float64(x / Float64(1.0 / y))); elseif (Float64(x * y) <= -4e+55) tmp = Float64(Float64(-z) / Float64(a / t)); elseif (Float64(x * y) <= -2e+35) tmp = t_1; elseif (Float64(x * y) <= 5e-27) tmp = Float64(-Float64(Float64(z * t) / a)); elseif (Float64(x * y) <= 1e+59) tmp = t_1; elseif (Float64(x * y) <= 2e+70) tmp = Float64(Float64(-t) / Float64(a / z)); else tmp = Float64(x / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = 1.0 / (a / (x * y)); tmp = 0.0; if ((x * y) <= -2e+87) tmp = (1.0 / a) * (x / (1.0 / y)); elseif ((x * y) <= -4e+55) tmp = -z / (a / t); elseif ((x * y) <= -2e+35) tmp = t_1; elseif ((x * y) <= 5e-27) tmp = -((z * t) / a); elseif ((x * y) <= 1e+59) tmp = t_1; elseif ((x * y) <= 2e+70) tmp = -t / (a / z); else tmp = x / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(1.0 / N[(a / N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+87], N[(N[(1.0 / a), $MachinePrecision] * N[(x / N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -4e+55], N[((-z) / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e+35], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-27], (-N[(N[(z * t), $MachinePrecision] / a), $MachinePrecision]), If[LessEqual[N[(x * y), $MachinePrecision], 1e+59], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+70], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{1}{\frac{a}{x \cdot y}}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+87}:\\
\;\;\;\;\frac{1}{a} \cdot \frac{x}{\frac{1}{y}}\\
\mathbf{elif}\;x \cdot y \leq -4 \cdot 10^{+55}:\\
\;\;\;\;\frac{-z}{\frac{a}{t}}\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{+35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-27}:\\
\;\;\;\;-\frac{z \cdot t}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+70}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e87Initial program 91.1%
Taylor expanded in x around inf 84.0%
associate-*l/84.0%
Simplified84.0%
associate-/r/79.1%
Applied egg-rr79.1%
*-un-lft-identity79.1%
div-inv79.1%
times-frac84.0%
Applied egg-rr84.0%
if -1.9999999999999999e87 < (*.f64 x y) < -4.00000000000000004e55Initial program 99.3%
Taylor expanded in x around 0 74.7%
mul-1-neg74.7%
*-commutative74.7%
associate-*l/72.7%
distribute-rgt-neg-in72.7%
Simplified72.7%
distribute-rgt-neg-out72.7%
associate-/r/74.7%
distribute-neg-frac74.7%
Applied egg-rr74.7%
if -4.00000000000000004e55 < (*.f64 x y) < -1.9999999999999999e35 or 5.0000000000000002e-27 < (*.f64 x y) < 9.99999999999999972e58Initial program 95.3%
Taylor expanded in x around inf 71.1%
associate-*l/62.4%
Simplified62.4%
associate-*l/71.1%
clear-num71.3%
Applied egg-rr71.3%
if -1.9999999999999999e35 < (*.f64 x y) < 5.0000000000000002e-27Initial program 95.9%
Taylor expanded in x around 0 79.2%
mul-1-neg79.2%
distribute-rgt-neg-in79.2%
Simplified79.2%
if 9.99999999999999972e58 < (*.f64 x y) < 2.00000000000000015e70Initial program 100.0%
Taylor expanded in x around 0 100.0%
mul-1-neg100.0%
associate-/l*100.0%
Simplified100.0%
if 2.00000000000000015e70 < (*.f64 x y) Initial program 91.1%
Taylor expanded in x around inf 78.4%
associate-*l/80.7%
Simplified80.7%
associate-/r/76.5%
Applied egg-rr76.5%
Final simplification79.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* x y) a)))
(if (<= (* x y) -2e+87)
t_1
(if (<= (* x y) 5e-27)
(* (- z) (/ t a))
(if (<= (* x y) 1e+59)
t_1
(if (<= (* x y) 2e+70) (/ (- t) (/ a z)) (/ x (/ a y))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -2e+87) {
tmp = t_1;
} else if ((x * y) <= 5e-27) {
tmp = -z * (t / a);
} else if ((x * y) <= 1e+59) {
tmp = t_1;
} else if ((x * y) <= 2e+70) {
tmp = -t / (a / z);
} else {
tmp = x / (a / y);
}
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 = (x * y) / a
if ((x * y) <= (-2d+87)) then
tmp = t_1
else if ((x * y) <= 5d-27) then
tmp = -z * (t / a)
else if ((x * y) <= 1d+59) then
tmp = t_1
else if ((x * y) <= 2d+70) then
tmp = -t / (a / z)
else
tmp = x / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * y) / a;
double tmp;
if ((x * y) <= -2e+87) {
tmp = t_1;
} else if ((x * y) <= 5e-27) {
tmp = -z * (t / a);
} else if ((x * y) <= 1e+59) {
tmp = t_1;
} else if ((x * y) <= 2e+70) {
tmp = -t / (a / z);
} else {
tmp = x / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x * y) / a tmp = 0 if (x * y) <= -2e+87: tmp = t_1 elif (x * y) <= 5e-27: tmp = -z * (t / a) elif (x * y) <= 1e+59: tmp = t_1 elif (x * y) <= 2e+70: tmp = -t / (a / z) else: tmp = x / (a / y) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x * y) / a) tmp = 0.0 if (Float64(x * y) <= -2e+87) tmp = t_1; elseif (Float64(x * y) <= 5e-27) tmp = Float64(Float64(-z) * Float64(t / a)); elseif (Float64(x * y) <= 1e+59) tmp = t_1; elseif (Float64(x * y) <= 2e+70) tmp = Float64(Float64(-t) / Float64(a / z)); else tmp = Float64(x / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * y) / a; tmp = 0.0; if ((x * y) <= -2e+87) tmp = t_1; elseif ((x * y) <= 5e-27) tmp = -z * (t / a); elseif ((x * y) <= 1e+59) tmp = t_1; elseif ((x * y) <= 2e+70) tmp = -t / (a / z); else tmp = x / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+87], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 5e-27], N[((-z) * N[(t / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+59], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 2e+70], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{a}\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-27}:\\
\;\;\;\;\left(-z\right) \cdot \frac{t}{a}\\
\mathbf{elif}\;x \cdot y \leq 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+70}:\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e87 or 5.0000000000000002e-27 < (*.f64 x y) < 9.99999999999999972e58Initial program 92.8%
Taylor expanded in x around inf 81.0%
if -1.9999999999999999e87 < (*.f64 x y) < 5.0000000000000002e-27Initial program 95.6%
div-sub95.6%
associate-/l*89.7%
associate-/l*83.9%
Applied egg-rr83.9%
Taylor expanded in x around 0 75.3%
associate-*l/67.3%
associate-*l*67.3%
neg-mul-167.3%
*-commutative67.3%
Simplified67.3%
if 9.99999999999999972e58 < (*.f64 x y) < 2.00000000000000015e70Initial program 100.0%
Taylor expanded in x around 0 100.0%
mul-1-neg100.0%
associate-/l*100.0%
Simplified100.0%
if 2.00000000000000015e70 < (*.f64 x y) Initial program 91.1%
Taylor expanded in x around inf 78.4%
associate-*l/80.7%
Simplified80.7%
associate-/r/76.5%
Applied egg-rr76.5%
Final simplification72.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.2e+30) (not (<= z 1.9e-119))) (/ (- t) (/ a z)) (/ (* x y) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e+30) || !(z <= 1.9e-119)) {
tmp = -t / (a / z);
} else {
tmp = (x * y) / 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
real(8) :: tmp
if ((z <= (-7.2d+30)) .or. (.not. (z <= 1.9d-119))) then
tmp = -t / (a / z)
else
tmp = (x * y) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e+30) || !(z <= 1.9e-119)) {
tmp = -t / (a / z);
} else {
tmp = (x * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.2e+30) or not (z <= 1.9e-119): tmp = -t / (a / z) else: tmp = (x * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.2e+30) || !(z <= 1.9e-119)) tmp = Float64(Float64(-t) / Float64(a / z)); else tmp = Float64(Float64(x * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.2e+30) || ~((z <= 1.9e-119))) tmp = -t / (a / z); else tmp = (x * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.2e+30], N[Not[LessEqual[z, 1.9e-119]], $MachinePrecision]], N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+30} \lor \neg \left(z \leq 1.9 \cdot 10^{-119}\right):\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if z < -7.2000000000000004e30 or 1.89999999999999987e-119 < z Initial program 92.3%
Taylor expanded in x around 0 65.2%
mul-1-neg65.2%
associate-/l*65.2%
Simplified65.2%
if -7.2000000000000004e30 < z < 1.89999999999999987e-119Initial program 96.3%
Taylor expanded in x around inf 70.8%
Final simplification67.7%
(FPCore (x y z t a) :precision binary64 (if (<= a 1.95e-188) (* x (/ y a)) (/ (* x y) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 1.95e-188) {
tmp = x * (y / a);
} else {
tmp = (x * y) / 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
real(8) :: tmp
if (a <= 1.95d-188) then
tmp = x * (y / a)
else
tmp = (x * y) / a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 1.95e-188) {
tmp = x * (y / a);
} else {
tmp = (x * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 1.95e-188: tmp = x * (y / a) else: tmp = (x * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 1.95e-188) tmp = Float64(x * Float64(y / a)); else tmp = Float64(Float64(x * y) / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= 1.95e-188) tmp = x * (y / a); else tmp = (x * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 1.95e-188], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.95 \cdot 10^{-188}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if a < 1.94999999999999988e-188Initial program 93.1%
Taylor expanded in x around inf 49.6%
*-commutative49.6%
associate-*l/44.3%
Applied egg-rr44.3%
if 1.94999999999999988e-188 < a Initial program 95.7%
Taylor expanded in x around inf 54.5%
Final simplification48.1%
(FPCore (x y z t a) :precision binary64 (* y (/ x a)))
double code(double x, double y, double z, double t, double a) {
return y * (x / 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 = y * (x / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return y * (x / a);
}
def code(x, y, z, t, a): return y * (x / a)
function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
function tmp = code(x, y, z, t, a) tmp = y * (x / a); end
code[x_, y_, z_, t_, a_] := N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 94.1%
Taylor expanded in x around inf 51.4%
associate-*l/50.3%
Simplified50.3%
Final simplification50.3%
(FPCore (x y z t a) :precision binary64 (* x (/ y a)))
double code(double x, double y, double z, double t, double a) {
return x * (y / 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 / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x * (y / a);
}
def code(x, y, z, t, a): return x * (y / a)
function code(x, y, z, t, a) return Float64(x * Float64(y / a)) end
function tmp = code(x, y, z, t, a) tmp = x * (y / a); end
code[x_, y_, z_, t_, a_] := N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y}{a}
\end{array}
Initial program 94.1%
Taylor expanded in x around inf 51.4%
*-commutative51.4%
associate-*l/47.2%
Applied egg-rr47.2%
Final simplification47.2%
(FPCore (x y z t a) :precision binary64 (/ x (/ a y)))
double code(double x, double y, double z, double t, double a) {
return x / (a / y);
}
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 / (a / y)
end function
public static double code(double x, double y, double z, double t, double a) {
return x / (a / y);
}
def code(x, y, z, t, a): return x / (a / y)
function code(x, y, z, t, a) return Float64(x / Float64(a / y)) end
function tmp = code(x, y, z, t, a) tmp = x / (a / y); end
code[x_, y_, z_, t_, a_] := N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{a}{y}}
\end{array}
Initial program 94.1%
Taylor expanded in x around inf 51.4%
associate-*l/50.3%
Simplified50.3%
associate-/r/47.5%
Applied egg-rr47.5%
Final simplification47.5%
(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 2024040
(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))