
(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
(let* ((t_1 (- (* x y) (* z t))))
(if (<= t_1 (- INFINITY))
(* z (- (* x (/ y (* z a))) (/ t a)))
(if (<= t_1 1e+270) (/ t_1 a) (* (- (* x (/ y z)) t) (/ z 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 = z * ((x * (y / (z * a))) - (t / a));
} else if (t_1 <= 1e+270) {
tmp = t_1 / a;
} else {
tmp = ((x * (y / z)) - t) * (z / a);
}
return tmp;
}
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 = z * ((x * (y / (z * a))) - (t / a));
} else if (t_1 <= 1e+270) {
tmp = t_1 / a;
} else {
tmp = ((x * (y / z)) - t) * (z / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= -math.inf: tmp = z * ((x * (y / (z * a))) - (t / a)) elif t_1 <= 1e+270: tmp = t_1 / a else: tmp = ((x * (y / z)) - t) * (z / a) return tmp
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(z * Float64(Float64(x * Float64(y / Float64(z * a))) - Float64(t / a))); elseif (t_1 <= 1e+270) tmp = Float64(t_1 / a); else tmp = Float64(Float64(Float64(x * Float64(y / z)) - t) * Float64(z / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * y) - (z * t); tmp = 0.0; if (t_1 <= -Inf) tmp = z * ((x * (y / (z * a))) - (t / a)); elseif (t_1 <= 1e+270) tmp = t_1 / a; else tmp = ((x * (y / z)) - t) * (z / a); end tmp_2 = tmp; end
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[(z * N[(N[(x * N[(y / N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+270], N[(t$95$1 / a), $MachinePrecision], N[(N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;z \cdot \left(x \cdot \frac{y}{z \cdot a} - \frac{t}{a}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+270}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \frac{y}{z} - t\right) \cdot \frac{z}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 55.4%
Taylor expanded in z around inf 80.1%
+-commutative80.1%
mul-1-neg80.1%
unsub-neg80.1%
associate-/l*94.8%
*-commutative94.8%
Simplified94.8%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e270Initial program 98.5%
if 1e270 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 73.4%
Taylor expanded in z around inf 78.5%
associate-/l*81.0%
Simplified81.0%
Taylor expanded in z around inf 87.7%
+-commutative87.7%
mul-1-neg87.7%
unsub-neg87.7%
times-frac92.3%
associate-*l/92.5%
div-sub97.5%
associate-*r/90.3%
associate-/l*78.5%
*-commutative78.5%
associate-*r/81.0%
*-rgt-identity81.0%
cancel-sign-sub-inv81.0%
distribute-lft-neg-in81.0%
fma-undefine81.0%
associate-/l*95.1%
Simplified95.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* z t) (- a))) (t_2 (/ (- t) (/ a z))))
(if (<= (* z t) (- INFINITY))
t_2
(if (<= (* z t) -2e-53)
t_1
(if (<= (* z t) 2e-125)
(/ (* x y) a)
(if (<= (* z t) 1e+233) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z * t) / -a;
double t_2 = -t / (a / z);
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = t_2;
} else if ((z * t) <= -2e-53) {
tmp = t_1;
} else if ((z * t) <= 2e-125) {
tmp = (x * y) / a;
} else if ((z * t) <= 1e+233) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z * t) / -a;
double t_2 = -t / (a / z);
double tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = t_2;
} else if ((z * t) <= -2e-53) {
tmp = t_1;
} else if ((z * t) <= 2e-125) {
tmp = (x * y) / a;
} else if ((z * t) <= 1e+233) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z * t) / -a t_2 = -t / (a / z) tmp = 0 if (z * t) <= -math.inf: tmp = t_2 elif (z * t) <= -2e-53: tmp = t_1 elif (z * t) <= 2e-125: tmp = (x * y) / a elif (z * t) <= 1e+233: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z * t) / Float64(-a)) t_2 = Float64(Float64(-t) / Float64(a / z)) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = t_2; elseif (Float64(z * t) <= -2e-53) tmp = t_1; elseif (Float64(z * t) <= 2e-125) tmp = Float64(Float64(x * y) / a); elseif (Float64(z * t) <= 1e+233) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z * t) / -a; t_2 = -t / (a / z); tmp = 0.0; if ((z * t) <= -Inf) tmp = t_2; elseif ((z * t) <= -2e-53) tmp = t_1; elseif ((z * t) <= 2e-125) tmp = (x * y) / a; elseif ((z * t) <= 1e+233) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] / (-a)), $MachinePrecision]}, Block[{t$95$2 = N[((-t) / N[(a / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], t$95$2, If[LessEqual[N[(z * t), $MachinePrecision], -2e-53], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e-125], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+233], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z \cdot t}{-a}\\
t_2 := \frac{-t}{\frac{a}{z}}\\
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-125}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{elif}\;z \cdot t \leq 10^{+233}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0 or 9.99999999999999974e232 < (*.f64 z t) Initial program 74.6%
Taylor expanded in x around 0 76.5%
mul-1-neg76.5%
*-commutative76.5%
distribute-rgt-neg-in76.5%
Simplified76.5%
*-commutative76.5%
distribute-lft-neg-out76.5%
remove-double-neg76.5%
frac-2neg76.5%
associate-*r/94.2%
*-commutative94.2%
add-sqr-sqrt41.4%
sqrt-unprod42.1%
sqr-neg42.1%
sqrt-unprod3.9%
add-sqr-sqrt4.2%
Applied egg-rr4.2%
add-sqr-sqrt2.2%
sqrt-unprod34.7%
*-commutative34.7%
clear-num34.7%
div-inv34.7%
*-commutative34.7%
clear-num34.7%
div-inv34.7%
*-un-lft-identity34.7%
associate-*l*34.7%
metadata-eval34.7%
swap-sqr34.7%
clear-num34.7%
div-inv34.7%
clear-num34.7%
div-inv34.7%
sqrt-unprod41.3%
add-sqr-sqrt94.1%
Applied egg-rr94.3%
if -inf.0 < (*.f64 z t) < -2.00000000000000006e-53 or 2.00000000000000002e-125 < (*.f64 z t) < 9.99999999999999974e232Initial program 98.1%
Taylor expanded in x around 0 75.3%
mul-1-neg75.3%
*-commutative75.3%
distribute-rgt-neg-in75.3%
Simplified75.3%
if -2.00000000000000006e-53 < (*.f64 z t) < 2.00000000000000002e-125Initial program 93.2%
Taylor expanded in x around inf 81.1%
Final simplification81.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* x y) (* z t))))
(if (<= t_1 (- INFINITY))
(* y (- (/ x a) (* t (/ z (* y a)))))
(if (<= t_1 1e+270) (/ t_1 a) (* (- (* x (/ y z)) t) (/ z 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 = y * ((x / a) - (t * (z / (y * a))));
} else if (t_1 <= 1e+270) {
tmp = t_1 / a;
} else {
tmp = ((x * (y / z)) - t) * (z / a);
}
return tmp;
}
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 = y * ((x / a) - (t * (z / (y * a))));
} else if (t_1 <= 1e+270) {
tmp = t_1 / a;
} else {
tmp = ((x * (y / z)) - t) * (z / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x * y) - (z * t) tmp = 0 if t_1 <= -math.inf: tmp = y * ((x / a) - (t * (z / (y * a)))) elif t_1 <= 1e+270: tmp = t_1 / a else: tmp = ((x * (y / z)) - t) * (z / a) return tmp
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(y * Float64(Float64(x / a) - Float64(t * Float64(z / Float64(y * a))))); elseif (t_1 <= 1e+270) tmp = Float64(t_1 / a); else tmp = Float64(Float64(Float64(x * Float64(y / z)) - t) * Float64(z / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * y) - (z * t); tmp = 0.0; if (t_1 <= -Inf) tmp = y * ((x / a) - (t * (z / (y * a)))); elseif (t_1 <= 1e+270) tmp = t_1 / a; else tmp = ((x * (y / z)) - t) * (z / a); end tmp_2 = tmp; end
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[(y * N[(N[(x / a), $MachinePrecision] - N[(t * N[(z / N[(y * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+270], N[(t$95$1 / a), $MachinePrecision], N[(N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] * N[(z / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y - z \cdot t\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - t \cdot \frac{z}{y \cdot a}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+270}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \frac{y}{z} - t\right) \cdot \frac{z}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 55.4%
Taylor expanded in y around inf 69.8%
+-commutative69.8%
mul-1-neg69.8%
unsub-neg69.8%
associate-/l*84.3%
Simplified84.3%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 1e270Initial program 98.5%
if 1e270 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 73.4%
Taylor expanded in z around inf 78.5%
associate-/l*81.0%
Simplified81.0%
Taylor expanded in z around inf 87.7%
+-commutative87.7%
mul-1-neg87.7%
unsub-neg87.7%
times-frac92.3%
associate-*l/92.5%
div-sub97.5%
associate-*r/90.3%
associate-/l*78.5%
*-commutative78.5%
associate-*r/81.0%
*-rgt-identity81.0%
cancel-sign-sub-inv81.0%
distribute-lft-neg-in81.0%
fma-undefine81.0%
associate-/l*95.1%
Simplified95.1%
Final simplification96.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* z t) (- INFINITY)) (not (<= (* z t) 2e+184))) (* (- (* x (/ y z)) 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)) || !((z * t) <= 2e+184)) {
tmp = ((x * (y / z)) - 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) || !((z * t) <= 2e+184)) {
tmp = ((x * (y / z)) - 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) or not ((z * t) <= 2e+184): tmp = ((x * (y / z)) - 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)) || !(Float64(z * t) <= 2e+184)) tmp = Float64(Float64(Float64(x * Float64(y / z)) - t) * 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) || ~(((z * t) <= 2e+184))) tmp = ((x * (y / z)) - t) * (z / a); else tmp = ((x * y) - (z * t)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[(z * t), $MachinePrecision], 2e+184]], $MachinePrecision]], N[(N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision] * 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 \lor \neg \left(z \cdot t \leq 2 \cdot 10^{+184}\right):\\
\;\;\;\;\left(x \cdot \frac{y}{z} - t\right) \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0 or 2.00000000000000003e184 < (*.f64 z t) Initial program 77.9%
Taylor expanded in z around inf 81.2%
associate-/l*82.9%
Simplified82.9%
Taylor expanded in z around inf 95.0%
+-commutative95.0%
mul-1-neg95.0%
unsub-neg95.0%
times-frac91.6%
associate-*l/96.6%
div-sub99.8%
associate-*r/96.7%
associate-/l*81.2%
*-commutative81.2%
associate-*r/82.9%
*-rgt-identity82.9%
cancel-sign-sub-inv82.9%
distribute-lft-neg-in82.9%
fma-undefine82.9%
associate-/l*99.9%
Simplified99.9%
if -inf.0 < (*.f64 z t) < 2.00000000000000003e184Initial program 95.6%
Final simplification96.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= (* z t) (- INFINITY)) (not (<= (* z t) 1e+233))) (/ (- t) (/ a z)) (/ (- (* x y) (* z t)) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (((z * t) <= -((double) INFINITY)) || !((z * t) <= 1e+233)) {
tmp = -t / (a / z);
} 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) || !((z * t) <= 1e+233)) {
tmp = -t / (a / z);
} else {
tmp = ((x * y) - (z * t)) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if ((z * t) <= -math.inf) or not ((z * t) <= 1e+233): tmp = -t / (a / z) 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)) || !(Float64(z * t) <= 1e+233)) tmp = Float64(Float64(-t) / Float64(a / z)); 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) || ~(((z * t) <= 1e+233))) tmp = -t / (a / z); else tmp = ((x * y) - (z * t)) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[(z * t), $MachinePrecision], 1e+233]], $MachinePrecision]], N[((-t) / N[(a / z), $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 \lor \neg \left(z \cdot t \leq 10^{+233}\right):\\
\;\;\;\;\frac{-t}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0 or 9.99999999999999974e232 < (*.f64 z t) Initial program 74.6%
Taylor expanded in x around 0 76.5%
mul-1-neg76.5%
*-commutative76.5%
distribute-rgt-neg-in76.5%
Simplified76.5%
*-commutative76.5%
distribute-lft-neg-out76.5%
remove-double-neg76.5%
frac-2neg76.5%
associate-*r/94.2%
*-commutative94.2%
add-sqr-sqrt41.4%
sqrt-unprod42.1%
sqr-neg42.1%
sqrt-unprod3.9%
add-sqr-sqrt4.2%
Applied egg-rr4.2%
add-sqr-sqrt2.2%
sqrt-unprod34.7%
*-commutative34.7%
clear-num34.7%
div-inv34.7%
*-commutative34.7%
clear-num34.7%
div-inv34.7%
*-un-lft-identity34.7%
associate-*l*34.7%
metadata-eval34.7%
swap-sqr34.7%
clear-num34.7%
div-inv34.7%
clear-num34.7%
div-inv34.7%
sqrt-unprod41.3%
add-sqr-sqrt94.1%
Applied egg-rr94.3%
if -inf.0 < (*.f64 z t) < 9.99999999999999974e232Initial program 95.8%
Final simplification95.5%
(FPCore (x y z t a) :precision binary64 (if (<= (* x y) -3.5e+59) (* x (/ y a)) (if (<= (* x y) 5e+31) (* z (- (/ t a))) (/ (* x y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -3.5e+59) {
tmp = x * (y / a);
} else if ((x * y) <= 5e+31) {
tmp = z * -(t / 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 ((x * y) <= (-3.5d+59)) then
tmp = x * (y / a)
else if ((x * y) <= 5d+31) then
tmp = z * -(t / 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 ((x * y) <= -3.5e+59) {
tmp = x * (y / a);
} else if ((x * y) <= 5e+31) {
tmp = z * -(t / a);
} else {
tmp = (x * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x * y) <= -3.5e+59: tmp = x * (y / a) elif (x * y) <= 5e+31: tmp = z * -(t / a) else: tmp = (x * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -3.5e+59) tmp = Float64(x * Float64(y / a)); elseif (Float64(x * y) <= 5e+31) tmp = Float64(z * Float64(-Float64(t / 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 ((x * y) <= -3.5e+59) tmp = x * (y / a); elseif ((x * y) <= 5e+31) tmp = z * -(t / a); else tmp = (x * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -3.5e+59], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+31], N[(z * (-N[(t / a), $MachinePrecision])), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.5 \cdot 10^{+59}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+31}:\\
\;\;\;\;z \cdot \left(-\frac{t}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -3.5e59Initial program 84.7%
Taylor expanded in x around inf 64.2%
associate-*r/71.5%
Simplified71.5%
if -3.5e59 < (*.f64 x y) < 5.00000000000000027e31Initial program 93.9%
Taylor expanded in x around 0 77.1%
*-commutative77.1%
associate-*r/80.5%
neg-mul-180.5%
distribute-rgt-neg-in80.5%
distribute-frac-neg80.5%
Simplified80.5%
if 5.00000000000000027e31 < (*.f64 x y) Initial program 90.5%
Taylor expanded in x around inf 82.6%
Final simplification79.1%
(FPCore (x y z t a) :precision binary64 (if (<= (* x y) -5e-16) (* y (/ x a)) (if (<= (* x y) 5e+31) (* t (/ (- z) a)) (/ (* x y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -5e-16) {
tmp = y * (x / a);
} else if ((x * y) <= 5e+31) {
tmp = t * (-z / 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 ((x * y) <= (-5d-16)) then
tmp = y * (x / a)
else if ((x * y) <= 5d+31) then
tmp = t * (-z / 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 ((x * y) <= -5e-16) {
tmp = y * (x / a);
} else if ((x * y) <= 5e+31) {
tmp = t * (-z / a);
} else {
tmp = (x * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x * y) <= -5e-16: tmp = y * (x / a) elif (x * y) <= 5e+31: tmp = t * (-z / a) else: tmp = (x * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -5e-16) tmp = Float64(y * Float64(x / a)); elseif (Float64(x * y) <= 5e+31) tmp = Float64(t * Float64(Float64(-z) / 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 ((x * y) <= -5e-16) tmp = y * (x / a); elseif ((x * y) <= 5e+31) tmp = t * (-z / a); else tmp = (x * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -5e-16], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e+31], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -5 \cdot 10^{-16}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{+31}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.0000000000000004e-16Initial program 87.5%
Taylor expanded in z around inf 76.7%
associate-/l*73.9%
Simplified73.9%
Taylor expanded in z around 0 61.4%
associate-*l/66.3%
*-commutative66.3%
Simplified66.3%
if -5.0000000000000004e-16 < (*.f64 x y) < 5.00000000000000027e31Initial program 93.7%
Taylor expanded in x around 0 82.1%
mul-1-neg82.1%
associate-/l*73.7%
distribute-rgt-neg-in73.7%
distribute-neg-frac273.7%
Simplified73.7%
if 5.00000000000000027e31 < (*.f64 x y) Initial program 90.5%
Taylor expanded in x around inf 82.6%
Final simplification73.4%
(FPCore (x y z t a) :precision binary64 (if (<= (* x y) -2e+117) (* x (/ y a)) (/ (* x y) a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x * y) <= -2e+117) {
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 ((x * y) <= (-2d+117)) 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 ((x * y) <= -2e+117) {
tmp = x * (y / a);
} else {
tmp = (x * y) / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x * y) <= -2e+117: tmp = x * (y / a) else: tmp = (x * y) / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (Float64(x * y) <= -2e+117) 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 ((x * y) <= -2e+117) tmp = x * (y / a); else tmp = (x * y) / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+117], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+117}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e117Initial program 79.1%
Taylor expanded in x around inf 58.7%
associate-*r/73.9%
Simplified73.9%
if -2.0000000000000001e117 < (*.f64 x y) Initial program 93.5%
Taylor expanded in x around inf 42.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -6.5e-171) (* x (/ y a)) (/ y (/ a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.5e-171) {
tmp = x * (y / a);
} else {
tmp = y / (a / x);
}
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 <= (-6.5d-171)) then
tmp = x * (y / a)
else
tmp = y / (a / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6.5e-171) {
tmp = x * (y / a);
} else {
tmp = y / (a / x);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6.5e-171: tmp = x * (y / a) else: tmp = y / (a / x) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6.5e-171) tmp = Float64(x * Float64(y / a)); else tmp = Float64(y / Float64(a / x)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6.5e-171) tmp = x * (y / a); else tmp = y / (a / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6.5e-171], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(y / N[(a / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-171}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{a}{x}}\\
\end{array}
\end{array}
if z < -6.5000000000000004e-171Initial program 94.8%
Taylor expanded in x around inf 41.3%
associate-*r/39.5%
Simplified39.5%
if -6.5000000000000004e-171 < z Initial program 88.6%
Taylor expanded in z around inf 81.3%
associate-/l*78.5%
Simplified78.5%
Taylor expanded in z around 0 47.5%
associate-*l/46.7%
*-commutative46.7%
Simplified46.7%
clear-num46.2%
un-div-inv46.2%
Applied egg-rr46.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.05e-169) (* x (/ y a)) (* y (/ x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.05e-169) {
tmp = x * (y / a);
} else {
tmp = y * (x / 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 <= (-2.05d-169)) then
tmp = x * (y / a)
else
tmp = y * (x / 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 <= -2.05e-169) {
tmp = x * (y / a);
} else {
tmp = y * (x / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.05e-169: tmp = x * (y / a) else: tmp = y * (x / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.05e-169) tmp = Float64(x * Float64(y / a)); else tmp = Float64(y * Float64(x / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.05e-169) tmp = x * (y / a); else tmp = y * (x / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.05e-169], N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-169}:\\
\;\;\;\;x \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if z < -2.0499999999999999e-169Initial program 94.8%
Taylor expanded in x around inf 41.3%
associate-*r/39.5%
Simplified39.5%
if -2.0499999999999999e-169 < z Initial program 88.6%
Taylor expanded in z around inf 81.3%
associate-/l*78.5%
Simplified78.5%
Taylor expanded in z around 0 47.5%
associate-*l/46.7%
*-commutative46.7%
Simplified46.7%
(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 91.4%
Taylor expanded in x around inf 44.7%
associate-*r/44.3%
Simplified44.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 2024123
(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))