
(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 10 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))
(* y (- (/ x a) (* t (/ z (* y a)))))
(if (<= t_1 4e+260) (/ t_1 a) (- (* x (/ y a)) (* z (/ 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 = y * ((x / a) - (t * (z / (y * a))));
} else if (t_1 <= 4e+260) {
tmp = t_1 / a;
} else {
tmp = (x * (y / a)) - (z * (t / 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 = y * ((x / a) - (t * (z / (y * a))));
} else if (t_1 <= 4e+260) {
tmp = t_1 / a;
} else {
tmp = (x * (y / a)) - (z * (t / 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 = y * ((x / a) - (t * (z / (y * a)))) elif t_1 <= 4e+260: tmp = t_1 / a else: tmp = (x * (y / a)) - (z * (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(y * Float64(Float64(x / a) - Float64(t * Float64(z / Float64(y * a))))); elseif (t_1 <= 4e+260) tmp = Float64(t_1 / a); else tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / 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 = y * ((x / a) - (t * (z / (y * a))));
elseif (t_1 <= 4e+260)
tmp = t_1 / a;
else
tmp = (x * (y / a)) - (z * (t / 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[(y * N[(N[(x / a), $MachinePrecision] - N[(t * N[(z / N[(y * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+260], N[(t$95$1 / a), $MachinePrecision], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $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:\\
\;\;\;\;y \cdot \left(\frac{x}{a} - t \cdot \frac{z}{y \cdot a}\right)\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+260}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 67.6%
Taylor expanded in y around inf 73.2%
+-commutative73.2%
mul-1-neg73.2%
unsub-neg73.2%
associate-/l*83.5%
Simplified83.5%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.00000000000000026e260Initial program 99.7%
if 4.00000000000000026e260 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 64.3%
div-sub64.3%
associate-/l*79.6%
associate-/l*97.2%
Applied egg-rr97.2%
Final simplification97.5%
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))
(* z (/ (- (/ (* x y) z) t) a))
(if (<= t_1 4e+260) (/ t_1 a) (- (* x (/ y a)) (* z (/ 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 = z * ((((x * y) / z) - t) / a);
} else if (t_1 <= 4e+260) {
tmp = t_1 / a;
} else {
tmp = (x * (y / a)) - (z * (t / 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 = z * ((((x * y) / z) - t) / a);
} else if (t_1 <= 4e+260) {
tmp = t_1 / a;
} else {
tmp = (x * (y / a)) - (z * (t / 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 = z * ((((x * y) / z) - t) / a) elif t_1 <= 4e+260: tmp = t_1 / a else: tmp = (x * (y / a)) - (z * (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(z * Float64(Float64(Float64(Float64(x * y) / z) - t) / a)); elseif (t_1 <= 4e+260) tmp = Float64(t_1 / a); else tmp = Float64(Float64(x * Float64(y / a)) - Float64(z * Float64(t / 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 = z * ((((x * y) / z) - t) / a);
elseif (t_1 <= 4e+260)
tmp = t_1 / a;
else
tmp = (x * (y / a)) - (z * (t / 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[(z * N[(N[(N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision] - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e+260], N[(t$95$1 / a), $MachinePrecision], N[(N[(x * N[(y / a), $MachinePrecision]), $MachinePrecision] - N[(z * N[(t / a), $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:\\
\;\;\;\;z \cdot \frac{\frac{x \cdot y}{z} - t}{a}\\
\mathbf{elif}\;t\_1 \leq 4 \cdot 10^{+260}:\\
\;\;\;\;\frac{t\_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a} - z \cdot \frac{t}{a}\\
\end{array}
\end{array}
if (-.f64 (*.f64 x y) (*.f64 z t)) < -inf.0Initial program 67.6%
Taylor expanded in z around inf 83.2%
+-commutative83.2%
mul-1-neg83.2%
unsub-neg83.2%
associate-/l*86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in a around 0 86.9%
if -inf.0 < (-.f64 (*.f64 x y) (*.f64 z t)) < 4.00000000000000026e260Initial program 99.7%
if 4.00000000000000026e260 < (-.f64 (*.f64 x y) (*.f64 z t)) Initial program 64.3%
div-sub64.3%
associate-/l*79.6%
associate-/l*97.2%
Applied egg-rr97.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 (<= (* z t) (- INFINITY))
(* t (/ (- z) a))
(if (<= (* z t) 5e+204)
(/ (- (* x y) (* z t)) a)
(* z (/ (- (/ (* x y) z) t) 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 ((z * t) <= -((double) INFINITY)) {
tmp = t * (-z / a);
} else if ((z * t) <= 5e+204) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = z * ((((x * y) / z) - t) / 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 tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = t * (-z / a);
} else if ((z * t) <= 5e+204) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = z * ((((x * y) / z) - t) / a);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -math.inf: tmp = t * (-z / a) elif (z * t) <= 5e+204: tmp = ((x * y) - (z * t)) / a else: tmp = z * ((((x * y) / z) - t) / 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(z * t) <= Float64(-Inf)) tmp = Float64(t * Float64(Float64(-z) / a)); elseif (Float64(z * t) <= 5e+204) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(z * Float64(Float64(Float64(Float64(x * y) / z) - t) / 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 ((z * t) <= -Inf)
tmp = t * (-z / a);
elseif ((z * t) <= 5e+204)
tmp = ((x * y) - (z * t)) / a;
else
tmp = z * ((((x * y) / z) - t) / 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[(z * t), $MachinePrecision], (-Infinity)], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+204], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(z * N[(N[(N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision] - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+204}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{\frac{x \cdot y}{z} - t}{a}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 56.6%
Taylor expanded in x around 0 56.6%
mul-1-neg56.6%
associate-/l*99.8%
distribute-rgt-neg-in99.8%
distribute-neg-frac299.8%
Simplified99.8%
if -inf.0 < (*.f64 z t) < 5.00000000000000008e204Initial program 95.2%
if 5.00000000000000008e204 < (*.f64 z t) Initial program 77.2%
Taylor expanded in z around inf 89.5%
+-commutative89.5%
mul-1-neg89.5%
unsub-neg89.5%
associate-/l*89.6%
*-commutative89.6%
Simplified89.6%
Taylor expanded in a around 0 99.9%
Final simplification96.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 (<= (* z t) (- INFINITY)) (* t (/ (- z) a)) (if (<= (* z t) 4e+269) (/ (- (* x y) (* z t)) a) (/ z (/ a (- t))))))
assert(x < y && y < z && z < t && 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 if ((z * t) <= 4e+269) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = z / (a / -t);
}
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 tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = t * (-z / a);
} else if ((z * t) <= 4e+269) {
tmp = ((x * y) - (z * t)) / a;
} else {
tmp = z / (a / -t);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if (z * t) <= -math.inf: tmp = t * (-z / a) elif (z * t) <= 4e+269: tmp = ((x * y) - (z * t)) / a else: tmp = z / (a / -t) 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(z * t) <= Float64(-Inf)) tmp = Float64(t * Float64(Float64(-z) / a)); elseif (Float64(z * t) <= 4e+269) tmp = Float64(Float64(Float64(x * y) - Float64(z * t)) / a); else tmp = Float64(z / Float64(a / Float64(-t))); 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 ((z * t) <= -Inf)
tmp = t * (-z / a);
elseif ((z * t) <= 4e+269)
tmp = ((x * y) - (z * t)) / a;
else
tmp = z / (a / -t);
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[(z * t), $MachinePrecision], (-Infinity)], N[(t * N[((-z) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+269], N[(N[(N[(x * y), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(z / N[(a / (-t)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+269}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{a}{-t}}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 56.6%
Taylor expanded in x around 0 56.6%
mul-1-neg56.6%
associate-/l*99.8%
distribute-rgt-neg-in99.8%
distribute-neg-frac299.8%
Simplified99.8%
if -inf.0 < (*.f64 z t) < 4.0000000000000002e269Initial program 95.4%
if 4.0000000000000002e269 < (*.f64 z t) Initial program 71.2%
Taylor expanded in x around 0 71.2%
*-commutative71.2%
associate-*r/95.5%
neg-mul-195.5%
distribute-rgt-neg-in95.5%
distribute-frac-neg95.5%
Simplified95.5%
clear-num95.3%
un-div-inv95.6%
add-sqr-sqrt52.0%
sqrt-unprod44.5%
sqr-neg44.5%
sqrt-unprod0.1%
add-sqr-sqrt4.6%
Applied egg-rr4.6%
associate-/r/4.6%
Simplified4.6%
associate-/r/4.6%
frac-2neg4.6%
distribute-neg-frac4.6%
add-sqr-sqrt4.5%
sqrt-unprod48.5%
sqr-neg48.5%
sqrt-unprod56.5%
add-sqr-sqrt95.6%
Applied egg-rr95.6%
Final simplification95.7%
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-5) (/ x (/ a y)) (if (<= (* x y) 5e-22) (/ (* 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) <= -5e-5) {
tmp = x / (a / y);
} else if ((x * y) <= 5e-22) {
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) <= (-5d-5)) then
tmp = x / (a / y)
else if ((x * y) <= 5d-22) 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) <= -5e-5) {
tmp = x / (a / y);
} else if ((x * y) <= 5e-22) {
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) <= -5e-5: tmp = x / (a / y) elif (x * y) <= 5e-22: 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) <= -5e-5) tmp = Float64(x / Float64(a / y)); elseif (Float64(x * y) <= 5e-22) tmp = Float64(Float64(z * Float64(-t)) / 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-5)
tmp = x / (a / y);
elseif ((x * y) <= 5e-22)
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], -5e-5], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 5e-22], N[(N[(z * (-t)), $MachinePrecision] / a), $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^{-5}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 5 \cdot 10^{-22}:\\
\;\;\;\;\frac{z \cdot \left(-t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000024e-5Initial program 86.6%
Taylor expanded in x around inf 71.2%
associate-*r/70.2%
Simplified70.2%
clear-num70.2%
un-div-inv71.3%
Applied egg-rr71.3%
if -5.00000000000000024e-5 < (*.f64 x y) < 4.99999999999999954e-22Initial program 95.9%
Taylor expanded in x around 0 80.8%
mul-1-neg80.8%
*-commutative80.8%
distribute-rgt-neg-in80.8%
Simplified80.8%
if 4.99999999999999954e-22 < (*.f64 x y) Initial program 86.4%
Taylor expanded in x around inf 68.4%
associate-*r/70.9%
Simplified70.9%
clear-num69.8%
un-div-inv69.9%
Applied egg-rr69.9%
associate-/r/72.5%
Applied egg-rr72.5%
Final simplification76.1%
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-5) (/ x (/ a y)) (if (<= (* x y) 1e+62) (* 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-5) {
tmp = x / (a / y);
} else if ((x * y) <= 1e+62) {
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-5)) then
tmp = x / (a / y)
else if ((x * y) <= 1d+62) 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-5) {
tmp = x / (a / y);
} else if ((x * y) <= 1e+62) {
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-5: tmp = x / (a / y) elif (x * y) <= 1e+62: 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-5) tmp = Float64(x / Float64(a / y)); elseif (Float64(x * y) <= 1e+62) tmp = Float64(t * Float64(Float64(-z) / 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-5)
tmp = x / (a / y);
elseif ((x * y) <= 1e+62)
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-5], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+62], 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^{-5}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\mathbf{elif}\;x \cdot y \leq 10^{+62}:\\
\;\;\;\;t \cdot \frac{-z}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if (*.f64 x y) < -5.00000000000000024e-5Initial program 86.6%
Taylor expanded in x around inf 71.2%
associate-*r/70.2%
Simplified70.2%
clear-num70.2%
un-div-inv71.3%
Applied egg-rr71.3%
if -5.00000000000000024e-5 < (*.f64 x y) < 1.00000000000000004e62Initial program 94.7%
Taylor expanded in x around 0 73.5%
mul-1-neg73.5%
associate-/l*73.2%
distribute-rgt-neg-in73.2%
distribute-neg-frac273.2%
Simplified73.2%
if 1.00000000000000004e62 < (*.f64 x y) Initial program 84.3%
Taylor expanded in x around inf 79.8%
associate-*r/95.0%
Simplified95.0%
clear-num95.1%
un-div-inv95.2%
Applied egg-rr95.2%
associate-/r/86.5%
Applied egg-rr86.5%
Final simplification75.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 (<= a 1.5e+104) (/ (* x y) 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 (a <= 1.5e+104) {
tmp = (x * y) / 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 (a <= 1.5d+104) then
tmp = (x * y) / 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 (a <= 1.5e+104) {
tmp = (x * y) / 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 a <= 1.5e+104: tmp = (x * y) / 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 (a <= 1.5e+104) tmp = Float64(Float64(x * y) / 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 (a <= 1.5e+104)
tmp = (x * y) / 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[a, 1.5e+104], N[(N[(x * y), $MachinePrecision] / a), $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}\;a \leq 1.5 \cdot 10^{+104}:\\
\;\;\;\;\frac{x \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\end{array}
\end{array}
if a < 1.49999999999999984e104Initial program 94.1%
Taylor expanded in x around inf 51.5%
if 1.49999999999999984e104 < a Initial program 73.3%
Taylor expanded in x around inf 45.5%
associate-*r/52.9%
Simplified52.9%
clear-num52.8%
un-div-inv52.8%
Applied egg-rr52.8%
associate-/r/48.1%
Applied egg-rr48.1%
Final simplification50.9%
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 (<= z -8.8e+15) (* y (/ x a)) (/ x (/ a y))))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -8.8e+15) {
tmp = y * (x / a);
} else {
tmp = x / (a / y);
}
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 (z <= (-8.8d+15)) then
tmp = y * (x / a)
else
tmp = x / (a / y)
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 (z <= -8.8e+15) {
tmp = y * (x / a);
} else {
tmp = x / (a / y);
}
return tmp;
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): tmp = 0 if z <= -8.8e+15: tmp = y * (x / a) else: tmp = x / (a / y) return tmp
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) tmp = 0.0 if (z <= -8.8e+15) tmp = Float64(y * Float64(x / a)); else tmp = Float64(x / Float64(a / y)); 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 (z <= -8.8e+15)
tmp = y * (x / a);
else
tmp = x / (a / y);
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[z, -8.8e+15], N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision], N[(x / N[(a / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+15}:\\
\;\;\;\;y \cdot \frac{x}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{a}{y}}\\
\end{array}
\end{array}
if z < -8.8e15Initial program 90.6%
Taylor expanded in x around inf 39.8%
associate-*r/40.1%
Simplified40.1%
clear-num40.1%
un-div-inv40.1%
Applied egg-rr40.1%
associate-/r/41.4%
Applied egg-rr41.4%
if -8.8e15 < z Initial program 91.0%
Taylor expanded in x around inf 53.9%
associate-*r/52.9%
Simplified52.9%
clear-num52.5%
un-div-inv53.7%
Applied egg-rr53.7%
Final simplification50.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 (* y (/ x a)))
assert(x < y && y < z && z < t && t < a);
double code(double x, double y, double z, double t, double a) {
return y * (x / 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 = y * (x / 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 y * (x / a);
}
[x, y, z, t, a] = sort([x, y, z, t, a]) def code(x, y, z, t, a): return y * (x / a)
x, y, z, t, a = sort([x, y, z, t, a]) function code(x, y, z, t, a) return Float64(y * Float64(x / a)) end
x, y, z, t, a = num2cell(sort([x, y, z, t, a])){:}
function tmp = code(x, y, z, t, a)
tmp = y * (x / 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[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a] = \mathsf{sort}([x, y, z, t, a])\\
\\
y \cdot \frac{x}{a}
\end{array}
Initial program 90.9%
Taylor expanded in x around inf 50.6%
associate-*r/49.8%
Simplified49.8%
clear-num49.5%
un-div-inv50.5%
Applied egg-rr50.5%
associate-/r/51.0%
Applied egg-rr51.0%
Final simplification51.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 (* 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 90.9%
Taylor expanded in x around inf 50.6%
associate-*r/49.8%
Simplified49.8%
(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 2024135
(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))